Share to: share facebook share twitter share wa share telegram print page

Message queue

In computer science, message queues and mailboxes are software-engineering components typically used for inter-process communication (IPC), 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.

The message queue paradigm is a sibling of the publisher/subscriber pattern, and is typically one part of a larger message-oriented middleware system. Most messaging systems support both the publisher/subscriber and message queue models in their API, e.g. Java Message Service (JMS).

Competing Consumers pattern enables multiple concurrent consumers to process messages on the same message queue. [1]

Remit and ownership

Message queues implement an asynchronous communication pattern between two or more processes/threads whereby the sending and receiving party 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.[2]

Remit

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.[3][4][5]

Other implementations allow the passing of messages between different computer systems, potentially connecting multiple applications and multiple operating systems.[6] These message queuing systems typically provide 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 queuing software (also known as message-oriented middleware) include IBM 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.

Real-time operating systems (RTOSes) such as VxWorks and QNX encourage the use of message queuing as the primary inter-process or inter-thread communication mechanism. This can result in integration between message passing and CPU scheduling. 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. The Erlang programming language uses processes to provide concurrency; these processes communicate asynchronously using message queuing.

Ownership

The message queue software can be either proprietary, open source or a mix of both. It is then run either on premise in private servers or on external cloud servers (message queuing service).

Examples on hardware-based messaging middleware vendors are Solace, Apigee, and IBM MQ.

Usage

In a typical message-queueing implementation, a system administrator installs and configures message-queueing software (a queue manager or broker), and defines a named message queue. Or they register with a message queuing service.

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 – messages may be kept in memory, written to disk, or even committed to a DBMS if the need for reliability indicates a more resource-intensive solution.
  • Security policies – which applications should have access to these messages?
  • Message purging policies – queues or messages may have a "time to live".
  • Message filtering – 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?
  • Queuing criteria – 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?
  • Receipt notification – 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.

Standards and protocols

Historically, message queuing has used proprietary, closed protocols, restricting the ability for different operating systems or programming languages to interact in a heterogeneous set of environments.

An early attempt to make message queuing more ubiquitous was Sun Microsystems' JMS specification, which provided a Java-only abstraction of a client API. This allowed Java developers to switch between providers of message queuing in a fashion similar to that of developers using SQL databases. In practice, given the diversity of message queuing techniques and scenarios, this wasn't always as practical as it could be.

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

  1. Advanced Message Queuing Protocol (AMQP) – feature-rich message queue protocol, approved as ISO/IEC 19464 since April 2014
  2. Streaming Text Oriented Messaging Protocol (STOMP) – simple, text-oriented message protocol
  3. MQTT (formerly MQ Telemetry Transport) – lightweight message queue protocol especially for embedded devices

These protocols are at different stages of standardization and adoption. The first two operate at the same level as HTTP, MQTT at the level of TCP/IP.

Some proprietary implementations also use HTTP to provide message queuing by some implementations, such as Amazon's SQS. This is because it is always possible to layer asynchronous behaviour (which is what is required for message queuing) over a synchronous protocol using request-response semantics. However, such implementations are constrained by the underlying protocol in this case and may not be able to offer the full fidelity or set of options required in message passing above.

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, JSON 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 interested 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 behavior of the overall system.

Implementation in UNIX

There are two common message queue implementations in UNIX. One is part of the SYS V API, the other one is part of POSIX.

SYS V

UNIX SYS V implements message passing by keeping an array of linked lists as message queues. Each message queue is identified by its index in the array, and has a unique descriptor. A given index can have multiple possible descriptors. UNIX gives standard functions to access the message passing feature.[7]

msgget()
This system call takes a key as an argument and returns a descriptor of the queue with the matching key if it exists. If it does not exist, and the IPC_CREAT flag is set, it makes a new message queue with the given key and returns its descriptor.
msgrcv()
Used to receive a message from a given queue descriptor. The caller process must have read permissions for the queue. It is of two types.[8]
  • Blocking receive puts the child to sleep if it cannot find a requested message type. It sleeps until another message is posted in the queue, and then wakes up to check again.
  • Non-blocking receive returns immediately to the caller, mentioning that it failed.
msgctl()
Used to change message queue parameters like the owner. Most importantly, it is used to delete the message queue by passing the IPC_RMID flag. A message queue can be deleted only by its creator, owner, or the superuser.

POSIX

The POSIX.1-2001 message queue API is the later of the two UNIX message queue APIs. It is distinct from the SYS V API, but provides similar function. The unix man page mq_overview(7) provides an overview of POSIX message queues.

Graphical user interfaces

Graphical user interfaces (GUIs) employ a message queue, also called an event queue or input queue, to pass graphical input actions, such as mouse clicks, keyboard events, or other user inputs, to the application program.[9] The windowing system places messages indicating user or other events, such as timer ticks or messages sent by other threads, into the message queue. The GUI application removes these events one at a time by calling a routine called getNextEvent() or similar in an event loop, and then calling the appropriate application routine to process that event.[10]

See also

References

  1. ^ Gorton, Ian. Foundations of Scalable Systems. O'Reilly Media. ISBN 9781098106034.
  2. ^ Dive Into Queue Module In Python. Overview of POSIX message queues
  3. ^ Win32 system message queues. "About Messages and Message Queues". Windows User Interface. Microsoft Developer Network. Archived from the original on March 17, 2012. Retrieved April 21, 2010.
  4. ^ Linux and POSIX message queues. Overview of POSIX message queues Archived 2012-05-04 at the Wayback Machine at linux.die.net
  5. ^ Using Linux Message Queues. Linux message queue functions Archived 2012-04-08 at the Wayback Machine at www.civilized.com
  6. ^ For example, the MSMQ product. "Message Queuing (MSMQ)". Network Communication. Microsoft Developer Network. Retrieved May 9, 2009.
  7. ^ Bach, M.J. (1986). The Design of the UNIX Operating System. Prentice-Hall. ISBN 9780132017992.
  8. ^ Abraham Silberschatz, Peter B. Galvin (1994). Operating Systems Concepts. Addison-Wesley. ISBN 9780201504804.
  9. ^ Cartwright, Corky. "GUI Programming". Rice University:Robert (Corky) Cartwright. Retrieved June 27, 2020.
  10. ^ Nystrom, Robert (2014). Game Programming Patterns. Genever Benning. ISBN 978-0990582908. Retrieved June 27, 2020.

Read other articles:

NetrilisIndustriMusikDidirikan30 September 2015; 8 tahun lalu (2015-09-30)[1][2]KantorpusatYogyakarta, IndonesiaJasaDistribusi MusikSitus webhttps://www.netrilis.com/ Netrilis adalah perusahaan distribusi musik atau aggregator audio digital yang didirikan pada tahun 2015 dan berbasis di Yogyakarta, Indonesia.[2] Layanan utama Netrilis adalah mendistribusikan dan menjual atau mengalirkan musik artis rekaman ke gerai musik digital seperti Spotify, Joox, TikTok, Appl...

De dodentempel van Ramses II in Abydos De tempel van Ramses II in Abydos is een Huis van Miljoenen jaren, een tempel die de cultus van de koning in stand hield. Hij werd opgericht gedurende de regering van Ramses II. Geschiedenis van de tempel De dodentempel van Ramses II is niet lang gebouwd na de tempel van Seti. Hij ligt er overigens niet ver van; slechts 270 meter. Net zoals Seti I had Ramses II zowel een dodentempel in Thebe, het Ramesseum en een dodentempel in Abydos gebouwd. De tempel ...

Bruck-Waasen (ehemalige Gemeinde)Historisches Wappen von Bruck-Waasen Vorlage:Infobox Gemeindeteil in Österreich/Wartung/Wappen Bruck-Waasen (Österreich) Basisdaten Pol. Bezirk, Bundesland Grieskirchen (GR), Oberösterreich Gerichtsbezirk Grieskirchen (GBZ 4081) Pol. Gemeinde Peuerbachf0 f5 Koordinaten 48° 19′ 40″ N, 13° 46′ 20″ O48.32777777777813.772222222222377Koordinaten: 48° 19′ 40″ N, 13° 46′ 20″&...

أمثلة على مركبات سيلينيوم عضوية مركبات السيلينيوم العضوية هي مركبات كيميائية حاوية على رابطة كيميائية بين عنصري الكربون والسيلينيوم Se-C؛ وتهتم كيمياء السيلينوم العضوية بدراسة تلك المركبات وخواصها وتفاعلاتها.[1][2][3][4] يمكن أن يعثر على مركبات السيلينيوم ال...

AperamJenisSociété anonyme (Euronext: APAM)IndustriIndustri bajaDidirikan2011KantorpusatLuksemburgTokohkunciTimoteo Di Maulo, CEOKaryawan10,700Situs webwww.aperam.com Aperam adalah perusahaan yang memproduksi dan memasarkan baja tahan karat, baja elektrik dan baja khusus. Perusahaan, yang dipisahkan dari ArcelorMittal pada awal 2011, terdaftar di bursa saham di Amsterdam, Paris, Brussels dan Luksemburg.[1] Pabrik utama Aperam di Eropa berlokasi di Belgia dan Prancis.[2]...

GAA stadium in Newry, Northern Ireland Páirc EslerPáirc an IúirThe MarshesPáirc EslerLocation within County DownAddressNewry, County Down, BT34 2QXLocationNorthern IrelandCoordinates54°9′47″N 6°20′5″W / 54.16306°N 6.33472°W / 54.16306; -6.33472Public transitNewry railway stationNewry Ulsterbus stationOwnerNewry ShamrocksCapacity20,000[1]Field size138 × 81 mConstructionRenovated2006–07 Páirc Esler (/ˌpɑːrk ˈɛslər/ park ESS-lər, Irish: ...

Mongolian politician In this Mongolian name, the given name is Saikhanbileg. Chimed is a patronymic, not a family name. Saikhanbileg Chimed28th Prime Minister of MongoliaIn office21 November 2014 – 7 July 2016PresidentTsakhiagiin ElbegdorjPreceded byNorovyn AltankhuyagSucceeded byJargaltulgyn Erdenebat Personal detailsBorn (1969-02-17) 17 February 1969 (age 54)Dornod, MongoliaPolitical partyDemocratic PartyAlma materNational University of MongoliaMoscow University for the Huma...

American comedian (born 1984) For the decathlete, see John Crist (athlete). John CristCrist in 2017Birth nameJohn CristBorn (1984-03-20) March 20, 1984 (age 39)Atlanta, Georgia, U.S.MediumStand-upNationalityAmericanYears active2009-presentGenresChristian comedy, sketch comedy, observational comedySubject(s)Christianity, Christian culture,[1] millennials, consumerism, familyWebsitejohncristcomedy.com John Crist (born March 20, 1984) is an American comedian from Lilburn, Georg...

Village in County Cork, Ireland Village in Munster, IrelandOvens Na hUamhannaVillageSt. John The Baptist ChurchOvensLocation in IrelandCoordinates: 51°52′41″N 8°39′54″W / 51.878°N 8.665°W / 51.878; -8.665CountryIrelandProvinceMunsterCountyCounty CorkEU ParliamentSouthPopulation (2006)1,703Time zoneUTC+0 (WET) • Summer (DST)UTC-1 (IST (WEST))Irish Grid ReferenceW611704 Ovens (Irish: Na hUamhanna), formerly also Athnowen,[1] is a smal...

Knut Anders Sørum Knut Anders Sørum ist ein norwegischer Sänger aus Østre Toten. Er vertrat sein Land beim Eurovision Song Contest 2004. Zudem ist er Keyboarder und Sänger der christlichen Black-Metal-Band „Vardøger“. Sørum gewann im Jahre 2004 die norwegische Vorentscheidung zum Eurovision Song Contest, den Melodi Grand Prix mit der Pop-Ballade High. In Istanbul (Türkei) trat er als dritter Act des Finales auf, nach Tie-Break aus Österreich und vor Jonatan Cerrada aus Frankreich...

Railway station in Tamil Nadu Nagercoil JunctionNagerkovil Junction Indian Railways stationMain building of the stationGeneral informationLocationRailway Feeder Rd, Kottar, Nagercoil. PIN – 629 002, Kanyakumari, Tamil NaduIndiaCoordinates8°10′26″N 77°26′38″E / 8.174°N 77.444°E / 8.174; 77.444Elevation38 metres (125 ft)Owned byIndian RailwaysOperated bySouthern Railway zoneLine(s) Thiruvananthapuram–Nagercoil–Kanyakumari line Nagercoil–Tirunelve...

Україна Ця стаття є частиною серії статей продержавний лад і устрійУкраїни Правова система Конституція Законодавство Права людини Глава держави Президент Володимир Зеленський Офіс Президента Керівник ОП Андрій Єрмак РНБОУ Секретар РНБОУ Олексій Данілов Державне упр...

For other uses, see Road to Nowhere (disambiguation). This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Road to Nowhere – news · newspapers · books · scholar · JSTOR (December 2009) (Learn how and when to remove this template message) 1985 single by Talking HeadsRoad to NowhereSingle by Talking Headsfrom the a...

Radio station in Wenatchee, WashingtonKKRTWenatchee, WashingtonBroadcast areaWenatchee, WashingtonFrequency900 kHzBrandingESPN Radio 900 & 1020ProgrammingFormatSportsAffiliationsESPN RadioSeattle Mariners Radio NetworkWashington-Learfield Sports Network (Football)Gonzaga-Learfield Sports Network (Men's basketball)OwnershipOwnerAlpha Media LLC(Alpha Media Licensee LLC)Sister stationsKKRV, KWLNHistoryFirst air date1985-07-01 (as KSGA)Former call signsKSGA (1985-1987)KEYK (1987-1988)Call sig...

Sunset Village redirects here. For the small town in Indiana, see Sunset Village, Indiana. CDP in Georgia, United StatesSunset Village, GeorgiaCDPLocation in Upson County and the state of GeorgiaCoordinates: 32°53′57″N 84°24′34″W / 32.89917°N 84.40944°W / 32.89917; -84.40944CountryUnited StatesStateGeorgiaCountyUpsonArea[1] • Total4.90 sq mi (12.68 km2) • Land4.80 sq mi (12.44 km2) • ...

ラグビーワールドカップ2019概要開催国  日本期間 2019年9月20日 – 11月2日[1]出場国数 20ヶ国 (予選出場は93ヶ国)最終結果優勝国   南アフリカ共和国準優勝国   イングランド3位   ニュージーランド統計試合数 45観客動員数 1,704,443人 (1試合平均37,877人)最多得点選手 ハンドレ・ポラード (69)最多トライ選手 ジョシュ・アダムス (7)← 2015 20...

2008 video gameHarvest Moon DS: Grand BazaarNorth American box artDeveloper(s)Marvelous InteractivePublisher(s)JP: Marvelous InteractiveNA: Natsume Inc.EU: Rising Star GamesDirector(s)Takahiro YuraProducer(s)Yoshifumi HashimotoArtist(s)Igusa MatsuyamaComposer(s)Noriko IshidaEri YasudaAyumu MuraiShingo KataokaSeriesStory of SeasonsPlatform(s)Nintendo DSReleaseJP: December 18, 2008NA: August 24, 2010EU: September 30, 2011Genre(s)Simulation, role-playingMode(s)Single-player, multiplayer Harvest ...

Leslie GondaBornLászló Goldschmied(1919-08-20)August 20, 1919Mezőtúr, HungaryDiedMarch 16, 2018(2018-03-16) (aged 98)Beverly Hills, California, United StatesOccupationbusinessmanKnown forCo-founder of International Lease Finance CorporationSpouseSusan GondaChildrenLouis Gonda Leslie Gonda (August 20, 1919 – March 16, 2018) was a Hungarian-born American businessman, philanthropist, and Holocaust survivor. He was the co-founder (with his son Louis Gonda) of International Lease F...

Observatory in Cincinnati, Ohio, US ObservatoryCincinnati ObservatoryOriginal building atop Mt. LookoutObservatory code 765 LocationCincinnati, USCoordinates39°08′20″N 84°25′23″W / 39.139°N 84.423°W / 39.139; -84.423Established1843Websitehttp://www.cincinnatiobservatory.orgTelescopes1845 Merz und MahlerRefractor1904 Alvan Clark & SonsRefractor Cincinnati ObservatoryU.S. National Register of Historic PlacesU.S. National Historic Landmark Show m...

Latvian breed of warmblood horse LatvianConservation statusFAO, 2007: endangered-maintained[1]: 75 Other namesLatvian: Latvijas šķirneLatvian: Latvijas zirgi[1]: 75 Russian: Latviiskaya[2]: 316 Latvian Harness Horse[3]Latvian Carriage Horse[4]Latvian Coach Horse[4]Latvian Draught[5]Latvian Riding Horse[6]: 276 Country of originLatviaTraitsWeightMale: 600 kg[4&#...

Kembali kehalaman sebelumnya