Why use a message selector instead of simply filtering messages at the consuming client level by, for example, scanning the message body based on certain criteria?

Jerry Smith

There are at least three reasons. First, in most cases, client-side filtering is quite a burden to implement, for example, parsing a textual message. Second, if the message type were, say, Object, it could be burdensome for the producer to "decorate it" with selection criteria and/or for the consumer to select messages based on those criteria. Third, using a selector is more efficient because the JMS server avoids having to send the filtered message to the consumer.