# Creating and Configuring a New Instance of the MQSeries Control

You can create and configure a new instance of the MQSeries control and add it to your business process. This topic includes the following sections:

To Add a New MQSeries Control

Describes how to add a new MQSeries control.

To Specify MQSeries Control General Settings

Describes how to configure the general settings for the MQSeries control, such as pool size, SSL, and so on.

To Specify MQSeries Control Connection Settings

Describes how to configure connection settings for the MQSeries control.

To Specify MQSeries Control Exits

Describes how to configure exits and how to use the MQSeries control exit implementation. For more information, see Using the MQSeries Control Exit Implementation.

To Add a New MQSeries Control

To add a new MQSeries control to WebLogic Integration, perform the following steps:

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, choose 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, click the Create a new MQSeries control to use radio button.

Note: 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 are populated in the JCX file. You cannot modify the properties using the Insert Control - MQSeries Control dialog. However, you can modify the dynamic properties at run time. For more information, see Setting Dynamic Properties.

6. In the New JCX name field, enter the name of the new file.
7. To make this a control factory select the Make this a control factory that can create multiple instances at runtime check box, otherwise clear the checkbox. For more information about control factories, see Control Factories: Managing Collections of Controls.
8. To configure the general settings for your MQSeries control, see To Specify MQSeries Control General Settings
9. To specify connection settings for your MQSeries control, see To Specify MQSeries Control Connection Settings
10. To use the MQSeries exit implementation, see To Specify MQSeries Control Exits
11. Click Create.

To Specify MQSeries Control General Settings

To specify connection settings for the MQSeries control, perform the following tasks in Step 3 of the Insert Control - MQSeries dialog of the General Settings tab:

1. From the Connection Type drop-down list, select the type of connection that you want to establish; a Bindings or TCP type connection. Using the Bindings connection type, you can only get a connection to queue managers on the local system. Using the TCP connection type, you can also get connections to remote queue managers.
2. In the MQ Pool Size text box, enter the number of MQSeries connections to be maintained in the MQSeries connection pool.
3. In the Connection Time-out (Seconds) field, enter the number of seconds after which the connection should time out.
4. From the Require MQ Authorization drop-down list, select either Yes or No. MQ authorization is applicable only in TCP mode. To get MQ authorization, you must enter the MQSeries user name and password in the Authorization tab.
5. The Implicit Transaction Required option is selected by default. When selected, the MQSeries control handles transactions implicitly for each Put and Get individually, without having to set an explicit transaction boundary. When this option is not selected, you must explicitly set the transaction boundaries. For more information, see Understanding Transaction Management.
6. In the Default Queue Name field, enter the default queue name to be used by the MQSeries control for sending and receiving messages.
7. Select Require SSL Authentication if you want to enable server-side authentication using SSL (one way) for this instance of the MQSeries control.
8. Select Require Two way SSL if you want to enable client-side authentication also using SSL (two way) for this instance of the MQSeries control.
9. In the Connection tab, in the Queue Manager Name field, enter the name of the Queue Manager for which the connection is being obtained.

To Specify MQSeries Control Connection Settings

To specify TCP/IP settings for the MQSeries control, perform the following tasks in Step 3 of the Insert Control - MQSeries dialog, in the Connection tab:

Note: Specify TCP/IP settings only if you have set your connection type to TCP.

1. In the Host field, enter the name of the host machine containing the queue manager to which you want to connect.
2. In the Port field, enter the port number on which the queue manager is available for connection.
3. In the Channel field, enter the MQSeries server connection channel configured in the queue manager.
4. In the CCSID field, enter the Coded Character Set to be used when a connection is established. The CCSID is used mainly for internationalization support.
5. Click the Test Connection button to validate the values entered, and to check that you can connect to the queue manager.

Warning: Do not click the Test Connection button when selecting the SSL option for your control. Clicking this button will cause your connection to fail.

To Specify MQSeries Control Authorization Settings

To specify user name and password for MQ authorization, perform the following tasks in Step 3 of the Insert Control - MQSeries dialog, in the Connection tab:

1. In the MQ User Name field, enter your MQ user name.
2. In the MQ User Password field, enter your MQ password.

Note: The Authorization tab is enabled only when the TCP connection mode is selected.

To Specify MQSeries Control Exits

To specify MQSeries control exits, perform the following tasks in Step 3 of the Insert Control - MQSeries dialog, in the Exits tab:

1. In the Exits tab, in the Send Exit Class field, enter the fully qualified name of the class implementing the MQSeries MQSendExit interface.
2. In the Receive Exit Class field, enter the fully qualified name of the class implementing the MQSeries MQReceiveExit interface.
3. In the Security Exit Class field, enter the fully qualified name of the class implementing the MQSeries MQSecurityExit interface.

For more information, see Using the MQSeries Control Exit Implementation.

Note: The Exits tab is enabled only when TCP connection mode is selected. The fields in this tab are not mandatory.

### The JCX File for an MQSeries Control

When you create a new instance of the MQSeries control, you create a new JCX file in your project. The following is a sample 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="TCP"
    * @jc:MQConnectionPoolProps mqPoolSize="20"
    * @jc:ConnectionPoolTimeout conTimeout="3600"
    * @jc:ConnectionRetrySettings retryCount="30"
    retryWaitTimeInMilliseconds="1000"
    * @jc:MQQueueManager queueManager="QM_tcs025051"
    * @jc:MQAuthorization requireAuthorization="No"
    * @jc:TCPSettings host="tcs025051"

    port="1414"
    channel="S_tcs025051"
    ccsid="819"
    user=""
    password=""
    sendExit=""
    receiveExit=""
    securityExit=""
    * @jc:SSLSettings sslRequired="true"
    twoWaySSLRequired="false"
    * @jc:DefaultQueue defaultQueueName="default"
    * @jc:ImplicitTransaction implicitTransactionRequired="true"
    */
    public interface NewMQ 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 based on selecting a TCP connection type using one-way SSL.