Draft: Fix amqp connection issues
The hope is that some of this refactoring will address the AMQP connection issues we're having.
Issues addressed:
- Split apart the sending and receiving of messages, so that we have separate connections. In practice, most of the time we have different threads sending and receiving anyway, so bringing these two things together probably wasn't a great idea in the first place.
- Put a lock around message sending. In most cases, the message receipt is going to happen in the same thread, the one we create to run the message queue. However, message sending could happen either from the main thread (in apps like wf_monitor) or either a REST call or in response to receiving a message (in services). In the latter case we're guaranteed to have separate threads trying to access the same resource, so throwing a lock around access seems wise.
Work still to be done:
-
Update the unit tests to match -
Make clients ask for the queues they want rather than pre-creating persistent queues based on the service name
Edited by Daniel Lyons