Created
April 24, 2015 06:42
-
-
Save Danthar/594d08dc26bc36cfab34 to your computer and use it in GitHub Desktop.
Consume RabbitMq messages with Akka : Part 2
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
//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