In order to take advantage of JMS, we need to create an Enterprise Application project, as usual.
In our example, we will be adding an EJB module and an Application Client module.
Note
Any type of Java EE module can be a JMS message producer and/or consumer by simply invoking methods from the JMS API. We chose to create an EJB module, since, later in the chapter, we will be creating a Message Driven Bean (MDB), which is a type of EJB. We chose an application client since it is one of the simplest modules that can be added to an enterprise application, allowing us to focus on JMS code without having to worry about writing lots of extraneous code. However, in real applications, it is common to have web applications or Session Beans act as JMS message producers, with an MDB acting as the consumer.
Now that we have created our project, we need to add a couple of necessary JMS resources, a JMS destination (Queue or Topic) and a JMS connection factory. When using...