The mandatory and immediate flags


Both flags will cause undeliverable messages to be returned in certain cases. The returned messages arrive like delivered messages (asynchronously) on the session->returned_basic_list, just as delivered messages arrive on the session->delivered_basic_list.

The mandatory flag means, "return the message if it cannot be routed by the exchange", and the immediate flag means, "return the message if it cannot be delivered by the queue right away".

In a typical service-oriented model, each service is a queue bound to an exchange like The mandatory flag says, "return the message if no service is active" and the immediate flag says, "return the message if the service is busy".

We return the whole message, rather than just headers, so that the application can process it without any other context.


Add a New Comment

Edit | Files | Tags | Source | Print

rating: +1+x


Pieter Hintjens <moc.xitami|hp#moc.xitami|hp>

All tutorials

Performance Tests: This tutorial explains how to do OpenAMQ performance tests using 0MQ performance testing framework.

Broker federation: How to setup a geographically distributed federation of OpenAMQ brokers and how to define dataflows between individual geographical locations.

The ESB cookbook: How to implement your own Enterprise Service Bus, step by step, using OpenAMQ.

Publishing contents: How to publish contents at high speed without bizarre memory issues.

Tuning OpenAMQ for low latency: How to tune your operating system and hardware to get the lowest latency, i.e. the best response times, from your OpenAMQ broker.

The mandatory and immediate flags: How to use the 'mandatory' and 'immediate' flags on the Basic.Publish method.

Load balancing: How to use OpenAMQ to distribute work between multiple applications, a technique called "load balancing".

Content based routing: How to route messages based on their header properties. It is a fast and simple way to do 'content based routing' without needing to inspect entire messages. We explain the principles and provide worked examples.

Transient or durable subscriptions: How to make subscriptions that are transient (come and go with their consuming applications) or durable (stay around).

The AMQ model: How the AMQ model works: this is a basic backgrounder for anyone starting to use OpenAMQ in their applications.

Developing on Windows: How to build OpenAMQ client applications using MSVC on Windows

Handling Ctrl-C in applications: How to properly detect an interrupt (Ctrl-C) and shut-down gracefully in C/C++ WireAPI applications.