Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Consume RabbitMq messages with Akka : Part 2
//this is with the easynetq librabry but could just as easily be anything else.
rabbitBus.Subscribe<MyMessageType>(subscriptionId, message => {
Log.Debug("message from rabbitmq received");
//this works! because of how Ask works (it creates a fake actor that is passed as sender behind the scenes)
var result = workers.Ask<WorkCompleted>(new StartWorkFor() {Details = message}).Result;
});
//however this...
Receive<string>(m => m.Equals("dothething"), m => {
rabbitBus.Subscribe<mycommand>(subscriptionId, command => {
//here we do a Tell. this worker eventually communicates back with WorkComplete
worker.Tell(new StartWorkFor());
});
});
Receive<WorkComplete>(_ => {
//this never gets called, unless..
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.