/Foo.cs Secret
Created
February 5, 2014 13:48
Foo fron FooConsole
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Federations.FooConsole | |
{ | |
using System; | |
using BarMessages; | |
using EasyNetQ; | |
using FooMessages; | |
public class Foo | |
{ | |
private readonly IBus bus; | |
public Foo(IBus bus) | |
{ | |
this.bus = bus; | |
} | |
public void DoIt() | |
{ | |
bus.Subscribe<Started>("foo", started => | |
{ | |
Console.WriteLine("Started received: {0}", started.Id); | |
bus.Publish(new Stop { Id = started.Id }); | |
}); | |
bus.Subscribe<Stopped>("foo", stopped => | |
{ | |
Console.WriteLine("Stopped received: {0}", stopped.Id); | |
}); | |
Console.WriteLine("press key to send message"); | |
Console.ReadKey(); | |
var start = new Start { Id = Guid.NewGuid() }; | |
bus.Publish(start); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment