MQPublishClob() function
The MQPublishClob() function publishes CLOB data on one or more topics to a queue managed by WMQ.
Syntax
- publisher_name
- Optional parameter. Refers to the value in the pubsubname column
of the "informix".mqipubsub table. If publisher_name is
not specified, IDS.DEFAULT.PUBLISHER is used as the publisher. The
maximum length of publisher_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.PUB.SUB.POLICY is used as the policy. The maximum size of policy_name is 48 bytes.
- clob_data
- Required parameter. The CLOB data to be sent to WMQ. Even though the CLOB data size can be up to 4 TB, the maximum size of the message is limited by what Websphere MQ supports. If clob_data is NULL, it sends a zero-length message to the queue.
- topic
- Optional parameter. A string containing the topic for the message publication. The maximum size of a topic is 40 bytes. Multiple topics can be specified in one string (up to 40 characters long). Each topic must be separated by a colon. For example, "t1:t2:the third topic" indicates that the message is associated with all three topics: t1, t2, and the third topic. If no topic is specified, none are associated with the message.
- 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 MQPublishClob() function publishes data to WMQ. It requires the installation of the WMQ Publish/Subscribe component of WMQ, and that the Message Broker is running.
The MQPublishClob() function publishes the data contained in clob_data to the WMQ publisher specified in publisher_name, using the quality of service policy defined by policy_name.
The following table describes
how the arguments for the MQPublishClob() function
are interpreted.
Usage | Argument interpretation |
---|---|
MQPublishClob(arg1) | arg1 = clob_data |
MQPublishClob(arg1, arg2) | arg1 = clob_data arg2 = topic |
MQPublishClob(arg1, arg2, arg3) | arg1 = publisher_name arg2 = clob_data arg3 = topic |
MQPublishClob(arg1, arg2, arg3, arg4) | arg1 = publisher_name arg2 = policy_name arg3 = clob_data arg4 = topic |
MQPublishClob(arg1, arg2, arg3, arg4, arg5) | arg1 = publisher_name arg2 = policy_name arg3 = clob_data arg4 = topic arg5 = correl_id |
Return codes
- 1
- The operation was successful.
- Error
- The operation was unsuccessful.
Examples
- Example 1
begin; EXECUTE FUNCTION MQPublishClob(filetoclob("/work/mydata", "client"); commit:
This example publishes the message with the following parameters:- publisher_name: default publisher
- policy_name: default policy
- clob_data: filetoclob("/work/mydata", "client")
- topic: None
- correl_id: None
- Example 2
begin; EXECUTE FUNCTION MQPublishClob('MYPUBLISHER', filetoclob("/work/mydata", "client"),'TESTTOPIC'); commit;
This example publishes the message with the following parameters:- publisher_name: "MYPUBLISHER"
- policy_name: default policy
- clob_data: filetoclob("/work/mydata", "client")
- topic: "TESTTOPIC"
- correl_id: None
- Example 3
begin; EXECUTE FUNCTION MQPublishClob('MYPUBLISHER', 'MYPOLICY',filetoclob("/work/mydata", "client"),'TESTTOPIC','TEST1');commit;
This example publishes the message with the following parameters:- publisher_name: "MYPUBLISHER"
- policy_name: "MYPOLICY"
- clob_data: filetoclob("/work/mydata", "client")
- topic: "TESTTOPIC"
- correl_id: "TEST1"
- Example 4
begin; EXECUTE FUNCTION MQPublishClob (filetoclob("/work/mydata", "client"),'TESTS'); commit;
This example publishes the message with the following parameters:- publisher_name: default publisher
- policy_name: default policy
- clob_data: filetoclob("/work/mydata", "client")
- topic: "TESTS"
- correl_id: None
- Example 5
begin; EXECUTE FUNCTION MQPublishClob('SEND.MESSAGE', 'emergency', filetoclob("/work/mydata", "client") 'expedite');commit;
This example publishes the message with the following parameters:- publisher_name: "SEND.MESSAGE"
- policy_name: "emergency"
- clob_data: filetoclob("/work/mydata", "client")
- topic: "expedite"
- correl_id: None
- Example 6
- The following table contains sample rows and columns in the "informix".mqipubsub table.
Sample row pubsubname column receiver column pubsubtype column Sample row 1 'IDS.DEFAULT.
PUBLISHER'
' ' 'Publisher' Sample row 2 'IDS.DEFAULT.
SUBSCRIBER'
'IDS.DEFAULT.
SUBSCRIBER.RECEIVER'
'Subscriber' begin; EXECUTE FUNCTION MQSubscribe('IDS.DEFAULT.SUBSCRIBER', 'IDS.DEFAULT.PUB.SUB.POLICY', 'Weather'); commit;
This statement demonstrates a subscriber registering an interest in messages containing the topic "Weather," with the following parameters:- subscriber_name: "IDS.DEFAULT.SUBSCRIBER"
- policy_name: "IDS.DEFAULT.PUB.SUB.POLICY"
- topic: "Weather"
begin; EXECUTE FUNCTION MQPublishClob('IDS.DEFAULT.PUBLISHER', 'IDS.DEFAULT.PUB.SUB.POLICY', filetoclob("/work/mydata", "client"), 'Weather');commit;
This statement publishes the message with the following parameters:- publisher_name: "IDS.DEFAULT.PUBLISHER"
- policy_name: "IDS.DEFAULT.PUB.SUB.POLICY"
- clob_data: filetoclob("/work/mydata", "client")
- topic: "Weather"
- correl_id: None
begin; EXECUTE FUNCTION MQReceiveClob('IDS.DEFAULT.SUBSCRIBER.RECEIVER', 'IDS.DEFAULT.PUB.SUB.POLICY'); commit;
This statement receives the message with the following parameters:- service_name: "IDS.DEFAULT.SUBSCRIBER.RECEIVER"
- policy_name: "IDS.DEFAULT.PUB.SUB.POLICY"