Using the JMS JCA Wizard

ProcedureTo Define a JMS Session Instance

You need to create a JMS message, object, or message producer to send a message to Queue2 once the JMS message is received inside the MDB file of the onMessage() method.

  1. Launch the NetBeans IDE and open the Message-Driven Bean file you created in To Create the JCA Message-Driven Bean.

    The file is located in the Enterprise Beans node of the JMSJCASample project.

  2. Drag-and-drop the Session icon from the Palette panel on the right side to the inside of the onMessage() method, as shown in the figure below:

    Figure 12 JCA Message Bean Sample — Session

    Message Bean Sample

    The JCA Wizard dialog box appears.

  3. For this exercise, enter the following values:

    • Method Name = queueToQueue

    • Resource JNDI Name = jms/tx/jmq1

    Figure 13 JCA Adapter Declaration

    Adapter Declaration

  4. Click Finish.

    Several Java code fragments is generated as a result, in particular the queueToQueue(...) method, which can be implemented to process the incoming message.

  5. Save the MDB file.