At this point NetBeans generates two methods in our code, a method to send a JMS
message to our destination, and another method to create it. Additionally, it injects
the necessary resources, the messaging destination and connection factory, into our
code via the @Resource annotation.
In our example, the name of the method used to create messages is
createJMSMessageForjmsMyQueue() (the exact method name will vary depending
on the name of our JMS destination), it returns an instance of a class implementing
javax.jms.Message , which all JMS message types must implement, and takes two
parameters, an instance of a class implementing javax.jms.Session , and an object
containing the message data.
javax.jms.Message has several subinterfaces that are part of the standard Java EE
API, in most cases, we use one of the subinterfaces to send messages, instead of using
a direct implementation of javax.jms.Message . The following table summarizes all
of the standard Java EE subinterfaces: