[rabbitmq-discuss] How to reuse and existing connection but have different channel
jkuch at gopivotal.com
Wed Feb 26 16:43:00 GMT 2014
> Currently, my publisher code instantiate a connection/channel and closes
> it if all successful. Is it possible to reuse an existing connection but
> have separate channel every time produces a message to rabbit?
It's not clear why you would want to create a new channel per message.
Typically one gets a connection, then multiplexes it into separate
channels and uses each channel for some conceptually related chunk of
behavior, e.g. publishing notifications of some sort, consuming messages,
> Also, after the basicPublish is executed, what do I check in the next line
> of code to make sure the broker have persisted or receive the message
If you want such an assurance you'll either have to perform that publish
with the context of an AMQP transaction (synchronous and kind of expensive)
or use publisher confirms, in which case you register an asynchronous
listener for confirm receipts that the broker sends when it's done what you
asked for, to the standard you asked.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rabbitmq-discuss