You might find my library useful for this. It handles all the process and error stuff for you.
https://github.com/conduitframework/conduit
These slides give you idea of the code you would write.
Even if you don’t use it, you can see how those types of things are handled here.
https://github.com/conduitframework/conduit_amqp
EDIT: If you do use it and discover something that’s not well documented. Please file a ticket or a PR for it.






















