Logic for handling rmq publishing with assurance that everything is correctly created and connected.
Logic for handling rmq publishing with assurance that everything is correctly created and connected.
the rmq producer actor
the logic handling receive
Setup rmq producer initialization and optionally exchange declaration
Setup rmq producer initialization and optionally exchange declaration
a future of the producer actorRef, not necessarily fully connected to rmq
Method for changing actor context while keeping necessary handling control behaviour.
Method for changing actor context while keeping necessary handling control behaviour.
the rmq producer actor
the new context to change
A trait that extends a rmq publisher and implements a common pattern where all received messages are stashed until the underlying producer is created and connected.
Mixing in this class requires defining the
producerConnected
method that should contain all the logic of publishing to rmq and can assume all is ready for publishing, as well as defining thesetupRmq
method which should create the producer actor. Another aspect of using this trait is that instead of using "context.become(newReceive)", one should use "stashedContextBecome(newReceive)" so that producer disconnected handling behaviour is not lost while changing context.