<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Keith Lim's Biztalk BAM Blog</title><link>http://blogs.msdn.com/b/keithlim/</link><description>BizTalk BAM 
TPE 
EventStream
MessagingEventStream
DirectEventStream
BufferedEventStream 
OrchestrationEventStream

</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>BAM continuation between WF/WCF application and BizTalk application</title><link>http://blogs.msdn.com/b/keithlim/archive/2007/07/05/bam-continuation-between-wf-wcf-application-and-biztalk-application.aspx</link><pubDate>Thu, 05 Jul 2007 22:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3711049</guid><dc:creator>keithlim</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/keithlim/rsscomments.aspx?WeblogPostID=3711049</wfw:commentRss><comments>http://blogs.msdn.com/b/keithlim/archive/2007/07/05/bam-continuation-between-wf-wcf-application-and-biztalk-application.aspx#comments</comments><description>Awhile back a user asked me this question on BAM continuation from a WF/WCF application to a BizTalk application: 
 
 I have a process which starts a workflow and then an orchestration. I want to create an activity cross the workflow and the orchestration...(&lt;a href="http://blogs.msdn.com/b/keithlim/archive/2007/07/05/bam-continuation-between-wf-wcf-application-and-biztalk-application.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3711049" width="1" height="1"&gt;</description></item><item><title>Steps to facilitate the creation of WCF Interceptor Configuration file. </title><link>http://blogs.msdn.com/b/keithlim/archive/2007/06/29/steps-to-facilitate-the-creation-of-wcf-interceptor-configuration-file.aspx</link><pubDate>Fri, 29 Jun 2007 04:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3595759</guid><dc:creator>keithlim</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/keithlim/rsscomments.aspx?WeblogPostID=3595759</wfw:commentRss><comments>http://blogs.msdn.com/b/keithlim/archive/2007/06/29/steps-to-facilitate-the-creation-of-wcf-interceptor-configuration-file.aspx#comments</comments><description>The BAM Interceptor for WCF does not come with a UI tool to create the Interceptor Configuration file, and from the Beta II customer feedback thus far, this is the main pain point as well. I will try to provide some steps and guidelines to help ease this...(&lt;a href="http://blogs.msdn.com/b/keithlim/archive/2007/06/29/steps-to-facilitate-the-creation-of-wcf-interceptor-configuration-file.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3595759" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-03-59-57-59/SvcTraceViewer1.JPG" length="103331" type="image/jpeg" /><category domain="http://blogs.msdn.com/b/keithlim/archive/tags/Creating+WCF+Interceptor+Configuration/">Creating WCF Interceptor Configuration</category></item><item><title>BAM Interceptor for WCF </title><link>http://blogs.msdn.com/b/keithlim/archive/2007/06/29/bam-interceptor-for-wcf.aspx</link><pubDate>Fri, 29 Jun 2007 02:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3593723</guid><dc:creator>keithlim</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/keithlim/rsscomments.aspx?WeblogPostID=3593723</wfw:commentRss><comments>http://blogs.msdn.com/b/keithlim/archive/2007/06/29/bam-interceptor-for-wcf.aspx#comments</comments><description>Many of you guys are eagerly anticipating the release of the Microsoft BizTalk Server 2006 R2… and the only definite answer to that is it will be available in Q3 of 2007. In the meantime, the Beta 2 release of it can be downloaded from this link: http...(&lt;a href="http://blogs.msdn.com/b/keithlim/archive/2007/06/29/bam-interceptor-for-wcf.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3593723" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/keithlim/archive/tags/BAM+Interceptor+for+WCF/">BAM Interceptor for WCF</category></item><item><title>How to programatically retrieve data from BAMPrimaryImport using supportable API</title><link>http://blogs.msdn.com/b/keithlim/archive/2006/03/08/545851.aspx</link><pubDate>Wed, 08 Mar 2006 04:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:545851</guid><dc:creator>keithlim</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/keithlim/rsscomments.aspx?WeblogPostID=545851</wfw:commentRss><comments>http://blogs.msdn.com/b/keithlim/archive/2006/03/08/545851.aspx#comments</comments><description>Eventhough there are Portal UI and Excel that would allow you to query and access BAM activity data, it seems that there are some of you who would like to programmatically access/query this data from a custom application. 
 In BizTalk Server Documentation...(&lt;a href="http://blogs.msdn.com/b/keithlim/archive/2006/03/08/545851.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=545851" width="1" height="1"&gt;</description></item><item><title>Soliciting Biztalk BAM scenarios and issues</title><link>http://blogs.msdn.com/b/keithlim/archive/2006/02/10/529028.aspx</link><pubDate>Fri, 10 Feb 2006 03:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:529028</guid><dc:creator>keithlim</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/keithlim/rsscomments.aspx?WeblogPostID=529028</wfw:commentRss><comments>http://blogs.msdn.com/b/keithlim/archive/2006/02/10/529028.aspx#comments</comments><description>How great it would be if every features we put in to the software is what customers need/want. Anyway, I am creating this entry to solicit your input on how you use or plan to use BizTalk BAM. Please response as a comment with your scnenario. 
 Do also...(&lt;a href="http://blogs.msdn.com/b/keithlim/archive/2006/02/10/529028.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=529028" width="1" height="1"&gt;</description></item><item><title>BAM API: Using OrchestrationEventStream</title><link>http://blogs.msdn.com/b/keithlim/archive/2006/02/08/528023.aspx</link><pubDate>Thu, 09 Feb 2006 02:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:528023</guid><dc:creator>keithlim</dc:creator><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/keithlim/rsscomments.aspx?WeblogPostID=528023</wfw:commentRss><comments>http://blogs.msdn.com/b/keithlim/archive/2006/02/08/528023.aspx#comments</comments><description>&lt;p&gt;Since there is not&amp;nbsp;much&amp;nbsp;documentation* on this yet on how to use OrchestrationEventStream (an EventStream that is in synch with Orchestration), here is a quick&amp;nbsp;info&amp;nbsp;on the howto:&lt;/p&gt;
&lt;p&gt;This new feature is found in &lt;strong&gt;Microsoft.BizTalk.Bam.XLANGs&lt;/strong&gt;&amp;nbsp;assembly.&amp;nbsp;&amp;nbsp;From you BizTalk project, you can write the following in your orchestration, e.g. Expression Editor (click on the appropriate shape in orchestration to launch this): &lt;br /&gt;&lt;br /&gt;// Sample code for using OrchestrationEventStream from an orchestration, no need to new it: &lt;br /&gt;Microsoft.BizTalk.Bam.EventObservation.OrchestrationEventStream.BeginActivity( "PurchaseOrder", "PO123"); &lt;br /&gt;&lt;br /&gt;Note: this only applies to Biztalk 2006.&lt;/p&gt;
&lt;p&gt;*&amp;nbsp;To use this in&amp;nbsp;Biztalk 2004 SP1, you will need a hot fix, its kb article can be found here:&amp;nbsp;&lt;a href="http://www.kbalertz.com/Feedback_900083.aspx"&gt;http://www.kbalertz.com/Feedback_900083.aspx&lt;/a&gt;, &lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=528023" width="1" height="1"&gt;</description></item><item><title>Sample code to retrieve server and database info of Biztalk MessageBox and PIT </title><link>http://blogs.msdn.com/b/keithlim/archive/2006/02/08/528006.aspx</link><pubDate>Thu, 09 Feb 2006 02:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:528006</guid><dc:creator>keithlim</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/keithlim/rsscomments.aspx?WeblogPostID=528006</wfw:commentRss><comments>http://blogs.msdn.com/b/keithlim/archive/2006/02/08/528006.aspx#comments</comments><description>&lt;p&gt;Since there is a request for this, here is an example to retrieve server name and database for Biztalk MessageBox and BAM Primary Import database.&amp;nbsp; Since this is accessing internal implementation, this code is not supportable (use at your own risk) and users&amp;nbsp;will be required to maintain this code on their own when doing upgrade. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;u&gt;Here are the steps:&lt;/u&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Create a console appplication project in Visual Studio, &lt;/p&gt;
&lt;p&gt;Cut and paste the code below and run &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;u&gt;Sample output:&lt;/u&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;InfoFound Management Server KW0081 Database BizTalkMgmtDb&lt;br /&gt;InfoFound MsgBox Server KW0081 Database BizTalkMsgBoxDb&lt;br /&gt;InfoFound PIT Server KW0081 Database BAMPrimaryImport&lt;br /&gt;InfoFound DTA Server KW0081 Database BizTalkDTADb&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;u&gt;Sample Code:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;&lt;font color=#0000ff size=2&gt;
&lt;p&gt;using&lt;/p&gt;&lt;/font&gt;&lt;font size=2&gt; System;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;
&lt;p&gt;using&lt;/p&gt;&lt;/font&gt;&lt;font size=2&gt; System.Data.SqlClient;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;
&lt;p&gt;using&lt;/p&gt;&lt;/font&gt;&lt;font size=2&gt; System.Globalization;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;
&lt;p&gt;using&lt;/p&gt;&lt;/font&gt;&lt;font size=2&gt; Microsoft.Win32;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;namespace&lt;/font&gt;&lt;font size=2&gt; KeithLimBizTalkBAMUtility
&lt;p&gt;{&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;class&lt;/font&gt;&lt;font size=2&gt; InfrastructureInfo
&lt;p&gt;{&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;[STAThread]&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;static&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;void&lt;/font&gt;&lt;font size=2&gt; Main(&lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt;[] args)
&lt;p&gt;{&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;InfrastructureInfo ii = &lt;/p&gt;&lt;/blockquote&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;new&lt;/font&gt;&lt;font size=2&gt; InfrastructureInfo();
&lt;p&gt;ii.GetInfo();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;internal&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;const&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; BtsAdminRegistryKey = @"Software\\Microsoft\\BizTalk Server\\3.0\\Administration";
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;internal&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;const&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; BtsServerRegistryKey = @"MgmtDBServer";
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;internal&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;const&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; BtsNameRegistryValue = @"MgmtDBName";
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;internal&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;const&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; BtsMgmtSprocRetrieveMsgBoxPITandDTA = @"SELECT SubscriptionDBServerName, SubscriptionDBName, BamDBServerName, BamDBName, TrackingDBServerName, TrackingDBName FROM adm_Group";
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;internal&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;const&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; BtsMigrateError = @"Error";
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;internal&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;const&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; BtsMigrateInfo = @"Info";
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;internal&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;const&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; BtsMigrateWarning = @"Warning";
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;private&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; managementServer;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;private&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; managementDatabase;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;private&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; dtaServer;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;private&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; dtaDatabase;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;private&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; pitServer;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;private&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; pitDatabase;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;private&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; msgBoxServer;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;private&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; msgBoxDatabase;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;internal&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;static&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; BuildConnectionString(&lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; server, &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; database)
&lt;p&gt;{&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;const&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; SqlConnectionString = @"Data Source=""{0}"";Initial Catalog=""{1}"";Integrated Security=SSPI;Application Name=""BamManager"";Connect Timeout=60";
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;return&lt;/font&gt;&lt;font size=2&gt; String.Format(CultureInfo.InvariantCulture,
&lt;p&gt;SqlConnectionString, server, database);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;private&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;void&lt;/font&gt;&lt;font size=2&gt; GetInfo()
&lt;p&gt;{&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;RegistryKey key = Registry.LocalMachine.OpenSubKey(BtsAdminRegistryKey, &lt;/p&gt;&lt;/blockquote&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;false&lt;/font&gt;&lt;font size=2&gt;);
&lt;p&gt;SqlDataReader reader = &lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;null&lt;/font&gt;&lt;font size=2&gt;;
&lt;p&gt;SqlConnection btmConnection = &lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;null&lt;/font&gt;&lt;font size=2&gt;;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;if&lt;/font&gt;&lt;font size=2&gt; (key != &lt;/font&gt;&lt;font color=#0000ff size=2&gt;null&lt;/font&gt;&lt;font size=2&gt;)
&lt;p&gt;{&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.managementServer = (&lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt;)key.GetValue(BtsServerRegistryKey);
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.managementDatabase = (&lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt;)key.GetValue(BtsNameRegistryValue);
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;else&lt;/font&gt;&lt;font size=2&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;Console.WriteLine(BtsMigrateError + "Failed to retrieve Management database connection string from " + BtsAdminRegistryKey);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;return&lt;/font&gt;&lt;font size=2&gt;;
&lt;p dir=ltr&gt;}&lt;/p&gt;
&lt;p&gt;Console.WriteLine(BtsMigrateInfo + &lt;/p&gt;
&lt;p&gt;String.Format("Found Management Server {0} Database {1}", &lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.managementServer, &lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.managementDatabase));
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;try&lt;/font&gt;&lt;font size=2&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/font&gt;&lt;font color=#008000 size=2&gt;// Open up the Management Database&lt;/font&gt;&lt;font size=2&gt;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;string&lt;/font&gt;&lt;font size=2&gt; btmConnectionString = BuildConnectionString(&lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.managementServer, &lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.managementDatabase);
&lt;p&gt;btmConnection = &lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;new&lt;/font&gt;&lt;font size=2&gt; SqlConnection(btmConnectionString);
&lt;p&gt;btmConnection.Open();&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#008000 size=2&gt;// Query the Primary Import Database&lt;/font&gt;&lt;font size=2&gt;
&lt;p&gt;SqlCommand cmd = &lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;new&lt;/font&gt;&lt;font size=2&gt; SqlCommand(BtsMgmtSprocRetrieveMsgBoxPITandDTA, btmConnection);
&lt;p&gt;reader = cmd.ExecuteReader();&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;if&lt;/font&gt;&lt;font size=2&gt; (!reader.Read())
&lt;p&gt;{&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;Console.WriteLine(BtsMigrateError + "Failed to retrieve PIT and DTA databases from management DB (is group deployed?)");&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.msgBoxServer = reader.GetString(0);
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.msgBoxDatabase = reader.GetString(1);
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.pitServer = reader.GetString(2);
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.pitDatabase = reader.GetString(3);
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.dtaServer = reader.GetString(4);
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.dtaDatabase = reader.GetString(5);
&lt;p&gt;Console.WriteLine(BtsMigrateInfo + &lt;/p&gt;
&lt;p&gt;String.Format("Found MsgBox Server {0} Database {1}",&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.msgBoxServer, &lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.msgBoxDatabase));
&lt;p&gt;Console.WriteLine(BtsMigrateInfo + &lt;/p&gt;
&lt;p&gt;String.Format("Found PIT Server {0} Database {1}",&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.pitServer, &lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.pitDatabase));
&lt;p&gt;Console.WriteLine(BtsMigrateInfo +&lt;/p&gt;
&lt;p&gt;String.Format("Found DTA Server {0} Database {1}", &lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.dtaServer, &lt;/font&gt;&lt;font color=#0000ff size=2&gt;this&lt;/font&gt;&lt;font size=2&gt;.dtaDatabase));
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;finally&lt;/font&gt;&lt;font size=2&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;if&lt;/font&gt;&lt;font size=2&gt; (reader != &lt;/font&gt;&lt;font color=#0000ff size=2&gt;null&lt;/font&gt;&lt;font size=2&gt;)
&lt;p&gt;{&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;reader.Close();&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;btmConnection.Close();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p dir=ltr&gt;}&lt;/p&gt;
&lt;p dir=ltr&gt;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=528006" width="1" height="1"&gt;</description></item><item><title>Continuation scenarios with mixed of TPE-enabled and non-TPE-Enabled tracking:</title><link>http://blogs.msdn.com/b/keithlim/archive/2006/02/08/527227.aspx</link><pubDate>Wed, 08 Feb 2006 05:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:527227</guid><dc:creator>keithlim</dc:creator><slash:comments>18</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/keithlim/rsscomments.aspx?WeblogPostID=527227</wfw:commentRss><comments>http://blogs.msdn.com/b/keithlim/archive/2006/02/08/527227.aspx#comments</comments><description>&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;It has been a while since I last blogged on this.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Let's continue from where I left off.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Let's pick two continuation scenarios: the first, a TPE segment continues to a non-TPE segment, and the reverse being the second. &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1; tab-stops: list .25in"&gt;&lt;strong&gt;&lt;font color=#000000&gt;&lt;font style="BACKGROUND-COLOR: #ffffff"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman'"&gt;&lt;span style="mso-list: Ignore"&gt;1.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span dir=ltr&gt;&lt;u&gt;TPE-enabled segment continues to a non-TPE-enabled segment.&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;font style="BACKGROUND-COLOR: #ffffff" color=#000000&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;In this scenario, you would need &lt;span style="COLOR: blue"&gt;only a Continuation folder&lt;/span&gt;. The naming of this folder is important since the concatenation of the folder name and its mapped value will form the continuation TokenID used in non-TPE-enabled segment.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;For example, if the Continuation folder name is &lt;font color=#0000ff&gt;"TPE2OES&lt;/font&gt;" and the mapped value has &lt;font color=#0000ff&gt;"PO123"&lt;/font&gt; for instance, the continuation &lt;font color=#0000ff&gt;TokenID would be "TPE2OESPO123".&lt;/font&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Once you have mapped other data items and milestones, you will deploy* this. &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;In the related orchestration, in the process somewhere downstream, you will need to insert the following: &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;// Continuation segment using OrchestrationEventstream**&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;// Where ContinuationTokenID based on this instance contains the value ""TPE2OESPO123".***&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Microsoft.BizTalk.Bam.EventObservation.OrchestrationEventStream.UpdateActivity("PurchaseOrder",&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;ContinuationTokenID, &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;"Column1", Value1,&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;"Column2", Value2);&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Microsoft.BizTalk.Bam.EventObservation.OrchestrationEventStream.EndActivity("PurchaseOrder",&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;ContinuationTokenID);&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1; tab-stops: list .25in"&gt;&lt;strong&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman'"&gt;&lt;span style="mso-list: Ignore"&gt;2.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span dir=ltr&gt;&lt;u&gt;Non-TPE-enabled segment continues to a TPE-enabled segment.&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;u&gt;&lt;o:p&gt;&lt;span style="TEXT-DECORATION: none"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;In the reverse scenario where an activity begins from an non-TPE segment,&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;the following code would be required:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;// Sample main segment of continuation using OrchestrationEventStream.***&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;// Activity in this instance contains: "PO124" &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Microsoft.BizTalk.Bam.EventObservation.OrchestrationEventStream.BeginActivity("PurchaseOrder",&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;ActivityID);&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Microsoft.BizTalk.Bam.EventObservation.OrchestrationEventStream.UpdateActivity("PurchaseOrder",&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;ActivityID, &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;"Column1", Value1,&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;"Column2", Value2);&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;// CONTINUATION LINE HERE: &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Microsoft.BizTalk.Bam.EventObservation.OrchestrationEventStream.EnableContinuation("PurchaseOrder",&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;ActivityID, &lt;span style="COLOR: blue"&gt;"OES2TPE" + ActivityID&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Microsoft.BizTalk.Bam.EventObservation.OrchestrationEventStream.EndActivity("PurchaseOrder",&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;ActivityID);&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;To create the continue-to segment, in your tracking profile, you would need to &lt;span style="COLOR: blue"&gt;add a ContinuationID folder&lt;/span&gt;, name this folder as &lt;span style="COLOR: blue"&gt;"OES2TPE"&lt;/span&gt; and map the relevant item (one that will give you the above &lt;font color=#0000ff&gt;"PO124"&lt;/font&gt; for this particular instance of message.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Deploy* this and drop a message and see the beauty flows :)&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;*&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;You will get a warning that the tracking profile is missing the ContinuationID or Continuation folder, but since we know what we are doing :), just ignore and proceed. &lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;** Note: there is no BeginActivity call since this is a continued-to segment.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="mso-spacerun: yes"&gt;***&lt;/span&gt;The above can easilly be changed to used DirectEventStream or BufferedEventStream. If you do so, make sure you call the Flush method explicity or set the flush threshold to 1 or greater in the constructor.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=527227" width="1" height="1"&gt;</description></item><item><title>DirectEventStream vs BufferedEventStream</title><link>http://blogs.msdn.com/b/keithlim/archive/2006/02/02/522649.aspx</link><pubDate>Thu, 02 Feb 2006 03:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:522649</guid><dc:creator>keithlim</dc:creator><slash:comments>15</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/keithlim/rsscomments.aspx?WeblogPostID=522649</wfw:commentRss><comments>http://blogs.msdn.com/b/keithlim/archive/2006/02/02/522649.aspx#comments</comments><description>&lt;p&gt;Which EventStream to use:&lt;/p&gt;
&lt;p&gt;DirectEventStream (DES) vs BufferedEventStream (BES)&lt;/p&gt;
&lt;p&gt;Use DES when you don't want any latency of data appearing in BAMPrimaryImport database.&amp;nbsp;&amp;nbsp; Since this is synchronous call, any error will be thrown back to the calling application. &lt;/p&gt;
&lt;p&gt;Use BES if your concern is throughput.&amp;nbsp; This is particularly suited for scenarios with spurts of large chuck of events.&amp;nbsp; A small penalty for using this is that there will be small latency between when the event is sent and the event appearing in BAMPrimaryImport database. &lt;/p&gt;
&lt;p&gt;For more info on EventStream: &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/frlrfmicrosoftbiztalkbameventobservationeventstreamclasstopic.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/frlrfmicrosoftbiztalkbameventobservationeventstreamclasstopic.asp&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=522649" width="1" height="1"&gt;</description></item><item><title>How to write BAM Events from pipeline components.</title><link>http://blogs.msdn.com/b/keithlim/archive/2006/01/30/519617.aspx</link><pubDate>Mon, 30 Jan 2006 22:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:519617</guid><dc:creator>keithlim</dc:creator><slash:comments>13</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/keithlim/rsscomments.aspx?WeblogPostID=519617</wfw:commentRss><comments>http://blogs.msdn.com/b/keithlim/archive/2006/01/30/519617.aspx#comments</comments><description>&lt;P&gt;In BizTalk 2004,&amp;nbsp;to write any BAM event from the BizTalk pipeline, you will need to write some code :)&amp;nbsp; To simplify the learning, I will illustrate by adapting an SDK sample.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P&gt;Adapt the SDK CustomComponent (found in .../SDK/Samples/Pipelines/CustomComponent) sample, you will find two directories: &lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;UL type=disc&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;FixMsg - the custom pipeline component (you will need to splice BAM code here)&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;PipelineComponentSample - custom pipeline and will use the above custom pipeline component. &lt;o:p&gt;&lt;/o:p&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Modify the FixMsg to include the below sample (Search for Execute method): &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 0.5in"&gt;public IBaseMessage &lt;B&gt;&lt;SPAN style="COLOR: teal"&gt;Execute&lt;/SPAN&gt;&lt;/B&gt;(IPipelineContext pc, IBaseMessage inmsg) &lt;BR&gt;{ &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 1in"&gt;IBaseMessagePart bodyPart = inmsg.BodyPart; &lt;BR&gt;if (bodyPart!=null) &lt;BR&gt;{ &lt;BR style="mso-special-character: line-break"&gt;&lt;/P&gt;
&lt;P style="MARGIN-LEFT: 1.5in"&gt;... &lt;BR&gt;... &lt;BR&gt;&lt;B&gt;&lt;SPAN style="COLOR: teal"&gt;//Splice BAM Code here: &lt;BR&gt;WriteBAMEvent(pc, "Execute", inmsg);&lt;/SPAN&gt;&lt;/B&gt; &lt;BR style="mso-special-character: line-break"&gt;&lt;BR style="mso-special-character: line-break"&gt;&lt;/P&gt;
&lt;P style="MARGIN-LEFT: 1in"&gt;} &lt;BR&gt;return inmsg; &lt;/P&gt;
&lt;P style="TEXT-INDENT: 0.5in"&gt;} &lt;BR style="mso-special-character: line-break"&gt;&lt;BR style="mso-special-character: line-break"&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: teal"&gt;&lt;BR&gt;// Add a new method to write to BAM &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;private void WriteBAMEvent(IPipelineContext context, string StageDescription, IBaseMessage inmsg) &lt;BR&gt;{ &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 0.5in"&gt;EventStream _BAMEventStr = null; &lt;BR&gt;// Create an EventStream instance &lt;BR&gt;try &lt;BR&gt;{ &lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN-LEFT: 1in"&gt;// Use can use BES/DES or MES &lt;BR&gt;// DES - DirectEventStream - writes direct to BAMPrimaryImport (Synchronous call, no latency) &lt;BR&gt;//_BAMEventStr = new DirectEventStream("Integrated Security=SSPI;Data Source=.;Initial Catalog=BAMPrimaryImport",1); &lt;BR&gt;&lt;BR&gt;// BES - BufferedEventStream - writes to MessageBox (Asynchronous call, no wait in call) &lt;BR&gt;// _BAMEventStr = new BufferedEventStream("Integrated Security=SSPI;Data Source=.;Initial Catalog=BizTalkMsgBoxDb",1); &lt;BR&gt;&lt;BR&gt;&lt;B&gt;&lt;SPAN style="COLOR: teal"&gt;// MES - MessagingEventStream - Async and participates in Pipeline transaction context). &lt;BR&gt;// - Note: Available in BizTalk 2004 with SP1 patch and Biztalk 2006&lt;BR&gt;_BAMEventStr = context.GetEventStream();&lt;/SPAN&gt;&lt;/B&gt; &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 0.5in"&gt;} &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 0.5in"&gt;catch(Exception e) &lt;BR&gt;{&lt;/P&gt;
&lt;P style="MARGIN-LEFT: 1in"&gt;throw (e);&lt;/P&gt;
&lt;P style="MARGIN-LEFT: 0.5in"&gt;} &lt;BR&gt;&lt;BR&gt;// Sample BAM Event Code here: &lt;BR&gt;string ActivityID; &lt;BR&gt;//Create a new, unique activity identifier to use as the ActivityID in BAM &lt;BR&gt;ActivityID="BAM_" + Guid.NewGuid().ToString() + "_" + DateTime.Now + "_" + StageDescription; &lt;BR&gt;&lt;BR&gt;//Start the activity record identified by ActivityID &lt;BR&gt;_BAMEventStr.BeginActivity("PurchaseOrder",ActivityID); &lt;BR&gt;&lt;BR&gt;_BAMEventStr.UpdateActivity("PurchaseOrder",ActivityID, "ProductName","QFE1117"); &lt;BR&gt;&lt;BR&gt;_BAMEventStr.EndActivity("PurchaseOrder",ActivityID); &lt;BR&gt;&lt;BR&gt;// Optional Flush &lt;BR&gt;//_BAMEventStr.Flush(); &lt;/P&gt;
&lt;P&gt;} &lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P&gt;Reference on MessagingEventStream:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdkmref[bts06]/html/M_Microsoft_BizTalk_Component_Interop_IPipelineContext_GetEventStream.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdkmref[bts06]/html/M_Microsoft_BizTalk_Component_Interop_IPipelineContext_GetEventStream.asp&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Reference on EventStream: &lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdkmref[bts06]/html/T_Microsoft_BizTalk_Bam_EventObservation_EventStream.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdkmref[bts06]/html/T_Microsoft_BizTalk_Bam_EventObservation_EventStream.asp&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;To understand the above and details on how to fetch message specific data, please refer to sectio on Developing Pipeline Components in the help or use this link: &lt;BR&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_prog_pipe_qdri.asp" target=_new&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_prog_pipe_qdri.asp&lt;/A&gt; &lt;BR&gt;You would at least need to implement these interfaces. &lt;BR&gt;IBaseComponent, IComponent, IComponentUI. &lt;BR&gt;&lt;BR&gt;The above is tedious and is the only means for writing to BAM in Biztalk 2004. In Biztalk 2006, you can do some of this easily via TPE drag and drop. &lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=519617" width="1" height="1"&gt;</description></item></channel></rss>