Java Reference
In-Depth Information
final FacesMessage m =
new FacesMessage(FacesMessage.SEVERITY_INFO,
"Registration successful");
facesContext.addMessage(null, m);"Seat booked.");
money = money - price;
bookingQueueProducer.sendMessage("[JMS Message]
User registered seat " + seatId);
// Some code
From JMS 2.0, messages can be sent asynchronously, but then it is important to control
whether the operations are successful or not. To do this, we have to create an object that
implements the CompletionListener interface, as follows:
public class BookingCompletionListener implements
CompletionListener {
private Logger logger;
public void onCompletion(Message message) {
try {
final String text =
message.getBody(String.class);"Send was successful: " + text));
} catch (Throwable e) {
logger.severe("Problem with message format");
Search WWH ::

Custom Search