BAM API oddity
my first time trying use bam api has been less successful. instrumentation have hacked works intermittently, , darned if can figure out why. here's scenario:
i write 4 pieces of data bam in 3 places:
custom recv pipeline: data 1
orchestration top: data 2
orchestration bottom: data 3
custom send pipeline: data 4
in recv pipeline, generate guid, use activity id, , call beginactivity , updateactivity (this using message event stream pipeline context). @ end of pipeline, call enablecontinuation, pass in guid continuation id , call endactivity. store continutation id in message context.
then, message picked orchestration. @ top of orchestration, using orchestrationeventstream, call updateactivity , endactivity , pass in continuationid, i extract context property stored id in while in pipeline.
the orchestration stuff.
in messageassignment shape, store continuationid in response/outgoing message context use in send pipeline. @ bottom of orchestration, again call updateactivity/endactivity.
finally, in send pipeline, extract continuationid message context, , use call updateactivity/endactivity 1 more time.
whew!
so, expected result in bam database... sometimes. sometimes, activity values orchestration written active table never moved completed table, , other times, activity values send pipeline same thing.
i have posted relevant code snippets below. hope has insight here...
edit: 1 thing forgot explicitly mention: bam data recv pipeline works. failures either orchestration or send pipeline, never both @ same time.
thanks,
jason
jason[dot]ellsworthaults[plus]msdn[at]gmail[dot]com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
recv pipeline
string activityid = system.guid.newguid().tostring();
string conid = system.guid.newguid().tostring();
inmsg.context.write("userdefined", soappropertiesnamespace, conid);
// activity needs beginactivity first time (in receive pipeline),
// , updated subsequent times (in orchestration , send pipeline)
messageeventstream.beginactivity(activityname, activityid);
messageeventstream.updateactivity(activityname, activityid, "requestmessagearchiveid", interchangeid);
messageeventstream.updateactivity(activityname, activityid, "requestreceivedfromlln", system.datetime.now.touniversaltime());
// enable continuation, because event streams asynchronous
messageeventstream.enablecontinuation(activityname, activityid, conid);
messageeventstream.endactivity(activityname, activityid);
orchestration top
strconid = message_cuweligibility_request_in(soap.userdefined);
microsoft.biztalk.bam.eventobservation.orchestrationeventstream.updateactivity("cuweligibility", strconid, "requestsenttocuwteam", system.datetime.now.touniversaltime());
microsoft.biztalk.bam.eventobservation.orchestrationeventstream.endactivity("cuweligibility", strconid);
orchestration message assignment
message_cuweligibility_response_out = varxmldoc;
//store interchangeid request message facilitate bam tracking
message_cuweligibility_response_out(soap.userdefined) = strconid;
orchestration bottom
microsoft.biztalk.bam.eventobservation.orchestrationeventstream.updateactivity("cuweligibility", strconid, "responsereceivedfromcuwteam", system.datetime.now.touniversaltime());
microsoft.biztalk.bam.eventobservation.orchestrationeventstream.endactivity("cuweligibility", strconid);
send pipeline
conid= inmsg.context.read("userdefined", soappropertiesnamespace).tostring();
// because using continuation, use continuation id
// (which interchangeid) in place of activity id,
// , bam works out relationship us.
messageeventstream.updateactivity(activityname, conid, "responsemessagearchiveid", interchangeid);
messageeventstream.updateactivity(activityname, conid, "responsesenttolln", system.datetime.now.touniversaltime());
messageeventstream.endactivity(activityname, conid);
please try following method which is working fine me...
recv pipeline
string activityid = system.guid.newguid().tostring();
string conid = "orch1_" + activityid; //changed
inmsg.context.write("userdefined", soappropertiesnamespace, activityid); //changed
// activity needs beginactivity first time (in receive pipeline),
// , updated subsequent times (in orchestration , send pipeline)
messageeventstream.beginactivity(activityname, activityid);
messageeventstream.updateactivity(activityname, activityid, "requestmessagearchiveid", interchangeid);
messageeventstream.updateactivity(activityname, activityid, "requestreceivedfromlln", system.datetime.now.touniversaltime());
// enable continuation, because event streams asynchronous
messageeventstream.enablecontinuation(activityname, activityid, conid);
messageeventstream.endactivity(activityname, activityid);
messageeventstream.flush() //added
orchestration top
stractivityid = message_cuweligibility_request_in(soap.userdefined); //added
strconid = "orch1_" + stractivityid; //changed
microsoft.biztalk.bam.eventobservation.orchestrationeventstream.updateactivity("cuweligibility", strconid,
"requestsenttocuwteam", system.datetime.now.touniversaltime());
/*microsoft.biztalk.bam.eventobservation.orchestrationeventstream.endactivity("cuweligibility", strconid); *///remove this
orchestration message assignment
message_cuweligibility_response_out = varxmldoc;
//store interchangeid request message facilitate bam tracking
message_cuweligibility_response_out(soap.userdefined) = varactivityid; //changed
orchestration bottom
microsoft.biztalk.bam.eventobservation.orchestrationeventstream.updateactivity("cuweligibility", strconid,
"responsereceivedfromcuwteam", system.datetime.now.touniversaltime());
stroutconid="snd1_"+varactivityid; //added
microsoft.biztalk.bam.eventobservation.orchestrationeventstream.enablecontinuation("cuweligibility",strconid,stroutconid);
microsoft.biztalk.bam.eventobservation.orchestrationeventstream.endactivity("cuweligibility", strconid);
send pipeline
conid= inmsg.context.read("userdefined",soappropertiesnamespace).tostring();
// because using continuation, use continuation id
// (which interchangeid) in place of activity id,
// , bam works out relationship us.
conid="snd1_" + conid; //added
messageeventstream.updateactivity(activityname, conid, "responsemessagearchiveid", interchangeid);
messageeventstream.updateactivity(activityname, conid, "responsesenttolln", system.datetime.now.touniversaltime());
messageeventstream.endactivity(activityname, conid);
messageeventstream.flush() //added
let me know if works..
BizTalk Server > BizTalk Server General
Comments
Post a Comment