Message queue

From Wikipedia, the free encyclopedia

(Redirected from Mailbox (computing))
Jump to: navigation, search

In computer science, a message queue is a software-engineering component used for interprocess communication or inter-thread communication within the same process. It uses a queue for messaging – the passing of control or of content. Group communication systems provide similar kinds of functionality.

Contents

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.

Most message queues have set limits on the size of data that can be transmitted in a single message. Those that do not have such limits are known as mailboxes.

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.

Other implementations allow the passing of messages between different computer systems, potentially connecting multiple applications and multiple operating systems. 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), Fiorano's MQ, Oracle Advanced Queuing (AQ) within an Oracle database, and Microsoft's MSMQ. There is a Java standard called Java Message Service, which has, associated with it, a number of implementations, both proprietary and open source.

There are a number of open source choices of messaging middleware systems, including JBoss Messaging, JORAM, ActiveMQ, RabbitMQ (an implementation, in Erlang, of AMQP), ISectd, Skytools PgQ (runs atop PostgreSQL, created by Skype).

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.

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 still, it must be committed more reliably to a DBMS)
  • Security policies
  • Message purging policies - queues or messages may have a TTL (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.

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.

In a synchronous model, one system makes a connection to another, sends a request and waits for a reply.

In many situations this makes perfect sense; for example, a user sends a request for a web page and then waits for a reply.

However, other scenarios exist in which such behaviour is not appropriate. For example, an application may need to notify another that an event has occurred, but does not need to wait for a response. Another example occurs in publish/subscribe systems, where an application "publishes" information for any number of clients to read. In both these 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.

Alternatively, 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 does asynchronous message-queuing (or alternatively, a broadcast messaging system) can help improve the behaviour of the overall system.

Advanced Search
Included Web Search Engines


Safe Search

close

Top Matching Results

Occasionally Search.com will highlight specialized results that are based on the context of your query. Examples of specialized results include specific links to news, images, or video.

Top Matching Results may highlight information from other Search.com pages, content from the CNET Network of sites, or third party content. The listings are based purely on relevance. Search.com does not receive payment for listings in this section but our partners that provide this data may get paid for listing these products.

Sponsored Links

This section contains paid listings which have been purchased by companies that want to have their sites appear for specific search terms and related content. These listings are administered, sorted and maintained by a third party and are not endorsed by Search.com.

Search Results

Search.com sends your search query to several search engines at one time and integrates the results into one list which has been sorted by relevance using Search.com's proprietary algorithm. You can customize the list of search engines included in your metasearch from the preferences.

The search engines that are used in your metasearch may allow companies to pay to have their Web sites included within the results. To view the Paid Inclusion policy for a specific search engine, please visit their Web site. Search.com does not accept payment or share revenue with any search engine partner for listings in this section.