6.2. Messaging Domains

The data push infrastructure in BlazeDS uses a message-based interaction model. Such an interaction model involves entities called producers, which send messages, and entities called consumers, which receive messages.

Producers and consumers can send and receive messages using either of two styles of communication: point-to-point or publish/subscribe. These two messaging styles are also referred to as messaging domains. In both these cases, the message-based communication between producers and consumers is predominantly asynchronous.

6.2.1. Point-to-Point

Point-to-point is a peer-to-peer messaging domain model. In this case, a logical entity called a queue is associated with each peer, and posting a message to a peer is equivalent to sending it to the queue that represents the peer. The communication is one-to-one.

Multiple producers can send messages to a single queue, and multiple consumers can fetch messages from a shared queue. When multiple consumers receive messages at the same queue, only one consumer can process an individual message. Let's illustrate this with an example. Say there are three consumers, c1, c2, and c3, and there are four messages, m1, m2, m3, and m4. Now if c1 consumes m1, then m1 cannot be consumed by c2 or c3. This behavior has two important implications:

  • If you need a message to be consumed by multiple consumers, then a point-to-point messaging domain may not be optimal. In a point-to-point model, sending a message, say m1, to ...

Get Professional BlazeDS: Creating Rich Internet Applications with Flex® and Java® 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.