Clever Geek Handbook
📜 ⬆️ ⬇️

Message queue

The message queue (or mailbox ) - in computer science - is a software and engineering component used for interprocess or inter-thread communication within a single process . For messaging , a queue is used.

The message queue paradigm is akin to the publisher-subscriber pattern and is usually part of a larger message-oriented middleware system. Most messaging systems in their APIs support both message queue and publisher-subscriber models.

Content

  • 1 Review
  • 2 Application
  • 3 Standards and protocols
  • 4 Synchronous or asynchronous
  • 5 Implementation on UNIX
  • 6 See also
  • 7 notes
  • 8 References

Overview

Message queues provide an asynchronous data transfer protocol , meaning that the sender and receiver of the message are not required to communicate with the message queue at the same time. Queued messages are stored until the recipient receives them.

Message queues have implicit or explicit restrictions on the size of the data that can be transmitted in one message and the number of messages that can remain in the queue.

Many message queue implementations function internally: within the operating system or within the application . Such queues exist only for the purpose of this system.

Other implementations allow you to transfer messages between different computer systems , potentially connecting multiple applications and multiple operating systems. These message queuing systems typically provide enhanced resiliency functionality to ensure that messages are not “lost” in the event of a system failure.

Application

To implement a message queue, the system administrator installs and configures the software for organizing message queues (queue manager or broker) and defines a named message queue. Or they register with the message queue service.

Then the application registers the program procedure , which “ listens ” to the messages placed in the queue .

The second and subsequent applications can connect to the queue and send a message to it.

The queue manager software saves messages until the receiving application connects and then calls the registered program procedure. The recipient application then processes the message accordingly.

There are many options for the exact semantics of messaging, including:

  • Durability - messages can be stored in memory , written to disk, or even transferred to the DBMS , if the need for reliability indicates a more resource-intensive solution.
  • Security policies - which applications should have access to these messages?
  • Message Cleanup Policies — Queues or messages can have a “ lifetime ”.
  • Message filtering - some systems support data filtering, so that the subscriber can only see messages that meet predetermined criteria.
  • Delivery policies - should we guarantee delivery of the message at least once or no more than once?
  • Routing Policies - On a system with many queue servers, which servers should receive messages or queue messages?
  • Dosing policies - should messages be delivered immediately? Or should the system wait a bit and try to deliver many messages at once?
  • Priority criteria - when should a message be considered “queued”? When in the same queue? Or when to be redirected to at least one remote queue? Or to all the queues?
  • Notification of receipt - the publisher may need to know when some or all of the subscribers have received the message.

All these factors can significantly affect the semantics of transactions, the reliability and efficiency of the system.

Standards and Protocols

Historically, the message queue has used proprietary closed protocols that have limited the ability of various operating systems or programming languages ​​to interact in a heterogeneous set of environments.

Three standards have emerged that are used in open source message queue implementations:

  1. Advanced Message Queuing Protocol (AMQP) - Multifunctional Message Queuing Protocol
  2. (STOMP) - simple text message protocol
  3. MQTT (formerly MQ Telemetry Transport) is a lightweight message queue protocol, especially for embedded devices

These protocols are at various stages of standardization and implementation. The first two work at the same level as HTTP , MQTT at the TCP / IP level.

Synchronous or Asynchronous

Many of the well-known communication protocols are used synchronously. The HTTP protocol used on the World Wide Web and in web services offers a good example when a user sends a request to a web page and then waits for a response.

However, there are scenarios in which synchronous behavior is not suitable. For example, AJAX (asynchronous JavaScript and XML ) can be used to asynchronously send text, JSON , or XML messages to update parts of a web page with more relevant information.

UNIX Implementation

There are 2 common queue implementations on UNIX. One is part of the SYS V API, and the other is part of POSIX .

See also

  • AMQP
  • Amazon SQS
  • Apache ActiveMQ
  • Apache qpid
  • IBM WebSphere MQ
  • Java Message Service
  • MQTT
  • Rabbitmq

Notes

Links

  • About Messages and Message Queues (Windows )
  • mq_overview (7) Overview of POSIX message queues - Linux man page
  • Linux message queue functions
Source - https://ru.wikipedia.org/w/index.php?title=Message_ Queue&oldid = 96652203


More articles:

  • Love Commandos
  • Riflin, William
  • Novovoznesenka (Klyuchevsky District)
  • Balakliya Volost
  • Alexandropol (Altai Territory)
  • Zhumagulov, Inkarbek
  • Cooley Topless Bashi
  • Maulenkulov, Sak Maulenkulovich
  • Zhapabaev, Kairzhan
  • Subbotin, Viktor Yakovlevich

All articles

Clever Geek | 2019