Java Reference
In-Depth Information
public void bookSeat(Long seatId, int
price) {
FacesContext fc =
FacesContext.getCurrentInstance();
if (price > money) {
FacesMessage m = new
FacesMessage(FacesMessage.SEVERITY_ERROR, "Not
enough Money!", "Registration successful");
fc.addMessage(null, m);
return;
}
logger.info("Booking seat "+seatId);
ticketService.bookSeat(seatId);
money = money - price;
FacesMessage m = new
FacesMessage(FacesMessage.SEVERITY_INFO,
"Registered!", "Registration successful");
if (fc != null)
fc.addMessage(null, m);
jmsService.sendMessage("[JMS Message] User
registered seat "+seatId);
}
}
Compiling and deploying the application
The preceding examples can be engineered as part of a webapp-javaee6 Maven
project, just like we have done so far in the earlier chapters. The only additional de-
pendency we need to specify in pom.xml includes the JBoss messaging API as fol-
lows:
Search WWH ::




Custom Search