MQReceiveXML function

The MQReceiveXML removes one message associated with receive-service from the queue. The function returns XML data from the WebSphere® MQ location specified by receive-service, using the quality of receive-service.

Syntax

Read syntax diagramSkip visual syntax diagramMQReceiveXML ( receive-servicereceive-service,service-policyreceive-service,service-policycorrel-id )

Parameters

receive-service
A string containing the logical WebSphere MQ destination from where the message will be received. If specified, receive-service must refer to a service point defined in the DB2MQ.MQSERVICE table. A service point is a logical end-point from where a message is sent or received. Service point definitions include the name of the WebSphere MQ Queue Manager and Queue. If receive-service is not specified, the DB2®.DEFAULT.SERVICE is used. The maximum size of receive-service is 48 bytes.
service-policy
A string containing the WebSphere MQ Service Policy used to handling this message. If specified, service-policy refers to a Policy defined in the DB2MQ.MQPOLICY table. A service policy defines a set of quality of service options that should be applied to this messaging operation. These options include message priority and message persistence. If service-policy is not specified, the default DB2.DEFAULT.POLICY is used. The maximum size of service-policy is 48 bytes.
correl-id
An optional string containing a correlation identifier associated with this message. The correl-id is often specified in request and reply scenarios to associate requests with replies. If not specified, no correlation ID is sent. The maximum size of correl-id is 24 bytes.

Results

MQReceiveXML functions return XML if the messages are received from the queue successfully. A NULL is returned if no messages are available. If the correl-id is specified, the first message with a matching correlation identifier is returned. If correl-id is not specified, the message at the head of the queue is returned. The message is removed from the queue.

Examples

Example 1: In this example, the message that is at the head of the queue is received which is specified by the default service DB2.DEFAULT.SERVICE using the default policy DB2.DEFAULT.POLICY.

values db2xml.MQRECEIVEXML().

If successful this function returns the contents of a message as XML. If no messages are available, a NULL is returned.