[rabbitmq-discuss] Responsibility Transfer using RabbitMQ .NET API: How it works?

Alfonso Pantoja alfonso.pantoja at gmail.com
Mon Jan 24 16:47:17 GMT 2011


I've developed an application that consumes messages from a queue ("events
queue") and depending on their data
it publishes (per received message) a message to another queue ("results

The logic that checks the content of the received messages is publishing
messages using BasicPublish (with mandatory=2, immediate=false and setting
deliveryMode=2 to the messages to be sent)
My concern is that BasicPublish is asynchronous  and the only exception I
can get is when there is no connection to RabbitMQ or the destination
exchange does not exist.

Since the application logic at this point is synchronous I can't use
BasicReturn in order to use a handler when messages can't be delivered.

I've been googling a lot and some people suggested using this schema:


and also is suggested that "commit-ok" will be returned if the message has
been published safely to the broker.

Reading the API user guide I've found that this is called "transfer

Copy & paste follows:

To transfer responsibility for delivery of a message to a broker
• ensure (ahead of time) that the target queue exists and is durable,
• select Tx mode using IModel.TxSelect,
• publish the message with the "mandatory" flag set and DeliveryMode set
equal to 2, and
• commit the Tx transaction using IModel.TxCommit.

Once a broker replies with CommitOk (i.e. the TxCommit() call returns to the
caller), it has taken
responsibility for keeping the message on disk and on the target queue until
some other application
retrieves and acknowledges the message.
A commit is not required after every message: batching of publications may
be done, depending on the
precise delivery guarantees the publishing application requires.
Responsibility can also be placed with an external database, even further
along the chain - see the section
on interaction with external resources below

My question is:

Being TxCommit a void function I tested this block of code using a
non-existing routing key and I didn't get any exception.
Since safe publishing would be highly desiderable non routed messages should
be detected because the application ACKs the messages of "events queue"
when after evaluating its content has successfully sent another message to
the "results queue" (currently if a a routing key is not being routed to a
queue the messages are silently dropped and I have no way to detect the
failure so the application ACKs the messages from "events queue")

Please, can someone tell me how I can't get that "CommitOK" responses?

Thank you in advance.


PS: I'm using the API version 1.7.2 and RabbitMQ server is the same version.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110124/6268f02b/attachment.htm>

More information about the rabbitmq-discuss mailing list