MQReceiveClob() function

The MQReceiveClob() function retrieves a message as a CLOB from the WMQ queue and removes the message from the queue.

Syntax


1  MQRECEIVECLOB (?  service_name?  , policy_name?  , correl_id  )
service_name
Optional parameter. Refers to the value in the servicename column of the "informix".mqiservice table. If service_name is not specified, IDS.DEFAULT.SERVICE is used as the service. The maximum size of service_name is 48 bytes.
policy_name
Optional parameter. Refers to the value in the policyname column of the "informix".mqipolicy table. If policy_name is not specified, IDS.DEFAULT.POLICY is used as the policy. The maximum size of policy_name is 48 bytes.
correl_id
Optional parameter. A string containing a correlation identifier to be associated with this message. The correl_id is often specified in request and reply scenarios to associate requests with replies. The maximum size of correl_id is 24 bytes. If not specified, no correlation ID is added to the message.

Usage

The MQReceiveClob() function returns a message as a CLOB from the WMQ location specified by service_name, using the quality-of-service policy policy_name. This function removes the message from the queue associated with service_name. If correl_id is specified, then the first message with a matching correlation identifier is returned. If correl_id is not specified, then the message at the head of the queue is returned. The result of the function is a CLOB. If messages are not available to be returned, the function returns NULL.

The following table describes how the arguments for the MQReceiveClob() function are interpreted.
Table 1. MQReceiveClob() argument interpretation
Usage Argument interpretation
MQReceiveClob() No arguments
MQReceiveClob(arg1) arg1 = service_name
MQReceiveClob(arg1, arg2) arg1 = service_name

arg2 = policy_name

MQReceiveClob(arg1, arg2, arg3) arg1 = service_name

arg2 = policy_name

arg3 = correl_id

Return codes

The contents of the message as a CLOB
The operation was successful. If no messages are available, the result is NULL.
Error
The operation was unsuccessful.

Examples

Example 1
begin;
EXECUTE FUNCTION MQReceiveClob();
commit;
Alternatively, the following syntax can be used:
insert into my_order_table(clob_col) VALUES(MQReceiveClob());
This example receives the content of the message as a CLOB at the head of the queue into the CLOB with the following parameters:
  • service_name: default service name
  • policy_name: default policy name
  • correl_id: none
Example 2
begin;
EXECUTE FUNCTION MQReceiveClob('MYSERVICE');
rollback;
Alternatively, the following syntax can be used:
insert into my_order_table(clob_col)
 VALUES(MQReceiveClob('MYSERVICE'));
This example receives the content of the message as a CLOB at the head of the queue into the CLOB with the following parameters:
  • service_name: "MYSERVICE"
  • policy_name: default policy name
  • correl_id: none
Example 3
begin;
EXECUTE FUNCTION MQReceiveClob('MYSERVICE', 'MYPOLICY');
commit;
Alternatively, the following syntax can be used:
insert into my_order_table(clob_col)
 VALUES(MQReceiveClob('MYSERVICE', 'MYPOLICY'));
This example receives the content of the message as a CLOB at the head of the queue into the CLOB with the following parameters:
  • service_name: "MYSERVICE"
  • policy_name: "MYPOLICY"
  • correl_id: none
Example 4
begin;
EXECUTE FUNCTION MQReceiveClob('MYSERVICE', 'MYPOLICY', 'TESTS');
commit;
Alternatively, the following syntax can be used:
insert into my_order_table(clob_col)
 VALUES(MQReceiveClob('MYSERVICE', 'MYPOLICY', 'TESTS'));
This example receives the content of the message as a CLOB at the head of the queue into the CLOB with the following parameters:
  • service_name: "MYSERVICE"
  • policy_name: "MYPOLICY"
  • correl_id: "TESTS"