Point-to-Point Messaging

Point-to-point messaging involves the sending of messages from one or more senders to a single receiver through a message queue. Point-to-point messaging is analogous to email messaging: a client delivers a message to a named mailbox (queue), and the owner of the mailbox (queue) reads them in the order they were received. Queues attempt to maintain the send order of messages generated by the sender(s) attached to them. In other words, if sender A sends messages A1, A2, and A3, in that order, to a queue, then the receiver attached to the queue will receive message 2 after message 1, and message 3 after message 2 (assuming that no message selectors filter out any of these messages). If there are multiple senders attached to a queue, then the relative order of each individual sender is preserved by the queue when it delivers the messages, but the queue doesn’t attempt to impose a predefined absolute order on the messages across all senders. So if there is another sender, B, attached to the same queue as A, and it sends messages B1, B2, and B3, in that order, then the receiver will receive B2 after B1, and B3 after B2, but the messages from sender A may be interleaved with the messages from sender B. The receiver may receive the messages in order A1, A2, B1, A3, B2, B3, the messages may be delivered in order B1, B2, B3, A1, A2, A3, or some other order altogether. There is nothing in the JMS specification that dictates how a JMS provider should queue messages ...

Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.