# Creating and Configuring a New Instance of MQSeries Control

This topic describes how to create and configure a new instance of MQSeries control.

You can create a new instance of MQSeries control and add it to your business process. To define a new MQSeries control:

1. Click Add on the Controls tab to display a list of controls that represent the resources with which your business process can interact.

Note: If the Controls tab is not visible in WebLogic Workshop, click View —> Windows —> Data Palette from the menu bar.

2. Choose Integration Controls to display the list of controls used for integrating applications.

3. Choose MQSeries Control to display the Insert Control - MQSeries dialog
4. In Step 1, in the Variable name for this control field, enter the name for your MQSeries control.
5. In Step 2, select the Create a new MQSeries control to use radio button.

Note: If you want to use an existing MQSeries control, click the Browse button to select the JCX file from your system. When you use an existing MQSeries control, the properties that were originally selected for the existing control will be populated in the JCX file. You cannot modify the properties using the Insert Control - MQSeries Control dialog. However, you can modify the dynamic properties during run time. For more information, see Setting Dynamic Properties.

6. In the New JCX name field, enter the name of the new file.
7. Decide whether you want to make this a control factory and select or clear the Make this a control factory that can create multiple instances at runtime check box. For more information about control factories, see Control Factories: Managing Collections of Controls.
8. In Step 3, in the General tab, from the Connection Type drop-down list, select the type of connection that you want to establish. You can select either Bindings or TCP as your connection type. Using the Bindings mode, you can obtain connection to queue managers present in the local system only. Using the TCP connection mode, you can obtain connections to remote queue managers also.
9. In the MQ Pool Size text box, specify the number of MQSeries connections to be maintained in the MQSeries connection pool.
10. In the Connection Timeout (Seconds) field, type the number of seconds after which the connection should time out.
11. From the Require MQ Authorization drop-down list, select either Yes or No. MQ authorization is applicable only in the TCP mode. If you require MQ authorization, the MQSeries user name and password must be provided in the Authorization tab.
12. By default, the Implicit Transaction Required option is selected. When selected, MQSeries control handles transactions implicitly for each Put and Get, individually, without the need for an explicit transaction boundary. When this option is not selected, you need to explicitly set the transaction boundaries. For more information, see Understanding Transaction Management.
13. In the Default Queue Name field, type in the default queue name which is to be used by the MQSeries control for sending and receiving messages.
14. In the Connection tab, in the Queue Manager Name field, specify the name of the Queue Manager to which the connection is to be obtained.
15. If you have selected TCP as your connection mode, you need to specify TCP Settings as follows:

1. In the Host field, type in the host name of The host name of the machine containing the queue manager to connect to.
2. In the Port field, enter the port number on which the queue manager is available for connection.
3. In the Channel field, type the MQSeries server connection channel configured in the queue manager.
4. In the CCSID field, type the Coded Character Set to be used while when connection is established. The CCSID is used mainly for i18n (Internationalization) support.

16. Click the Test Connection button to ensure that the values entered are correct and that you are able to connect to the queue manager.
17. If you have requested MQ authorization, you need to specify the MQ user name and password in the Authorization tab.

Note: The Authorization tab is enabled only if you have selected the TCP connection mode.

18. In the Exits tab, in the Send Exit Class field, type in the fully qualified name of the class implementing the MQSeries MQSendExit interface.
19. In the Receive Exit Class field, type in the fully qualified name of the class implementing the MQSeries MQReceiveExit interface.
20. In the Security Exit Class field, type in the fully qualified name of the class implementing the MQSeries MQSecurityExit interface.

For more information on the Exit functionality, see Using Exit Implementation.

Note: The Exits tab is enabled only if you have selected the TCP connection mode. However, the fields in this tab are not mandatory.

21. Click Create.

### The JCX File for an MQSeries Control

When you create a new instance of MQSeries control, you create a new JCX file in your project. The following is an example JCX file for an MQSeries control:

    package processes;
    import com.bea.control.*;
    import com.bea.xml.XmlCursor;
    import com.bea.control.MQControl;
    import com.bea.wli.control.mqmdHeaders.MQMDHeadersDocument;
    import com.bea.wli.control.mqDynamicProperties.MQDynamicPropertiesDocument;
    import javax.resource.ResourceException;
    import com.bea.xml.XmlObject;
    /*
    * A custom MQ control.
    */
    /**
    * @jc:MQConnectionType connectionType="Bindings"
    * @jc:MQConnectionPoolProps mqPoolSize="20"
    * @jc:ConnectionPoolTimeout conTimeout="3600"
    * @jc:MQQueueManager queueManager="QM_bea_aruna"
    * @jc:MQAuthorization requireAuthorization="No"
    * @jc:TCPSettings host=""
         port="1414"
         channel=""
         ccsid="819"
         user=""
         password=""
         sendExit=""
         receiveExit=""
         securityExit=""

    * @jc:DefaultQueue defaultQueueName="default"
    * @jc:ImplicitTransaction implicitTransactionRequired="true" */
    public interface newjcx extends MQControl, com.bea.control.ControlExtension {
    /*
    * A version number for this JCX. This will be incremented in new versions of
    * this control to ensure that conversations for instances of earlier
    * versions were invalid.
    */
    static final long serialVersionUID = 1L;
    }
    The contents of the MQSeries control's JCX file depend on the selections made in the Insert MQSeries dialog. The example above was generated in response to selection of Bindings type of connection.