Design Considerations
There are two main message filtering approaches to consider when designing message-based solutions. You can send all related messages (e.g., trade orders) to a single JMS destination and use message filtering on the message consumer to select specific messages or you can use multiple JMS destinations that contain prefiltered messages. The first approach we will call the Message Filtering approach, and the second we will call the Multiple Destination approach. Understanding the implications of each of these approaches will help you arrive at a proper design for your particular situation.
What we have been focusing on so far in this chapter has been the
Message Filtering approach using message filters on the QueueReceiver
or TopicSubscriber
to receive only those messages
we are interested in. With the Message Filtering approach, messages are
sent to a single JMS destination and filtered by the message consumer,
as shown in Figure 6-1.
Figure 6-1. Message Filtering approach
Notice that with the Message Filtering approach it is the message consumer that has control over filtering and what messages it wants to receive. This approach provides for a higher level of decoupling between the message producer components and the message consumer components because less information needs to be known by the message producer about how the message will be processed. This is particularly ...
Get Java Message Service, 2nd 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.