The JMS control enables applications built in WebLogic Workshop to interact with messaging systems that provide a JMS implementation. This topic describes how to create a new JMS control and provides an example of a valid JMS control file.
You can add a JMS control in any of the following types of files:
You can also create a new JMS control file without adding it to a web service or another control file. From the File menu, choose New-->Java Control. Select the JMS control from the list, and follow the instructions to create a new control file.
The values that you provide when you create the control are specified in the control's @jc:jms annotation, as shown in the sample file in the next section.
If you create a new JMS control JCX file using the settings described above, the new JCX file looks like the following example. The contents of the JMS control's JCX file depend on the selections made in the Insert Control - Insert JMS dialog. The following example was generated with Text selected from the Message type drop-down list:
import com.bea.control.*; import java.io.Serializable; /** * @jc:jms send-type="queue" send-jndi-name="jms.SimpleJmsQ" * receive-type="queue" receive-jndi-name="jms.SimpleJmsQ" * connection-factory-jndi-name="weblogic.jws.jms.QueueConnectionFactory" */ public interface SimpleQueueControl extends JMSControl { /** * this method will send a javax.jms.TextMessage to send-jndi-name */ public void sendTextMessage(String payload); /** * If your control specifies receive-jndi-name, that is your JWS expects to receive messages * from this control, you will need to implement callback handlers. */ interface Callback extends JMSControl.Callback { /** * Define only 1 callback method here. * * This method defines a callback that can handle text messages from receive-jndi-name */ public void receiveTextMessage(String payload); } }
The JCX file contains the declaration of a Java interface with the name specified in the dialog. The interface extends the JMSControl base interface. To learn more about JCX files generated for messages of other types, see Specifying the Body of a Message and Specifying Message Headers and Properties.