Java Reference
In-Depth Information
Session.AUTO_ACKNOWLEDGE);
MessageProducer publisher =
session.createProducer(queueExample);
connection.start();
TextMessage message =
session.createTextMessage(txt);
message.setStringProperty("priority",
priority);
publisher.send(message);
}
. . . .
Now, in our application context, we might use the
sendMessage
method, attaching
a
LOW
value for priority when the user registers:
jmsService.sendMessage("User registered seat
"+seatId,"LOW");
On the other hand, we could attach a
HIGH
priority when an error occurs:
jmsService.sendMessage("Error during
Transaction","HIGH");
From the MDB perspective, all you need to do in order to filter through messages
is include the message selector as part of your
ActivationConfigProperty
as
follows:
@MessageDriven(name = "MDBService",
activationConfig = {
@ActivationConfigProperty(propertyName =
"destinationType", propertyValue =