Hi Jesse,
I find that when I do a
basicPublish and something goes wrong with communicating the message to
RabbitMQ, I do not get told anything (in this case I was setting a UserID
that did not match the logged-in id).
That's the expected behaviour, unfortunately.

The trouble is that AMQP publishes are asynchronous, so basicPublish in
the client returns immediately after sending the message to the server
(because it has nothing to wait for). So, if the server closes the
channel as a result of the publish, you'll only find out about it on the
next method.
However that
error will often be in a completely different part of the code, so the
stack trace is basically useless. Is there something I should call after I
do a publish to verify that the message went through correctly?
If it's for debugging purposes, you could just add a queueDeclarePassive
after the publish; that'll trigger the exception.

If not, you should be prepared to handle it. In a long chain of
publishes, you should use something like publisher confirms, and resend
messages that were not confirmed before the channel died (for whatever
reason).

http://www.rabbitmq.com/extensions.html#confirms

If you don't care about performance (i.e. if the throughput of these
messages is very small), set the channel into tx mode, and do a
tx.commit after each publish.

Also, why does the error pop up in a "completely different part of the
code"? Channels are very cheap; there's no need to reuse channels for
different tasks.

Hope this helps.

Cheers,
Alex
On Mon, Nov 07, 2011 at 02:05:14PM -0800, Jesse C wrote:
Hey,

So I'm working on writing a program using the Java client and I'm not sure
the best way to handle channel errors. I find that when I do a
basicPublish and something goes wrong with communicating the message to
RabbitMQ, I do not get told anything (in this case I was setting a UserID
that did not match the logged-in id). The next time I attempt to access
the channel, I get an error that relates to what went wrong. However that
error will often be in a completely different part of the code, so the
stack trace is basically useless. Is there something I should call after I
do a publish to verify that the message went through correctly?

thanks,

jesse c
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
grouprabbitmq-discuss @
categoriesrabbitmq
postedNov 7, '11 at 10:05p
activeNov 9, '11 at 1:33a
posts2
users2
websiterabbitmq.com
irc#rabbitmq

2 users in discussion

Jesse C: 1 post Alexandru Scvorţov: 1 post

People

Translate

site design / logo © 2018 Grokbase