Beruflich Dokumente
Kultur Dokumente
Using
Message Broker
Introduction
The document intends to give an overview of BLOB messages and the implementation of BLOB
message types in Message Broker.
Objective
At the end of the lab, you should be able to:
Understand the usage of BLOB message types in message broker.
Understand the implementation steps of BLOB messages in Message broker.
Understand how to convert from BLOB to XML message data format.
You cannot manipulate the contents of a BLOB message, because it has no predefined structure.
However, you can refer to its contents using its known position within the bit stream, and process
the message with a minimum of knowledge about its contents. For example,
InputBody.BLOB.BLOB[10]
identifies the tenth byte
of the message
body;
substring(InputBody.BLOB.BLOB from 10 for 10) references 10 bytes of the message data starting
at offset 10.
Overview of scenario
This scenario depicts how to implement and parse the BLOB message in Message Broker flows.
This sample flow will read an input XML message as BLOB message and accesses some values in
this BLOB message and afterwards use these values to create a new XML message from the BLOB
message.
In this example; message flow will accept an XML message and parse it as BLOB. In the input
BLOB message, looks for the values of name and class fields and creates a new XML message
using those values. Finally, the XML message is put into an MQOutput node.
1. BLOB_Manipulation Flow:
Queue name: IN
Message Domain: BLOB
BLOB_Manipulation
This node is a Compute node that will receive the BLOB input message data .Extracts the value
from the name field and class field in the incoming XML message and create new XML
message from the input BLOB message and put it in to the output queue. The configurations for
this node are as follows:
ESQL Module: BLOB_Manipulation_BlobManipulation
Compute Mode: Message
ESQL code:
CREATE COMPUTE MODULE BLOB_Manipulation_BlobManipulation
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
DECLARE outmess BLOB;
DECLARE find_name CHARACTER;
DECLARE find_class CHARACTER;
SET outmess = InputRoot.BLOB.BLOB;
SET find_name = CAST (SUBSTRING(outmess FROM 19 FOR 4)AS CHARACTER CCSID 1208);
SET find_class = CAST (SUBSTRING(outmess FROM 43 FOR 2)AS CHARACTER CCSID 1208);
SET OutputRoot.XMLNSC.Test.name = find_name;
SET OutputRoot.XMLNSC.Test.class = find_class;
RETURN TRUE;
END;
END MODULE;
OUTPUT
This node is an MQOutput node that will send the XML output message to the output queue
OUT. The configurations for this node are as follows:
Queue name: OUT
Reference
1. Message Broker Esql. PDF (From IBM Information center of Message Broker).
Appendix
1. Project workspace containing source code for the POC.
BLOB_Manipulation.zi
p
SampleRequest.xml