Java Reference
In-Depth Information
}
finally {
if (connection != null) {
try {
connection.close();
} catch (JMSException e) {
logger.error(e);
}
}
}
}
}
Code amount change is impressive. API simplification was one of the major features of
the new JMS version, and the specification authors did great work on it.
Now, you can use your service to notify some application-specific actions. For example,
we will inject BookingQueueProducer into the BookerService bean and send a
message whenever a user is registered:
public class BookerService implements Serializable {
@Inject
private BookingQueueProducer bookingQueueProducer;
// Some code
public void bookSeat(long seatId, int price) {
logger.info("Booking seat " + seatId);
if (price > money) {
final FacesMessage m =
new
FacesMessage(FacesMessage.SEVERITY_ERROR,
"Not enough Money!",
"Registration successful");
facesContext.addMessage(null, m);
return;
}
Search WWH ::




Custom Search