Logic for handling AMQP publishing with assurance that everything is correctly created and connected.
Logic for handling AMQP publishing with assurance that everything is correctly created and connected.
the AMQP producer actor
the logic handling receive
Setup AMQP producer initialization and optionally exchange declaration
Setup AMQP producer initialization and optionally exchange declaration
a future of the producer actorRef, not necessarily fully connected to AMQP
Method for changing actor context while keeping necessary handling control behaviour.
Method for changing actor context while keeping necessary handling control behaviour.
the AMQP producer actor
the new context to change
A trait that extends an AMQP 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 AMQP and can assume all is ready for publishing, as well as defining thesetupAmqp
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.