|
Home > Archive > BizTalk Server Orchestration > July 2004 > BTS2004: How to set the CorrelationID MSMQ
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
BTS2004: How to set the CorrelationID MSMQ
|
|
|
| Hi,
I need to populate the CorrelationID of MSMQT with the activating
messageID. I was under the impression that this was a typical middleware
functionality but it seems not to be.
Can any one direct me in what area I should look? Is it a orchastration
thing or pipeline. Most of all, do I need to program this stuf. (I'm not
really familiar with microsoft languages)
Thanks,
Bart
| |
| Adrian Hamza[MSFT] 2004-07-15, 5:50 pm |
| Correlation functionality does not have to dependent on the transport, and
in fact it almost never is. All the correlation will be done in the
orchestration, you don't have to program (write code) but you do have to
edit XSD schemas and the orchestration. Also you should install the latest
documentation and SDK from
<http://www.microsoft.com/biztalk/do...efault_2004.asp> and
search for correlation.
See below some information on correlation that I sent previously to
somebody else on the newsgroup.
Correlation sets are used to match incoming messages with already existing
orchestration instances. First, let me explain the problem that the
correlation sets are resolving.
You have an orchestration that interacts with your partner. The flow of
data is like this:
- partner sends purchase order
- you send confirmation
- partner sends invoice
Let's assume that all this processing is done in one orchestration. Your
partner sends you 2 purchase orders, PO1 and PO2. These 2 purchase orders
will activate 2 orchestration instances that will send 2 confirmations back
to your partner, Conf1 and Conf2. Your partner replies back to you with one
invoice, let's say Invoice2. This invoice has to be received by one of the
orchestration instances already running, but the question is which of the 2
orchestration instances should receive this invoice? A human would know
that each of the messages contains information that allows him to group
these messages toghether. For instance, the purchase order has an
identification number and this identification number is also included in
the confirmation and in the invoice as well. So all you need is a mechanism
to tell BizTalk which document elements in the three messages are in fact
refering to the same data. You will use correlation sets to do that.
This is one of the ways you could do it. You would open the purchase order
and you would promote the PurchaseOrderID (right click and chose Quick
Promotion). This has defined a promoted property for this element and this
property has been mapped to the correct element in the document. Now you
open Confirmation, right click the element that contains the purchase order
id and you will select Show Promotions. In the dialog that shows up you
will map the, purchase order Id to the already existing promoted property
that you have defined at the first step. Repeat this second step for
invoice document as well.
Now, the purchase order id information is promoted (from all messages) into
a property callled PurchaseOrderID. You can create a correlation set and
include this promoted property into the correlation set.
--------------------[vbcol=seagreen]
< df0a8d5120ebaf87976f5ab052e67687@localho
st.talkaboutsoftware.com>[vbcol=seagreen]
cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08
.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!n
ews.maxwell.syr.edu!sn-xit-03!sn-xit-06!sn-post-02!sn-post-01!supernews.com!
corp.supernews.com!not-for-mail[vbcol=seagreen]
This posting is provided "AS IS" with no warranties, and confers no rights.
EBusiness Server Team
| |
|
| Dear Adrian,
I know about correlation within BizTalk. But now I have a situation in
which NOT biztalk dependents on correlation but the initiating party.
So, an application sends a MSMQ message, Biztalk pick it up and needs to
supply the Message ID (GUID + MsgID ) in the CorrelationID of the
reply-Message context in order to handle a correct correlation (NOT in
biztalk in the application it self). So in this case canniot use business
data as correlation factors, I need the CorrelationID.
With your example say that application A sends a purchase order to biztalk
and biztalk transforms the message and performs data consistency checks.
If all is well biztalk sends it to vendor and replies to application a
(which needs to confirm to the user) OK message. This needs to be the
Correlation ID, since application A requires that.
I think this is not in biztalk at the moment, is it??
Bart
| |
| Adrian Hamza[MSFT] 2004-07-17, 2:47 am |
| Hi Bart,
Sorry for the speach on correlation..... I'm still not sure I understand
your scenario so let me describe what I understood so far.
- BizTalk receives an MSMQ message (through an MSMQT receive location)
sent by an application using MSMQ. This is MsgFromApp message.
- this message has the CorrelationID property (this is the CorrelationID
property supported by MSMQ messages) populated with some value by the
sending application
- BizTalk replies with another MSMQ message and it has to populate the
CorrelationID field of the MSMQ message with the value received from the
app. The reply message is ReplyMsg.
Please let me know if I got this wrong.
If I got your scenario right, did you try using context properties in the
orchestration? All messages that go through the MSMQT adapter will have the
MSMQT.CorrelationId context property populated with the value from the MSMQ
message. The reverse thing should happen for outgoing messages.
Try the following: in the orchestration, when you construct the response
message, use the following expression in an expression shape inside the
construct shape
ReplyMsg(MSMQT.CorrelationId) = MsgFromApp(MSMQT.CorrelationId)
If I didn't get the scenario, could you please provide me with more details?
Thanks,
Adrian.
--------------------[vbcol=seagreen]
< e54c9cdc1793a64f4ee5c15e3e678e0f@localho
st.talkaboutsoftware.com>[vbcol=seagreen]
< df0a8d5120ebaf87976f5ab052e67687@localho
st.talkaboutsoftware.com>
<b7D0X3oaEHA.600@cpmsftngxa06.phx.gbl>[vbcol=seagreen]
cpmsftngxa06.phx.gbl!TK2MSFTNGXS01.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP0
8.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!news.glorb.com!tdsnet-trans
it!newspeer.tds.net!sn-xit-02!sn-xit-06!sn-post-01!supernews.com!corp.supern
ews.com!not-for-mail[vbcol=seagreen]
This posting is provided "AS IS" with no warranties, and confers no rights.
EBusiness Server Team
| |
|
| Hi Adrian,
You're Close. The actual situation is:
1 I'm using MSMQC receive location and send ports.
Therefor the MSMQT.CorrelationID property seems "null"
2 The sending systeem does not need the Originating correlationId but
needs the MessageID in the CorrelationId property.
so ReplyMes(CorrelationId) = OriginalMsg(MsgId).
It seems that the MSMQC adapter sets BizTalk message Properties but I
can't find the reference how to address them in a orchestration.
So you're solution is close but not close enough. I think I need an extra
reference or to use another field within the orchestration.
| |
| Adrian Hamza[MSFT] 2004-07-20, 8:53 pm |
| Now I understand. Can I ask you if you have any specific reasons for using
MSMQC and not MSMQT? The reason I'm asking this is the fact that MSMQC is
just a sample adapter, that is less tested than the MSMQT adapter that is
shipped with BizTalk which has been more thoroughly tested.
Regardless of your answer, MSMQC adapter exposes the properties that you
need in order to access the correlation ID. These properties are defined in
the MSMQCPropertySchema.xsd file under %ProgramFiles%\Microsoft BizTalk
Server 2004\SDK\Samples\Adapters\MSMQCAdapter\R
un-Time\MSMQCAdapterProps.
Currently there are some known issues with that property schema and
Microsoft is working on documenting these issues. Since this is a sample,
you can change the schema yourself to make it work. All you need to do is
open the BizTalk project that contains that schema and change the "Property
Schema Base" property for each of the message property from "" to
MessageContextPropertyBase.
After that, build and redeploy the BizTalk assemby containing the scheme.
In your BizTalk orchestration project, add a reference to the newly
deployed property schema assembly (make sure you add reference to the newly
compiled project, not to the old assembly compiled with SDK).
Now you can use this expression to access the correlation ID
ReplyMes(MSMQCAdapterProps.CorrelationId) =
OriginalMsg(MSMQCAdapterProps.Id);
Hope this helps,
Adrian.
--------------------[vbcol=seagreen]
< bea81661b73ee9137f4bd6c4f415de0b@localho
st.talkaboutsoftware.com>[vbcol=seagreen]
< df0a8d5120ebaf87976f5ab052e67687@localho
st.talkaboutsoftware.com>
<b7D0X3oaEHA.600@cpmsftngxa06.phx.gbl>
< e54c9cdc1793a64f4ee5c15e3e678e0f@localho
st.talkaboutsoftware.com>
<mRrAiq8aEHA.2804@cpmsftngxa06.phx.gbl>[vbcol=seagreen]
cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.s
ul.t-online.de!t-online.de!border2.nntp.dca.giganews.com!border1.nntp.dca.gi
ganews.com!nntp.giganews.com!news.glorb.com!tdsnet-transit!newspeer.tds.net!
sn-xit-02!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mail[vbcol=seagreen]
This posting is provided "AS IS" with no warranties, and confers no rights.
EBusiness Server Team
| |
|
| Hi Adrain,
The last solution you gave did actually work. The reason we use the MSMQC
is because MSMQT does not save very easy to get Messages with teh
appropriate information. And since the MSMQ is there anyway why not use
the Queueing and journal facilities that a of people already know.
Further more the MSMQC is quicker.
Thanks,
Bart
|
|
|
|
|