[rabbitmq-discuss] AlreadyClosedException in Java client
Matthias Radestock
matthias at rabbitmq.com
Wed Nov 3 11:57:37 GMT 2010
Jiri,
On 03/11/10 11:48, jiri at krutil.com wrote:
> Is there a way to say that the channel should remain open even if an
> error occurs in basic.publish?
No, all errors in AMQP close either the channel or the connection.
> Or a way how to get register a channel.close listener,
Yes. See Channel.addShutdownListener et al.
> so that I know I need to re-open the channel in case I want to
> continue using it?
There is a good chance that anything you do along these lines will be
racy. Since the errors arrive asynchronously it generally is impossible
to guarantee that the invocation of a method on a channel won't fail
with an AlreadyClosedException. So you may want to catch that exception
and re-open the channel then.
Regards,
Matthias.
More information about the rabbitmq-discuss
mailing list