Generating a JMS import binding

Generating a JMS import binding with either a one-way operation or request-response operation is shown in this section. Once generated, the binding properties are discussed.

Prerequisite: You should have a module.

If you intend to use the standard JMS message class with a body type containing the message then you must create business objects for these body types. A function is provided that will create the entire set of business objects for the JMS body types. In your module, open the dependencies editor. Under Predefined Resources, select Schema for simple JMS Data Bindings. Save your work and close the dependencies editor. In the navigation view under Data Types, the business objects are created.

Afterwards, create an interface for your import that contains the appropriate data types for input and output. For example, if you were using the TextMessage body, create an interface with an operation such as handleText with an input type of JMSTextBody and an output type of JMSTextBody. These data types will be selectable from the types in the interface editor.

In this set of steps, you will learn how you could create a JMS binding for an import. A JMS binding is used when you want to access the WebSphere Default Messaging Provider.
  1. Open the assembly editor. From the import group on the palette, select an import component and drag it on to the canvas. An import component with no implementation and no interface is created. Right-click the component, select Add Interface from the pop-up menu and add an interface describing your interaction with a JMS client. Generate the JMS binding by selecting the component and from the pop-up menu selecting Generate Binding > Messaging Binding > JMS Binding.


    Generating the binding

  2. The Configure JMS Import Service dialog box opens. An interface with a one-way operation results in the dialog shown below.


    JMS import binding configuration using an interface with a one-way operation

    An interface with a request-response operation produces a similar dialog as shown below with an additional field for a receive destination.


    JMS import binding configuration using an interface with a request-response operation

    Select the messaging domain: Point-to-Point or Publish-Subscribe. Publish-subscribe is selectable if the interface only has one-way operations.

    Select if you wish to Configure new messaging provider resources (the default) or Use pre-configured messaging provider resources. If you choose pre-configured, then add the JNDI names for the connection factory and the send destination for a one-way operation, and send and receive destinations for a request-response operation.

    In the Security configuration section, enter the J2EE Connector (J2C) authentication data entries, if used by your organization.

    In the Data format section, select how the data will be serialized between the business object and the JMS message. For data bindings beginning Simple JMS, you must have previously created the business objects required (see the Prerequisites section). The default data bindings are:

    • Serialized Business Object using JMS ObjectMessage sends the business object whose underlying implementation is a service data object (SDO) in a JMS object message to and from the JMS client. This serialization type is preferred when dealing with other SOA components using JMS.
    • Business Object XML Using JMS TextMessage serializes the business object to and from XML and uses a JMS text message to communicate with the JMS client. To see how the business object is serialized to XML, see Business object XML using JMS text message serialization. Your wrapped data objects must be a complex type; they can not be a simple type.
    • Simple JMS TextMessage Data Binding sends the JMSTextBody business object in a TextMessage message body to the client. The message body type is a String.
    • Simple JMS BytesMessage Data Binding sends the JMSBytesBody business object in a BytesMessage message body to the client. The message body type is a byte array.
    • Simple JMS MapMessage Data Binding sends the JMSMapBody business object in a MapMessage message body to the client. The message body type is a set of name/value pairs that can be addressed by name. The data type of the value is a Java primitive.
    • Simple JMS StreamMessage Data Binding sends the JMSStreamBody business object in a StreamMessage message body to the client. The message body type is a stream of Java primitives.
    • Simple JMS ObjectMessage Data Binding sends the JMSObjectBody business object in an ObjectMessage message body to the client. The message body type is a serialized Java Object.
    • Simple JMS Message Data Binding does not have a message body. It can be used to notify the JMS client of an event or to send some simple data in the message headers or properties.

    The alternative is for you to provide your own data binding for the serialization, in which case select User Supplied. The implementation has to conform to the JMS data binding interface.

    The FunctionSelector class provides a valuable service at run time. It selects an operation to invoke on the component. The operation maps to a function to be performed based on the content of the JMS message. For example, the message may contain an Employee record and be used to create, update, retrieve, or delete the an Employee record. The actual operation to invoke is determined from content in the header or body of the JMS message. In the Function selector section, if you do not wish to use the TargetFunctionName message header property for the default JMS function selector class, deselect it.

    Click OK. The JMS binding is created and shown in the properties view when the Binding tab is selected.

    Note: The JMS binding is complete as is and only if you need to change the values do you need to change them in the fields discussed below. Some of the values will need to match those specified on the server such as the resource adapter name and bus name. If you have runtime documentation, these properties will be specified there as well. There is a link in the next paragraph to the runtime documentation.

    The following sections describe the major binding properties. After generating a JMS binding with the wizard, you can use hover help to get descriptions of all the properties. These properties are also fully described in the administration reference of the WebSphere Process Server.

  3. Selecting the Binding tab shows the adapter type and serialization type.


    Binding general information

  4. Selecting the End-point configuration tab and Connection tab allows you to specify a JNDI lookup name. If a JNDI lookup name is specified, the managed connection factory class and its properties will be hidden. In addition, all sections except method bindings properties and authentication properties on the Security attributes tab will be hidden. In our case, a JNDI lookup name was not specified, so the managed connection factory class based on your earlier decision is shown. The default messaging provider provides a domain-independent managed connection factory (conforming to the JMS 1.1 specification), which is selected by default.

    The Managed Connection Factory Properties section specifies the managed connection factory class and its properties such as the service bus name and quality of service with respect to persistence, in the case of the WebSphere default messaging provider resource adapter. The necessary fields are completed for you. Show Advanced indicates quality of service properties such as persistence properties and if this is a shared property.


    Endpoint configuration with managed connection factory properties

  5. Expanding Admin Connection Properties, provides connection pool properties and configuration properties if you would like custom names and values. If you had specified an JNDI name earlier, it is empty since the server is determining connection pooling values.


    Endpoint configuration with administration connection properties

  6. Selecting the JMS Destinations tab lists the sending, receiving and callback properties. In the Send Destination Properties section, the type of destination and its properties are listed and can be changed. If you specify a JNDI name, this information is not available as it is configured on the server; that is, the destination specified on the server under this JNDI name will be used. Note: If you specify nothing in the Queue Name or Topic Space field, a default value will be created. If you specify a queue name or a topic space, this value will remain even if you then clear the field. The only way to change the value is to specify a different value.


    Endpoint configuration with send destination properties

  7. In the Receive Destination Properties section, the type of destination and its properties are listed and can be changed. If you specify a JNDI name, this information is not available as it is configured on the server. Note: If you specify nothing in the queue name or topic space field, a default value will be created. If you specify a queue name or a topic space, this value will remain even if you then clear the field. The only way to change the value is to specify a different value.


    Endpoint configuration with receive destination properties

  8. In the Callback Destination Properties section, the callback destination type may be specified or a JNDI name where the same information is specified.


    Endpoint configuration with callback destination properties

  9. Selecting Method bindings shows the bound methods. By default, all methods are bound. However, some of these methods may not be needed for JMS usage. If so, deselect the Bind check box.

    The JMS header properties you can specify are as follows. The JMS Type property conforms to the JMSType specified in the JMS specification. This property contains a message type identifier supplied by a client when a message is sent. The JMS Correlation ID property conforms to the JMSCorrelationID in the JMS specification. A typical use is to link a response message with its request message. In WebSphere Integration Developer, the ID is used by the message selector to select only messages with that ID. It can be any string value. JMS message properties can effectively be used to add optional header fields to a message. Custom Headers allows you to specify a name, type and value for a property.

    Clicking Show Advanced lets you specify the input and output serialization types, which determines how the data will be serialized between the business object and the JMS message.


    Method binding properties

  10. Selecting Security attributes shows the authentication properties under Authentication Properties section. The J2C Authentication Data Entry property is available if you want to specify a name. If Show Advanced is selected, authentication properties are shown such as the level of the authentication; for example, at the container level.


    Authentication properties

  11. Selecting the Summary tab specifies the send and receive (in the case of a request-response operation) JNDI names and managed connection factory name and data binding class name. They are names generated by the SCA JMS handler or defined by yourself when the application is deployed. Also, the summary tab provides the JNDI names that you may need when authoring the targeted JMS application.


    Binding summary information

You have created a JMS binding for an import. Compare this approach with creating a JMS binding for an export, which is similar.

You can customize JMS bindings in the runtime environment. This customization translates your own custom object streams to data objects. See JMS data binding samples for WebSphere Process Server V 6.0.2 for an example of this customization.

Related tasks
Generating a JMS export binding

Feedback
(C) Copyright IBM Corporation 2005, 2007. All Rights Reserved.