MRG Messaging AMQP Programming Tutorial for C++, Java, and Python

MRG Messaging implements the AMQP specification 1, which was written to create an open standard for interoperable messaging. AMQP defines both a wire level protocol (the transport layer) and higher level semantics for messaging (the functional layer). It is completely free to use and is being developed by the AMQP Working Group. AMQP is currently in draft and will be submitted to a standards body once it is completed.

In AMQP, a connection represents a network connection, and a session represents the interface between a client and a broker. A session uses a connection for communication. Sessions may be synchronous or asynchronous.

The following diagram shows how the MRG Messaging broker is used by producer-consumer applications. Message producers write to exchanges, exchanges route messages to queues, and message consumers read from queues.

A message producer creates a message, fills it with content, gives the message a routing key, and sends it to an exchange (for one kind of exchange, the fanout exchange, a routing key is optional). The routing key is simply a string that the exchange can use to determine to which queues the message should be delivered. The way the routing key is used depends on the exchange type, and is discussed later in this chapter. Before delivering a message, the message producer can also set various message properties in the message; for instance, one property determines whether the message is durable. A MRG Messaging broker does not lose durable messages. Even if the broker suffers a hardware failure, all durable messages are delivered when the broker is restarted. Another property can be used to specify message priority; the broker gives higher priority messages precedence.

An exchange accepts messages from message producers and routes them to message queues if the message meets the criteria expressed in a binding. A binding defines the relationship between an exchange and a message queue, specifying which messages should be routed to a given queue. For instance, a binding might state that all messages with a given routing key should be sent to a particular queue. If a queue is not bound to an exchange, it does not receive any messages from that exchange.

Get pdf tutorial for MRG Messaging AMQP Programming Tutorial for C++, Java, and Python

Related Tutorial

Tags: , , , , , , , , , , , , , , , , , , ,

Comments

Leave a Reply