Message handling and the MQ messaging interface

The MQ messaging interface is used with the user defined functions in SQL statements to allow you to combine DB2® access with WebSphere® MQ message handling.

Message handling

The WebSphere MQ message handling system takes a piece of information (the message) and sends it to its destination. WebSphere MQ guarantees delivery despite any network disruptions that might occur.

Applications programmers use the MQ messaging interface to send messages and to receive messages. The three components in the MQ messaging interface are the message, the service, and the policy:
  • The message defines what one program sends to another
  • The service defines where the message is going to or coming from
  • The policy defines how to handle the message
To send a message that uses the MQ messaging interface, an application must specify the message data, the service, and the policy. A system administrator defines the WebSphere MQ configuration that is required for a particular installation. DB2 provides the default service and default policy, DB2.DEFAULT.SERVICE and DB2.DEFAULT.POLICY, that application programmers can use to simplify their programs.

WebSphere MQ messages

WebSphere MQ uses messages to pass information between applications. Messages consist of the following parts:
  • The message attributes, which identify the message and its properties. The MQ messaging interface uses the attributes and the policy to interpret and construct WebSphere MQ headers and message descriptors.
  • The message data, which is the application data that is carried in the message. The messaging interface does not act on this data.
Attributes are properties of a WebSphere MQ message. With the MQ messaging interface, the message can contain the attributes, or a system administrator can define the attributes in a default policy. The application programmer is not concerned with the details of message attributes.

WebSphere MQ services

A service describes a destination to which an application sends messages or from which an application receives messages. WebSphere MQ calls a destination a message queue, and a queue resides in a queue manager.

Applications can put messages on queues or get messages from them by using the services and policies defined by the configuration tables. A system administrator sets up the parameters for managing a queue, which the service defines. Therefore, the InfoSphere® Federation Server messaging interface hides the complexity from the application programmer. An application program selects a service by specifying it as a parameter for WebSphere MQ function calls.

WebSphere MQ policies

A policy controls how the MQ messaging functions handle messages. Policies control such items as:
  • The attributes of the message, for example, the priority
  • Options for send and receive operations, for example, whether an operation is part of a unit of work
DB2 and InfoSphere Federation Server provide the default policies. Alternatively, a system administrator can define customized policies and store them in a set of DB2 configuration tables. An application program can specify a policy as a parameter for WebSphere MQ function calls.