Messaging service is a RESTful API-based messaging service. It supports distributed web applications,and is based on the OpenStack Zaqar project.
Messaging service is a vital component of large, distributed web applications. You can use Messaging service for public, private, and hybrid cloud environments.
As you develop distributed web applications, you often have multiple agents set up to complete sets of tasks for those applications. These tasks can be anything from creating users to deleting blocks of storage. Messaging service provides a simple interface that creates these tasks as queues, messages, and claims. The interface then posts, claims, reads, and deletes them as the tasks are needed and performed.
Messaging service handles the distribution of tasks, but it does not necessarily manage the order of the tasks. Applications handle the workflow at a higher level.
This guide explains how to access and start using the API so that you can begin to use Messaging service for your applications. Instructions are given for how to properly enter the necessary URLs, using cURL, to set up and use a basic set of Messaging service operations.
In order to run the examples in this guide, you must have the following prerequisites:
Following is an overview of how Messaging service works. For definitions of Messaging service terms, see the below glossary.
You create a queue to which producers or publishers post messages.
Workers (consumers or subscribers) claim or get a message from the queue, complete the work in that message, and delete the message.
If a worker will be off-line before it completes the work in a message, the worker can retire the claim’s time to live (TTL), putting the message back into the queue for another worker to claim.
Subscribers monitor the claims from these queues to track activity and help troubleshoot errors.
For the majority of use cases, Messaging service is not responsible for the ordering of messages. However, if there is only a single producer, Messaging service ensures that messages are handled in a First In, First Out (FIFO) order.
The Messaging service API supports a variety of messaging patterns including the following:
The task distribution pattern has the following characteristics:
This pattern is ideal for dispatching jobs to multiple processors.
Characteristics of the event broadcasting pattern are:
This pattern is ideal for notification of events to multiple observers at once.
Characteristics of the point-to-point messaging pattern are:
This pattern is ideal for communicating with a specific client, especially when a reply is desired from that client.
This section lists all of the operations that are available in the Messaging service API. This document uses some of the most common operations in OpenStack API Reference..
For details about all of the operations, see the Messaging service API v2 Reference.
The following operations are available for queues:
The following operations are available for messages:
The following operations are available for claims:
The following operations are available for subscriptions:
The following operations are available for Pools:
The following operations are available for Flavors:
The following operations are available for Health:
Queuing systems are used to coordinate tasks within an application. Here are some examples:
Following are some generic use cases for Messaging service:
For more information about using the API, see the Messaging service API v2 Reference. All you need to get started with Messaging service is the getting started guide, the reference, and your Cloud account.
For information about the OpenStack Zaqar API, see OpenStack API Reference.
This API uses standard HTTP 1.1 response codes as documented at www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.
Claim The process of a worker checking out a message to perform a task. Claiming a message prevents other workers from attempting to process the same messages.
Claim TTL Defines how long a message will be in claimed state. A message can be claimed by one worker at a time.
Consumer A server that claims messages from the queue.
Message A task, a notification, or any meaningful data that a producer or publisher sends to the queue. A message exists until it is deleted by a recipient or automatically by the system based on a TTL (time-to-live) value.
Message TTL Defines how long a message will be accessible.
Producer A server or application that sends messages to the queue.
Producer - Consumer A pattern where each worker application that reads the queue has to claim the message in order to prevent duplicate processing. Later, when work is done, the worker is responsible for deleting the message. If message is not deleted in a predefined time, it can be claimed by other workers.
Publisher A server or application that posts messages to the queue with the intent to distribute information or updates to multiple subscribers.
Publisher - Subscriber A pattern where all worker applications have access to all messages in the queue. Workers cannot delete or update messages.
Queue The entity that holds messages. Ideally, a queue is created per work type. For example, if you want to compress files, you would create a queue dedicated to this job. Any application that reads from this queue would only compress files.
Subscriber An observer that watches messages like an RSS feed but does not claim any messages.
TTL Time-to-live value.
Worker A client that claims messages from the queue and performs actions based on those messages.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.