<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">Keith Lim's Biztalk BAM Blog</title><subtitle type="html">BizTalk BAM 
TPE 
EventStream
MessagingEventStream
DirectEventStream
BufferedEventStream 
OrchestrationEventStream

</subtitle><id>http://blogs.msdn.com/keithlim/atom.xml</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/keithlim/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/keithlim/atom.xml" /><generator uri="http://communityserver.org" version="2.1.61025.2">Community Server</generator><updated>2005-10-12T02:16:00Z</updated><entry><title>BAM continuation between WF/WCF application and BizTalk application</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/keithlim/archive/2007/07/05/bam-continuation-between-wf-wcf-application-and-biztalk-application.aspx" /><id>http://blogs.msdn.com/keithlim/archive/2007/07/05/bam-continuation-between-wf-wcf-application-and-biztalk-application.aspx</id><published>2007-07-05T22:36:00Z</published><updated>2007-07-05T22:36:00Z</updated><content type="html">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. So I create a ContinuationToken in the WF IC and create a ContinuationID in the Orchestration TPE. However, it does not seem work. The data from WF and the data from Orch are written into two records in the Completed table. My questions are: Is it...(&lt;a href="http://blogs.msdn.com/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;</content><author><name>keithlim</name><uri>http://blogs.msdn.com/members/keithlim.aspx</uri></author></entry><entry><title>Steps to facilitate the creation of WCF Interceptor Configuration file. </title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/keithlim/archive/2007/06/29/steps-to-facilitate-the-creation-of-wcf-interceptor-configuration-file.aspx" /><link rel="enclosure" type="image/jpeg" length="103331" href="http://blogs.msdn.com/keithlim/attachment/3595759.ashx" /><id>http://blogs.msdn.com/keithlim/archive/2007/06/29/steps-to-facilitate-the-creation-of-wcf-interceptor-configuration-file.aspx</id><published>2007-06-29T04:56:00Z</published><updated>2007-06-29T04:56:00Z</updated><content type="html">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 concern. A common scenario is when the WCF application configuration file is updated and the IC is created and deployed, there is not data intercepted and persisted into the BAM PITDB (Primary Import Tables Database). When the event log is checked...(&lt;a href="http://blogs.msdn.com/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;</content><author><name>keithlim</name><uri>http://blogs.msdn.com/members/keithlim.aspx</uri></author><category term="Creating WCF Interceptor Configuration" scheme="http://blogs.msdn.com/keithlim/archive/tags/Creating+WCF+Interceptor+Configuration/default.aspx" /></entry><entry><title>BAM Interceptor for WCF </title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/keithlim/archive/2007/06/29/bam-interceptor-for-wcf.aspx" /><id>http://blogs.msdn.com/keithlim/archive/2007/06/29/bam-interceptor-for-wcf.aspx</id><published>2007-06-29T02:01:00Z</published><updated>2007-06-29T02:01:00Z</updated><content type="html">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://connect.microsoft.com/ In this series of blogs I will again as usual, delve on the BAM side of BizTalk offering and answer any questions from you. In R2, there are two new interceptors added, namely the BAM Interceptor for WCF (Windows Communication...(&lt;a href="http://blogs.msdn.com/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;</content><author><name>keithlim</name><uri>http://blogs.msdn.com/members/keithlim.aspx</uri></author><category term="BAM Interceptor for WCF" scheme="http://blogs.msdn.com/keithlim/archive/tags/BAM+Interceptor+for+WCF/default.aspx" /></entry><entry><title>How to programatically retrieve data from BAMPrimaryImport using supportable API</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/keithlim/archive/2006/03/08/545851.aspx" /><id>http://blogs.msdn.com/keithlim/archive/2006/03/08/545851.aspx</id><published>2006-03-08T04:53:00Z</published><updated>2006-03-08T04:53:00Z</updated><content type="html">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, currently in its 2006 pre-released version, you will find information on the BAMManagementService API. (Under Technical Reference | Developers Reference | BizTalk Server 2006 .Net Class Reference | Microsoft.BizTalk.Bam.Webservices.Management )....(&lt;a href="http://blogs.msdn.com/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;</content><author><name>keithlim</name><uri>http://blogs.msdn.com/members/keithlim.aspx</uri></author></entry><entry><title>Soliciting Biztalk BAM scenarios and issues</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/keithlim/archive/2006/02/10/529028.aspx" /><id>http://blogs.msdn.com/keithlim/archive/2006/02/10/529028.aspx</id><published>2006-02-10T03:32:00Z</published><updated>2006-02-10T03:32:00Z</updated><content type="html">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 tell us what feature you like and dislike. Thanks, Keith...(&lt;a href="http://blogs.msdn.com/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;</content><author><name>keithlim</name><uri>http://blogs.msdn.com/members/keithlim.aspx</uri></author></entry><entry><title>BAM API: Using OrchestrationEventStream</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/keithlim/archive/2006/02/08/528023.aspx" /><id>http://blogs.msdn.com/keithlim/archive/2006/02/08/528023.aspx</id><published>2006-02-09T02:32:00Z</published><updated>2006-02-09T02:32:00Z</updated><content type="html">&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;img src="http://blogs.msdn.com/aggbug.aspx?PostID=528023" width="1" height="1"&gt;</content><author><name>keithlim</name><uri>http://blogs.msdn.com/members/keithlim.aspx</uri></author></entry><entry><title>Sample code to retrieve server and database info of Biztalk MessageBox and PIT </title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/keithlim/archive/2006/02/08/528006.aspx" /><id>http://blogs.msdn.com/keithlim/archive/2006/02/08/528006.aspx</id><published>2006-02-09T02:08:00Z</published><updated>2006-02-09T02:08:00Z</updated><content type="html">&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;img src="http://blogs.msdn.com/aggbug.aspx?PostID=528006" width="1" height="1"&gt;</content><author><name>keithlim</name><uri>http://blogs.msdn.com/members/keithlim.aspx</uri></author></entry><entry><title>Continuation scenarios with mixed of TPE-enabled and non-TPE-Enabled tracking:</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/keithlim/archive/2006/02/08/527227.aspx" /><id>http://blogs.msdn.com/keithlim/archive/2006/02/08/527227.aspx</id><published>2006-02-08T05:43:00Z</published><updated>2006-02-08T05:43:00Z</updated><content type="html">&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;img src="http://blogs.msdn.com/aggbug.aspx?PostID=527227" width="1" height="1"&gt;</content><author><name>keithlim</name><uri>http://blogs.msdn.com/members/keithlim.aspx</uri></author></entry><entry><title>DirectEventStream vs BufferedEventStream</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/keithlim/archive/2006/02/02/522649.aspx" /><id>http://blogs.msdn.com/keithlim/archive/2006/02/02/522649.aspx</id><published>2006-02-02T03:35:00Z</published><updated>2006-02-02T03:35:00Z</updated><content type="html">&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;img src="http://blogs.msdn.com/aggbug.aspx?PostID=522649" width="1" height="1"&gt;</content><author><name>keithlim</name><uri>http://blogs.msdn.com/members/keithlim.aspx</uri></author></entry><entry><title>How to write BAM Events from pipeline components.</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/keithlim/archive/2006/01/30/519617.aspx" /><id>http://blogs.msdn.com/keithlim/archive/2006/01/30/519617.aspx</id><published>2006-01-30T22:44:00Z</published><updated>2006-01-30T22:44:00Z</updated><content type="html">&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;img src="http://blogs.msdn.com/aggbug.aspx?PostID=519617" width="1" height="1"&gt;</content><author><name>keithlim</name><uri>http://blogs.msdn.com/members/keithlim.aspx</uri></author></entry><entry><title>Means to BAM-Tracked “BAMified” Business Process Data:</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/keithlim/archive/2005/10/25/484421.aspx" /><id>http://blogs.msdn.com/keithlim/archive/2005/10/25/484421.aspx</id><published>2005-10-25T05:04:00Z</published><updated>2005-10-25T05:04:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;STRONG&gt;&lt;U&gt;&lt;FONT color=#000000&gt;Means to BAM-Tracked “BAMified” Business Process Data:&lt;/FONT&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;There are several means to enable business process data to be tracked in BAM. In Voyager (BizTalk 2004), programmatically there are the DirectEventStream and BufferedEventStream classes, and non-programmatically there is the Tracking Profile Editor (TPE) drag-and-drop mapping mechanism. &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&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 Pathfinder (BizTalk 2006), both of these areas are further enhanced.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In brief, programmatically, there are the addition of MessagingEventStream and OrchestrationEventStream which are EventStreams that provide transaction consistent processing in the context of Biztalk pipelines and orchestrations respectively. &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 drag-and-drop TPE, in additional to the tracking from orchestrations, tracking can now be done from pipelines as well. &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;STRONG&gt;&lt;U&gt;TPE, a shift from orchestration to activity centric view:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;There is a fundamental shift in tracking profile view; what used to be an orchestration centric view has now changed to an activity centric view.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Data that you want to be tracked thru TPE for a single activity definition must be mapped in a single tracking profile.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;For example, if you have a continuation scenario from one orchestration to orchestration, or a pipeline to an orchestration to a pipeline, all of the information must be presented in one single tracking profile.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;In other words, one tracked activity must have only one tracking profile (*.btt) file. &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;STRONG&gt;&lt;U&gt;So, what are these Continuation and ContinuationID folders?&lt;/U&gt;&lt;/STRONG&gt; &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;A continuation folder is needed for every TPE-enabled tracking that is a source* segment of a continuation.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;(Note: I am saying a source and not a main segment since in a multi- continuation scenario, there would be more than one source segments but only one main segment.) &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;On the other hand, a continuationID folder is needed for every TPE-enabled segment is continued to or the target. &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;Example:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;For a simple scenario where you would continue from Orhestration1 to Orchestration2,&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;employing the non-programmatic mechanism via TPE drag-and-drop, you would need to create a pair of Continuation and ContinuationID folder.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The name of the folder must be the same, a good naming convention would be to go according to what it does such as “Cont_Orch1_2_Orch2”.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You would then need map the content of each of this folder with a schema item from each orchestration that would contain the same data as it passes from one orchestration to another. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;Typically, this piece of data is from the message pay load schema. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;This data must be unique from one instance message to another to avoid data from one activity instance polluting another. &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;You must be curious as to why, such a lengthy explanation.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;This is because there are cases where you would not need Continuation and ContinationID folder in a pair. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;In cases where you want have a mixed of TPE and non-TPE (DES/BES/MES/OES), you would then need to know exactly when to use Continuation and when to use ContinuationID folders. &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;Explain it in another way, if you have TPE continues to non-TPE segment, you would need a Continuation folder, and if you have non-TPE continues to TPE segment, you would need a ContinuationID folder. &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;Now when you do this, what would be the TokenID? &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;To be continue…&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;img src="http://blogs.msdn.com/aggbug.aspx?PostID=484421" width="1" height="1"&gt;</content><author><name>keithlim</name><uri>http://blogs.msdn.com/members/keithlim.aspx</uri></author></entry><entry><title>Biztalk BAM Blogging Introduction </title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/keithlim/archive/2005/10/12/479900.aspx" /><id>http://blogs.msdn.com/keithlim/archive/2005/10/12/479900.aspx</id><published>2005-10-12T04:16:00Z</published><updated>2005-10-12T04:16:00Z</updated><content type="html">&lt;P&gt;As 2005 is coming to a close, I want to take this opportunity to wish you a happy 2006; this also means&amp;nbsp;we are inching closer towards the release of&amp;nbsp;BizTalk 2006 :) &lt;/P&gt;
&lt;P&gt;What is this blog good for...you may ask?&amp;nbsp; This blog is for you the users.&amp;nbsp; :)&amp;nbsp; The topic that&amp;nbsp;it focuses on is BizTalk in general and BizTalk BAM specifically.&amp;nbsp;&amp;nbsp;I will use this as a central depository (referenced from my forum replies) as well as direct replies from which to&amp;nbsp;disseminate insights and personal experience from working&amp;nbsp;with this product on a daily basis.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT style="BACKGROUND-COLOR: #ffffff" color=#000080&gt;You, as the user can help me better help you.&amp;nbsp; Please use the comment (on this posting) to ask for anything you may want me to delve into... of course, this got to be BizTalk and BAM related :)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Happy BAMifying, &lt;/P&gt;
&lt;P&gt;Keith Lim &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=479900" width="1" height="1"&gt;</content><author><name>keithlim</name><uri>http://blogs.msdn.com/members/keithlim.aspx</uri></author></entry></feed>