Topic
  • 1 reply
  • Latest Post - ‏2013-08-14T11:49:26Z by KY0J_Simbu_Selvarasu
Ramanujan1980
Ramanujan1980
1 Post

Pinned topic WMB File Handling with MQ Batch

‏2013-08-13T17:44:20Z |

Hi,

I am currently trying to write batch of records into file using file output.

My Scenario would be

There are 1000 msgs (request) in the queue each request would invoke backend service (SOAP Request). Send the response to next output queue for further processing and also write the response to a file (would like to create single file, but with my code it is creating multiple files)

For each request I will get 1 to many response, like that I need to consolidate the response of all the 1000 msgs into 1 file, but with my current code it is creating multiple files.

Following is the code which I am using to send the request to the queue

SET modelCount = CARDINALITY(inRef.tns:FindOrderResponse.orders[]);
SET z = 0;
 
WHILE z < modelCount DO -- send the Order info to invoice q
SET z = z +1;
CALL CopyMessageHeaders();
SET OutputRoot.MQMD.GroupId = X'000000000000000000000000000000000000000000000003';
SET OutputRoot.MQMD.MsgSeqNumber = z;
SET OutputRoot.MQMD.MsgFlags = MQMF_MSG_IN_GROUP;
IF (z = modelCount) THEN
SET OutputRoot.MQMD.MsgFlags = MQMF_LAST_MSG_IN_GROUP;
END IF;
 
SET OutputRoot.XMLNSC.findOrders.CustomerID = ev.load.CustomerID;
SET OutputRoot.XMLNSC.findOrders.OrderID = inRef.tns:FindOrderResponse.orders[z].OrderID;
PROPAGATE TO TERMINAL 'out1';
 

 

Following is the code to write to the file:

IF ev.MQMD.MsgFlags = MQMF_MSG_IN_GROUP THEN
SET outRef1.CustomerID VALUE = ev.load.CustomerID;
SET outRef1.xmlBlob = InputRoot.XMLNSC.toJava.xmlBlob;
IF ev.MQMD.MsgSeqNumber = 1 THEN
SET OutputLocalEnvironment.WrittenDestination.Action = 'Create';
ELSE
SET OutputLocalEnvironment.WrittenDestination.File.Action = 'Append';
END IF;
PROPAGATE TO TERMINAL 'out2' DELETE NONE;
ELSE
SET outRef1.year VALUE = ev.load.makeID || '-' || ev.load.year;
SET outRef1.xmlBlob = InputRoot.XMLNSC.toJava.xmlBlob;
SET OutputLocalEnvironment.WrittenDestination.Action = 'Append';
PROPAGATE TO TERMINAL 'out2' DELETE NONE;
SET OutputLocalEnvironment.WrittenDestination.Action = 'Finish';
PROPAGATE TO TERMINAL 'out3' DELETE NONE;
END IF;

 

But this code writing multiple file instead of creating single file, Can any one help me to find the solution for my problem.

 

Thanks,

Ramanujan

 

 

 

 

 

Updated on 2013-08-13T17:48:01Z at 2013-08-13T17:48:01Z by Ramanujan1980
  • KY0J_Simbu_Selvarasu
    40 Posts

    Re: WMB File Handling with MQ Batch

    ‏2013-08-14T11:49:26Z  

    Try running BatchProcessing sample in toolkit. It will tell you how to append record to a file