Java Reference
In-Depth Information
public void onException(Message message, Exception
exception) {
try {
final String text =
message.getBody(String.class);"Send failed..." + text);
} catch (Throwable e) {
logger.severe("Problem with message format");
During the send operation, we have to specify the asynchronous and use this listener
object. To do this, inject BookingCompletionListener to BookingQueuePro-
ducer and send messages with an updated call:
public void sendMessage(String txt) {
.setAsync(bookingCompletionListener). send(syncQueue, txt);
Now, appropriate listener methods will be executed when the message send is completed
or failed:
(Thread-3 (HornetQ-client-global-threads-269763340)) Send
was successful: [JMS Message] User registered seat 2
Compiling and deploying the application
We have based our code on the JPA application from the previous chapter. Thanks to
javaee-api , you don't have to add any new project dependencies in order to use JMS!
The only thing you have to do is to start WildFly in full profile using, for example,
standalone-full.xml standalone-full.xml —the standard full profile con-
Search WWH ::

Custom Search