Generating a WebSphere® MQ export binding with either a one-way operation or request-response operation is shown. Once generated, the binding properties are discussed.
In this set of steps, you will learn how to create a WebSphere MQ binding for an export. An MQ binding is used when you want to have your service accessed in an asynchronous manner from the WebSphere MQ Messaging client.
If you intend to use the standard JMS message class with a body type containing the message then you must use the business objects provided for these body types (see Working with the simple JMS data bindings).
Alternately, under Components, select Export and drag it on to the canvas. An export with no implementation and no interface is created. Right-click the export, select Add Interface from the menu and add an interface that describes your interaction with a WebSphere MQ application. Create an export with an MQ JMS binding by right-clicking the export and from the menu selecting Generate Binding > Messaging Binding >MQ Binding.
Beneath End-point Configuration, select Specify properties for configuring WebSphere MQ resources (the default) or Specify JNDI name for pre-configured WebSphere MQ resources. If you choose pre-configured, then add the JNDI names for the connection factory and the receive destination for a one-way operation, and receive and send destinations for a request-response operation. Also add the JNDI name for the activation specification (ActivationSpec class), which contains the configuration information for a message end point. Typically, you would choose pre-configured if your system administrator had set up the configuration for you.
You should periodically check
your binding configuration information at run time in the administrative
console. In particular check the state of the endpoint. Under some
conditions the endpoint may go into a paused state and you will need
to restart it (see
Viewing or changing the state of an endpoint).
If you specify JNDI names and then switch to specifying your own configuration properties both sets of values remain in memory until you close the editor. You are saved from reentering the values while you decide.
How does binding work when you choose pre-configured resources? The MQ ActivationSpec JNDI name means the name used to bind the MQ ActivationSpec object to the JNDI namespace. The MQ receive destination queue JNDI name means the name used to bind the MQ receive destination queue object to the JNDI namespace. The MQ connection factory JNDI name means the name used to bind the MQ connection factory object to the JNDI namespace. The MQ send destination queue JNDI name means the name used to bind the MQ send destination queue object to the JNDI namespace.
In the Default data format field, select how the data will be serialized between the business object and the JMS message with a binding. To change the default, click Select beside the field to launch the Data Transformation Configuration window. Your selections are as follows:
In the Function selector section, select the function selector configuration you want to use. A function selector selects an operation to invoke on your component at run time. Clicking Select beside the Function selector field, launches the Function Selector Configuration window and provides the following selections:
If you create your own function selector, it must implement the com.ibm.websphere.sca.mq.selector.MQFunctionSelector class.
In the next section, if you want to use the default module to module fault handling, which is a SOAP transport, select it.
Click OK. The basic MQ binding is created and shown in the properties view when the Binding tab is selected.
You do not see a selection for a messaging domain such as point-to-point or publish-subscribe because the binding generator only supports point-to-point. The MQ JMS binding, however, does support publish-subscribe.
Enable connection on startup specifies that a connection should be made according to the messaging endpoints when the application starts (default). If deselected, the connection will not be made and the application can determine the flow of messages.
Enable XA specifies whether the connection factory is for XA or non-XA coordination of messages. XA should be selected if multiple resources are used in the same transaction (default). If deselected, the resource manager is used for local transaction calls (session.commit and session.rollback) instead of XA calls. This selection can mprove performance but only a single resource can be enlisted in a transaction.
Selecting Specify JNDI name for pre-configured WebSphere MQ resources removes the fields and lets you enter the JNDI lookup names for the connection factory, receive and send queues and the activation specification (ActivationSpec class), which contains the configuration information for a message end point. Note that there is a response queue manager, in this particular case. If the destination you are sending the response to is on a different queue manager than the request queue manager, you will need to check your WMQ set up.
Under Connection Configuration is found the connection information to access the server. The values you entered at binding creation time are shown and can be changed.
In the Request Message Correlation section, the Asynchronous Reliability property can have these values: assured (default) or bestEffort. Select assured if you want a message to persist through a transaction. In other words, if you want guaranteed delivery of the message. Select bestEffort if you want a high throughput of messages and your application can accept and handle the loss of a message, as persistence is not guaranteed. Event sequence required specifies if the same order of events as received from the WebSphere MQ client must be followed by the component receiving the events.
In the Respond Message Correlation section, theResponse Message ID Options field provides several options. New Message ID lets the queue manager select a unique message ID for the response (default). Copy from Request message ID sets the message ID to be the same as the message ID field in the request. Copy from SCA message sets the message ID to be the same as the one carried in the WebSphere MQ header or create one if not found. As Report Options means that the Report field of the message descriptor (MQMD) is examined to determine how to create the message ID.
The Response Correlation ID Options field provides several options. The Copy from Request Message ID (default) means the response message's correlation ID will be set to the request message's message ID. Copy from Request Correlation ID means the response message's correlation ID will be set to the request message's correlation ID.Copy from SCA message means the response message's correlation ID will be the same value as that found in the WebSphere MQ header or it will be left blank if the value did not exist. As Report Options means that the Report field of the message descriptor (MQMD) is examined to determine how to create the message ID.
If you select Copy from SCA message for either response message ID options or response correlation ID options then you will need to set these fields correctly using a mediation module.
Override reply to queue of request message means you have the option of overriding the ReplyTo.Set message type to MQMT_DATAGRAM or MQMT_REQUEST for request-response operation means you have the option of overriding the MessageType field. The export will, by default, force the ReplyTo and MessageType fields to be appropriate values. Advanced users can switch this off, but you will have to use a mediation module to set the fields to whatever you want. Since you can easily break the export by getting these fields wrong, it is recommended you leave these options checked.
Failed message recovery mode lets you allow the binding to manage the recovery of failed messages (the default) or rely on the transport-specific method of recovery. Allow binding to manage recovery for failed messages creates a recovery queue on deployment to handle failed messages. Binding errors are handled as failed events that can be retrieved later. Rely on transport-specific recovery for failed events does not set up a recovery mechanism.
If fault configuration is new to you, see Handling faults in bindings for an overview.