Jun 10, 2008

MQ correlation set initialization in biztalk


WMQ manager can generate a unique message id (MQMD_MsgID) for you if you put message to queue with MQMD_MsgID set to null.
In MQ/MQC biztalk adapters there is a great feature to get the MQMD_MsgID after putting the message to WMQ queue using solicit response port. After putting the message to queue you get an xml which includes the MQMD_MsgID.


So if you want to send a request and get the response by WMQ you need to do the next steps :
  1. Create send solicit-response port, configure it to Mqseries/MQC adapters.
  2. Create Correlation Set based on MQSeries.Biztalk_CorrelationID
    1. Add Mqseries.dll to your project, from Biztalk bin directory.
    2. Create the correlation type,You can make the correlation only by the MQSeries.Biztalk_CorrelationID because the adapters update it automatically. On send to queue they copy the MQMD_MsgID to MQSeries.Biztalk_CorrelationID and on the receive the adapter copies the value of MQSeries.Biztalk_CorrelationID to MQMD_CorrelationID.
  3. Initialize the Correlation set using "dummy send" port (Null/Nope adapters)
    You cannot initialize it on the receive shape like in the following orchestration , because you will get this error when compile :
    "in a sequential convoy the ports must be identical" .



    you get this error because biztalk cannot determine which message it will get first, the message of the solicit-response (receive shape which initialize the correlation set) or the message of the response followed up the Correlation set.
  4. Set the follow correlation set attribute on the needed receive shape.

    enjoy



<

1 comment:

zeetalks said...

Hi Alex,
Sound great. Would it be possible to send me a copy of your sample application ?

Cheers,
Zee
http://zeetalks.wordpress.com