Author |
Message
|
WMBSAM |
Posted: Sun Oct 04, 2009 8:17 pm Post subject: Asyncronous correlationid |
|
|
 Voyager
Joined: 02 Oct 2009 Posts: 90 Location: Atlanta
|
I have a situation where i receive the requests from 'n' number of different workstations thru HTTP request. so our design needs create a unique correl id depending upon the workstation URL and the messageid so that when i receive the response from the other webservice i send the resonse to the correct destination from where i received the request originated.
Any ideas how to implement it???
I thought to save the two parameters using the shared row variable but the problem is when i receive the response after tracking the end url to make the http call to the correct destination i need to delete that particular element in the main row variable and update the row variable.
It is an asynchronous flow.
My code looks something like this:
declare i shared int 0;
declare CorrelationID shared row;
Code: |
IF InputRoot.XMLNSC.ns1:Envelope.ns2:Body.ns3:reqid= 'xxxx' THEN
while
SET CorrelID.Data[] = list{HTTP.URL,Inputroot.reqid};
END; ; |
and after i receive the response route to correct destination and then how to delete the correlationid.data[x] variable and update the row variable??? |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Oct 04, 2009 9:32 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
I believe you're going down the path of wrong design...
Let MQ allocate the correlationId. It is an anonymous identifier pattern.
You don't need to know the correlationId and it does not have to have special meaning. All you need to be able to do is have it be unique (MQ will take care of that) and link it to your httreply (the flow should take care of that).
The rest here is from memory... so correct to the right variable name if I misspelled something...
Retrieve the correlid after the request message was written from
LocalInputEnvironment in a new compute node...-- read up on the MQPut node it will tell you exactly where the correlId goes on the LocalOutputEnvironment tree...
You can then retrieve the response by correlationID...
Hope this helps.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Sun Oct 04, 2009 10:46 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Right, but it's not apparent that there's any MQ involved at all.
Regardless, I was fairly sure that there should be a session id of some kind in the HTTP headers. |
|
Back to top |
|
 |
Raj2000 |
Posted: Mon Oct 05, 2009 12:26 am Post subject: |
|
|
 Apprentice
Joined: 03 Aug 2009 Posts: 47
|
Yes ,Jeff is correct there is no mq involved .i receive the input messages as http request from there i will capture the URL of the client application which made the req and the request id which is sent as a part of the input message i need to combine them to make a correl id in shared variable as follows:
CorrelID.Data[]=list{I/p Root.reqID,URL}
<CorreID>
<ReqID>abc</ReqID>
<URL>http://</URL>
</CorreID>
<CorreID>
<ReqID>xyz</ReqID>
<URL>http://</URL>
</CorreID>
....... and so on..
i can do the above task and wen i receive the response i would track the destination URL depending upon the reqid sent by the response and which is saved inthe row variable. but the problem is how to delete this particular correlid element and update the row variable so that no duplication takes place.I am stuck over here.
Any other suggestion(i mean logic which can accomplish the above task) is also welcome?
 |
|
Back to top |
|
 |
Raj2000 |
Posted: Mon Oct 05, 2009 12:43 am Post subject: Re: Asyncronous correlationid |
|
|
 Apprentice
Joined: 03 Aug 2009 Posts: 47
|
WMBSAM wrote: |
our design needs create a unique correl id depending upon the workstation URL and the messageid so that |
I am sorry it is not the message id it is the request id i receive as a part of the I/p message.
Quote: |
My code looks something like this:
declare i shared int 0;
declare CorrelationID shared row;
Code: |
IF InputRoot.XMLNSC.ns1:Envelope.ns2:Body.ns3:reqid= 'xxxx' THEN
while
SET CorrelID.Data[] = list{HTTP.URL,Inputroot.reqid};
END; ; |
and after i receive the response route to correct destination and then how to delete the correlationid.data[x] variable and update the row variable??? |
Update regarding the code:
Code: |
declare i shared int 0;
declare CorrelationID shared row;
IF InputRoot.XMLNSC.ns1:Envelope.ns2:Body.ns3:reqid= 'xxxx' THEN
while
SET CorrelID.Data[i] = list{HTTP.URL,Inputroot.reqid};
i=i+1;
END; ; |
and after i receive the response route to correct destination and then how to delete the correlationid.data[x] variable and update the row variable??? |
|
Back to top |
|
 |
WMBSAM |
Posted: Mon Oct 05, 2009 10:25 am Post subject: |
|
|
 Voyager
Joined: 02 Oct 2009 Posts: 90 Location: Atlanta
|
just thought to ask is there any way i can use Soap Asynchrnous request response node to acheive the above task if so how???  |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Oct 05, 2009 7:46 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
OK so the problem is carrying the response information to the asynchronous reply...
I'd use the aggregation pattern and would just package the reply information into an additional MQ Message going to the aggregation. At fan in retrieve all messages and use the reply information to create your destination information, whether it be MQ or http....
If it is in the same flow... why don't you use the Environment tree for parking the information until you need it?
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Oct 06, 2009 2:10 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Or there should be a session ID in the original HTTP request that can be passed in the HTTP headers.
 |
|
Back to top |
|
 |
|