Message queue


Message queue

In computer science, message queues and mailboxes are software-engineering components used for interprocess communication, or for inter-thread communication within the same process. They use a queue for messaging – the passing of control or of content. Group communication systems provide similar kinds of functionality.

Contents

Overview

Message queues provide an asynchronous communications protocol, meaning that the sender and receiver of the message do not need to interact with the message queue at the same time. Messages placed onto the queue are stored until the recipient retrieves them. Message queues have implicit or explicit limits on the size of data that may be transmitted in a single message and the number of messages that may remain outstanding on the queue.

Many implementations of message queues function internally: within an operating system or within an application. Such queues exist for the purposes of that system only.[1][2]

Other implementations allow the passing of messages between different computer systems, potentially connecting multiple applications and multiple operating systems.[3] These message queueing systems typically provide enhanced resilience functionality to ensure that messages do not get "lost" in the event of a system failure. Examples of commercial implementations of this kind of message queueing software (also known as message-oriented middleware) include IBM's WebSphere MQ (formerly MQ Series) and Oracle Advanced Queuing (AQ). There is a Java standard called Java Message Service, which has several proprietary and free software implementations.

There are a number of open source choices of messaging middleware systems, including JBoss Messaging, JORAM, Apache ActiveMQ, Sun Open Message Queue, Apache Qpid[4], RabbitMQ, and HTTPSQS[5]

In addition to open source systems, hardware-based messaging middleware is a growing trend with vendors like Solace Systems, Sonoa / Apigee and Tervela offering queuing through silicon or silicon/software datapaths.

Most RTOSes, such as VxWorks and QNX operating systems encourage the use of message queueing as the primary IPC or inter-thread communication mechanism. The resulting tight integration between message passing and CPU scheduling is attributed as a main reason for the usability of RTOSes for real time applications. Early examples of commercial RTOSes that encouraged a message-queue basis to inter-thread communication also include VRTX and pSOS+, both of which date to the early 1980s.

Usage

In a typical message-queueing implementation, a system administrator installs and configures off-the-shelf message-queueing software (a queue manager), and defines a named message queue.

An application then registers a software routine that "listens" for messages placed onto the queue.

Second and subsequent applications may connect to the queue and transfer a message onto it.

The queue-manager software stores the messages until a receiving application connects and then calls the registered software routine. The receiving application then processes the message in an appropriate manner.

There are often numerous options as to the exact semantics of message passing, including:

  • Durability (e.g. - whether or not queued data can be merely kept in memory, or if it mustn't be lost, and thus must be stored on disk, or, more expensive[vague] still, it must be committed more reliably to a DBMS)
  • Security policies - which applications should have access to these messages?
  • Message purging policies - queues or messages may have a Time to live
  • Some systems support filtering data so that a subscriber may only see messages matching some pre-specified criteria of interest
  • Delivery policies - do we need to guarantee that a message is delivered at least once, or no more than once?
  • Routing policies - in a system with many queue servers, what servers should receive a message or a queue's messages?
  • Batching policies - should messages be delivered immediately? Or should the system wait a bit and try to deliver many messages at once?
  • When should a message be considered "enqueued"? When one queue has it? Or when it has been forwarded to at least one remote queue? Or to all queues?
  • A publisher may need to know when some or all subscribers have received a message.

These are all considerations that can have substantial effects on transaction semantics, system reliability, and system efficiency.

Synchronous vs. asynchronous

Many of the more widely-known communications protocols in use operate synchronously. The HTTP protocol – used in the World Wide Web and in web services – offers an obvious example where a user sends a request for a web page and then waits for a reply.

However, scenarios exist in which synchronous behaviour is not appropriate. For example, AJAX (Asynchronous Javascript and XML) can be used to asynchronously send text or XML messages to update part of a web page with more relevant information. Google uses this approach for their Google Suggest, a search feature which sends the user's partially typed queries to Google's servers and returns a list of possible full queries the user might be in the process of typing. This list is asynchronously updated as the user types.

Other asynchronous examples exist in event notification systems and publish/subscribe systems.

  • An application may need to notify another that an event has occurred, but does not need to wait for a response.
  • In publish/subscribe systems, an application "publishes" information for any number of clients to read.

In both of the above examples it would not make sense for the sender of the information to have to wait if, for example, one of the recipients had crashed.

Applications need not be exclusively synchronous or asynchronous. An interactive application may need to respond to certain parts of a request immediately (such as telling a customer that a sales request has been accepted, and handling the promise to draw on inventory), but may queue other parts (such as completing calculation of billing, forwarding data to the central accounting system, and calling on all sorts of other services) to be done some time later.

In all these sorts of situations, having a subsystem which performs message-queuing (or alternatively, a broadcast messaging system) can help improve the behaviour of the overall system.

See also

References

  1. ^ Win32 system message queues. "About Messages and Message Queues". Windows User Interface. Microsoft Developer Network. http://msdn.microsoft.com/en-us/library/ms644927(VS.85).aspx. Retrieved April 21, 2010. 
  2. ^ Linux and POSIX message queues. Overview of POSIX message queues at linux.die.net
  3. ^ For example, the MSMQ product. "Message Queuing (MSMQ)". Network Communication. Microsoft Developer Network. http://msdn.microsoft.com/en-us/library/ms711472.aspx. Retrieved May 9, 2009. 
  4. ^ Apache Qpid Project, an implementation of AMQP.
  5. ^ HTTPSQS, an message queue based on HTTP GET/POST protocol.

Wikimedia Foundation. 2010.

Look at other dictionaries:

  • Message Queue — In der Informatik bezeichnet eine Warteschlange (engl. Queue [kju]) eine häufig eingesetzte spezielle Datenstruktur. Inhaltsverzeichnis 1 Funktionsprinzip 2 Illustration 3 Anwendung 4 Imp …   Deutsch Wikipedia

  • message queue — place in the memory which stores messages which are transferred between applications …   English contemporary dictionary

  • Sun Java System Message Queue — Infobox Software name = Sun Java System Message Queue caption = developer = Sun Microsystems latest release version = 4.0 latest release date = May, 2006 operating system = Cross platform genre = Java Message Service license = Common Development… …   Wikipedia

  • Open Message Queue — Not to be confused with OpenAMQ, an open source implementation of AMQP. Open Message Queue Developer(s) Sun Microsystems Stable release 4.4 / December 10, 2009; 22 months ago (2009 12 10)[1 …   Wikipedia

  • Message-oriented middleware — (MOM) is software or hardware infrastructure supporting sending and receiving messages between distributed systems. MOM allows application modules to be distributed over heterogeneous platforms and reduces the complexity of developing… …   Wikipedia

  • Message Oriented Middleware — (MOM)  программное обеспечение промежуточного слоя, ориентированное на обмен сообщениями в распределённом окружении. [1] MOM прежде всего предназначен для реализации отложенного обмена сообщениями, в то время как peer to peer и… …   Википедия

  • Message loop in Microsoft Windows — Microsoft Windows programs are event based. They act upon messages that the operating system posts to the main thread of the application. These messages are received from the message queue by the application by repeatedly calling the GetMessage… …   Wikipedia

  • Message Queues — In der Informatik bezeichnet eine Warteschlange (engl. Queue [kju]) eine häufig eingesetzte spezielle Datenstruktur. Inhaltsverzeichnis 1 Funktionsprinzip 2 Illustration 3 Anwendung 4 Imp …   Deutsch Wikipedia

  • Message passing — This article is about the computer science concept. For other uses, see Message passing (disambiguation). Message passing in computer science is a form of communication used in parallel computing, object oriented programming, and interprocess… …   Wikipedia

  • Message Subliminal — Pour les articles homonymes, voir message (homonymie). Un message subliminal est un stimulus incorporé dans un objet, conçu pour être perçu à un niveau au dessous du niveau de conscience. Des techniques subliminales ont été utilisées dans la… …   Wikipédia en Français


Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”

We are using cookies for the best presentation of our site. Continuing to use this site, you agree with this.