Java Reference
In-Depth Information
private BookingCompletionListener
bookingCompletionListener;
@Resource(mappedName =
BookingQueueDefinition.BOOKING_QUEUE)
private Queue syncQueue;
public void sendMessage(String txt, Priority priority) {
context.createProducer()
.setAsync(bookingCompletionListener)
.setProperty("priority",
priority.toString())
.send(syncQueue, txt);
}
}
public enum Priority {
LOW, HIGH
}
Now, in our application context, we might use the sendMessage method, attaching a
LOW value for priority when the user is registered:
bookingQueueProducer.sendMessage("[JMS Message] User
registered seat " + seatId, Priority.LOW);
On the other hand, we could attach a HIGH priority when an error occurs:
bookingQueueProducer.sendMessage("Error during
Transaction", Priority. HIGH);
From the MDB perspective, all you need to do in order to filter through messages is in-
clude the message selector as part of your ActivationConfigProperty class as
follows:
@MessageDriven(name = "BookingQueueReceiver",
activationConfig = {
@ActivationConfigProperty(propertyName =
"destinationLookup",
Search WWH ::




Custom Search