<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://consultingblogs.emc.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Dave Morris' Blog</title><subtitle type="html" /><id>http://consultingblogs.emc.com/davemorris/atom.aspx</id><link rel="alternate" type="text/html" href="http://consultingblogs.emc.com/davemorris/default.aspx" /><link rel="self" type="application/atom+xml" href="http://consultingblogs.emc.com/davemorris/atom.aspx" /><generator uri="http://communityserver.org" version="2.1.20423.1">Community Server</generator><updated>2005-02-16T14:22:00Z</updated><entry><title>Strange Behaviour of BizTalk 2004 XPath Expressions</title><link rel="alternate" type="text/html" href="http://consultingblogs.emc.com/davemorris/archive/2005/03/08/1122.aspx" /><id>http://consultingblogs.emc.com/davemorris/archive/2005/03/08/1122.aspx</id><published>2005-03-08T09:55:00Z</published><updated>2005-03-08T09:55:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial size=2&gt;I've just been working on a problem with an XPath expression in an orchestration and thought its strangeness warranted a Blog - just to see if anyone else had come across it and to make other people aware of it really.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;What I am trying to do is check the count of a certain child element in a message for zero and not to perform a send operation if it is zero.&amp;nbsp; Sounds simple and here is the Boolean expression from my decide shape:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face=Arial size=2&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;xpath(msg, "count(/*[local-name()='root']/*[local-name()='child'])")) != "0"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;(Note I've abbreviated the XPath here before anyone says it's wrong - it is definitely right.)&lt;/P&gt;
&lt;P&gt;That expression always evaluated to true.&amp;nbsp; I even dumped out the result of the XPath as debug information to check and it was 0.&lt;/P&gt;
&lt;P&gt;Confused, I changed the expression as follows:&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;System.Convert.ToInt32(xpath(msg, "count(/*[local-name()='root']/*[local-name()='child'])"))) != 0&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Basically convert the XPath result to an integer and check its value against numeric zero rather than a string of zero.&amp;nbsp; This works perfectly.&lt;/P&gt;
&lt;P&gt;If anyone can explain this strange behaviour I'd appreciate it.&amp;nbsp; If not at least its one for everyone else to be aware of.&lt;/P&gt;
&lt;P&gt;Oh and I do have SP1 installed before anyone asks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;img src="http://consultingblogs.emc.com/aggbug.aspx?PostID=1122" width="1" height="1"&gt;</content><author><name>dave.morris</name><uri>http://consultingblogs.emc.com/members/dave.morris.aspx</uri></author></entry><entry><title>Scalar User Defined Functions and Computed Columns</title><link rel="alternate" type="text/html" href="http://consultingblogs.emc.com/davemorris/archive/2005/03/07/1119.aspx" /><id>http://consultingblogs.emc.com/davemorris/archive/2005/03/07/1119.aspx</id><published>2005-03-07T15:40:00Z</published><updated>2005-03-07T15:40:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial size=2&gt;Came across an interesting SQL problem&amp;nbsp;where&amp;nbsp;a customer&amp;nbsp;has a table with a&amp;nbsp;primary key&amp;nbsp;and&amp;nbsp;X numerical fields.&amp;nbsp; For each record the maximum value in these&amp;nbsp;X fields was needed. &lt;/FONT&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;FONT face=Arial size=2&gt;The issue was how to accomplish this efficiently?&amp;nbsp; Or more accurately the least inefficient way of doing it is.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Arial size=2&gt;One option suggested was to have to UNION the table with itself&amp;nbsp;X times and then do a MAX aggregation since there was&amp;nbsp;a lot of data.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Arial size=2&gt;The more interesting option, which it turns out not many people are aware of, is to use a Scalar User Defined Function (UDF) to calculate the maximum value.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Arial size=2&gt;Here's an example of this in action:&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;PRE&gt;&lt;CODE&gt;CREATE FUNCTION CubicVolume
-- Input dimensions in centimeters
   (@CubeLength decimal(4,1), @CubeWidth decimal(4,1),
    @CubeHeight decimal(4,1) )
RETURNS decimal(12,3) -- Cubic Centimeters.
AS
BEGIN
   RETURN ( @CubeLength * @CubeWidth * @CubeHeight )
END
&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;CREATE TABLE Bricks
   (
    BrickPartNmbr   int PRIMARY KEY,
    BrickColor      nchar(20),
    BrickHeight     decimal(4,1),
    BrickLength     decimal(4,1),
    BrickWidth      decimal(4,1),
    BrickVolume AS
              (
               dbo.CubicVolume(BrickHeight,
                         BrickLength, BrickWidth)
              )
   )
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Arial size=2&gt;Basically the scalar UDF is called for each row returned from a SELECT.&amp;nbsp; The column itself is not actually stored in the SQL Server table.&amp;nbsp; Any INSERT and UPDATE on the table do not calculate the value for the computed column.&amp;nbsp; Now obviously this is an overhead that may not be acceptable if the table is very static and read a lot.&amp;nbsp; Here, it may be more efficient to perform the calculation once on INSERT or UPDATE of the table with INSTEAD OF triggers or another similar method.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;img src="http://consultingblogs.emc.com/aggbug.aspx?PostID=1119" width="1" height="1"&gt;</content><author><name>dave.morris</name><uri>http://consultingblogs.emc.com/members/dave.morris.aspx</uri></author></entry><entry><title>WFA and BizTalk 2004</title><link rel="alternate" type="text/html" href="http://consultingblogs.emc.com/davemorris/archive/2005/03/04/1115.aspx" /><id>http://consultingblogs.emc.com/davemorris/archive/2005/03/04/1115.aspx</id><published>2005-03-04T15:03:00Z</published><updated>2005-03-04T15:03:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial size=2&gt;It's well documented by many observers (and readily admitted by Microsoft) that Human Workflow Services (HWS) within BizTalk 2004 is not really up to the job for anything other than the most simple Workflow Automation (WFA) scenarios.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Looking at the roadmap for the Microsoft product set going forward:&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;There is nothing new for HWS in BizTalk 2006.&amp;nbsp;&amp;nbsp;&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Then there is the muted introduction of a common orchestration platform (WinOE) for all Microsoft product beyond that.&amp;nbsp; &lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;It's easy to get confused about what is the right choice for a WFA solution on a Microsoft platform.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Once the scenario gets beyond HWS then this does not mean that BizTalk is not the right product for the WFA solution.&amp;nbsp; In fact it will always likely be the most appropriate choice as it is increasingly rare for any WFA solution not to include a good deal or EAI too.&amp;nbsp; See my previous &lt;A href="http://blogs.conchango.com/davemorris/archive/2005/02/28/1083.aspx"&gt;post on BPM&lt;/A&gt; for a more in depth discussion of these topics.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;So given all the confusion what is the best route forward?&amp;nbsp; Adoption of a workflow product to sit alongside and closely integrate with BizTalk is the route.&amp;nbsp; There are several product choices for this but the main players are:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;1) K2.Net (&lt;A href="http://www.k2workflow.com"&gt;www.k2workflow.com&lt;/A&gt;) &lt;BR&gt;2) Teamplate (&lt;A href="http://www.captaris.com"&gt;www.captaris.com&lt;/A&gt;) &lt;BR&gt;3) Ultimus (&lt;A href="http://www.ultimus.com"&gt;www.ultimus.com&lt;/A&gt;)&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The one I am going to consider in more depth is K2 - to start with all I'm going to highlight is some of the key Microsoft specific points&amp;nbsp;around K2:&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;There is very close coupling with the whole Microsoft product suite - BizTalk obviously Active Directory, Office (including) InfoPath, SharePoint, Exchange, Outlook, Content Management Server, and even MSN Messenger.&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;The BizTalk integration is very close.&amp;nbsp; K2 even uses BizTalk's Business Rules Engine for it's own rules management.&amp;nbsp; It &lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;leverages BizTalk's BAM.&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;K2 workflows can trigger and be triggered by BizTalk orchestrations.&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;The development environment integrates with Visual Studio.NET (supporting both C# and VB.NET) and ASP.NET. &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;A lot of the code needed is generated code as .NET code.&amp;nbsp;&amp;nbsp;This&amp;nbsp;and allows things like integration of an InfoPath form or SharePoint site into a workflow calling BizTalk orchestrations - all without writing any code &lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Obviously like all WFA solutions K2 provides:&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Management of assignment of&amp;nbsp;tasks to people&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Exceptions processing&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Escalating of tasks based on business rules and / or schedule&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Managing task queues for individuals and groups&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Load balancing and optimizing task distribution&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Service level management. &lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;K2 also offers monitoring, tracking, and auditing of workflows and reporting on performance and quality of work.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Going forward in coming posts I want to look at some real life scenarios and development / deployment areas around solutions using K2.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://consultingblogs.emc.com/aggbug.aspx?PostID=1115" width="1" height="1"&gt;</content><author><name>dave.morris</name><uri>http://consultingblogs.emc.com/members/dave.morris.aspx</uri></author></entry><entry><title>BPM - EAI and WFA</title><link rel="alternate" type="text/html" href="http://consultingblogs.emc.com/davemorris/archive/2005/02/28/1083.aspx" /><id>http://consultingblogs.emc.com/davemorris/archive/2005/02/28/1083.aspx</id><published>2005-02-28T17:14:00Z</published><updated>2005-02-28T17:14:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial size=2&gt;The whole Business Process Management (BPM) is a confusing space with many different packages performing many different aspects of a typical solutions requirements.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;It is easy to split the BPM space into 2 distinct categories, each of which is converging:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Firstly we have Enterprise Application Integration (EAI) which takes an application centric (system-to-system) view of the world.&amp;nbsp; Secondly there is Workflow Automation (WFA) which takes a people centric (people-to-people) view of the world.&amp;nbsp; If we take any typical products in each of these spaces then there is a massive overlap between the two.&amp;nbsp; And further, a&amp;nbsp;typical BPM solution will encompass both EAI and WFA.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;On the surface both a very similar, each providing the automation and management of business processes.&amp;nbsp; Given that typically people will lump EAI and WFA products together into the single umbrella category of BPM.&amp;nbsp; Taking this high-level view can cause a great deal of confusion and often lead to poor implementation choices.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;As soon as we start to analyse things closer, we start to see significant differences between the requirements for EAI and WFA:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face=Arial size=2&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;STRONG&gt;Speed:&lt;/STRONG&gt;&amp;nbsp; An EAI system has to perform tasks at machine speed since it caters for system-to-system processes.&amp;nbsp; When moving information between systems or applications, speed and high volume processing are often a key requirement.&amp;nbsp; Once we start dealing with the people centric world of WFA, speed remains important but is no longer a key consideration.&amp;nbsp; With a workflow environment, transfer of tasks from one person to another could take many minutes or hours so the fact the WFA environments does not perform it in a fraction of a second is not an issue.&lt;BR&gt;
&lt;LI&gt;&lt;STRONG&gt;Number of Participants:&lt;/STRONG&gt;&amp;nbsp; There is always a limited number of enterprise applications that need to be involved in a process, this is typically around the half dozen make unless something is massively disfunctional within an organisation.&amp;nbsp; An EAI solution only has to deal with this limited number of participants, each of which performs static operations - by this we mean that the roles these applications play are well defined and change infrequently.&amp;nbsp; A WFA environment however may need to cater for a large number of participants both within and outside the organisation.&amp;nbsp; A typical WFA solution can include anywhere between 100 and 2000 users.&amp;nbsp; These users have different roles and responsibilities, all of which are in a constant state of change.&lt;BR&gt;
&lt;LI&gt;&lt;STRONG&gt;Handling Exceptions:&lt;/STRONG&gt;&amp;nbsp; WFA solutions have to handle large numbers of exceptions - people take time off, get reassigned, want to discuss tasks with someone else before performing them, or may want to delegate a task to someone else.&amp;nbsp; The WFA environment must be able to cope with all of these and any other exception conditions that may occur.&amp;nbsp; An EAI environment though does not deal with many exceptions because the application centric environment does not pose the problems of a people centric world.&amp;nbsp; In an EAI solution, exceptions are driven by system and data failures and are relatively easy to trap and handle.&lt;BR&gt;
&lt;LI&gt;&lt;STRONG&gt;Business Rules:&lt;/STRONG&gt;&amp;nbsp; Within an EAI environment, business rules are data driven and can typically be handled programmatically.&amp;nbsp; These data driven rules have the addtion of relationship based rules layered on top of them for a WFA solution.&amp;nbsp; These are inherently more complex (especially as the size of the organisation and complexity of the relationships grows).&lt;BR&gt;
&lt;LI&gt;&lt;STRONG&gt;User Interface:&lt;/STRONG&gt;&amp;nbsp; An EAI solution has no user interface requirement since it is responsible for the exchange of data between enterprise applications.&amp;nbsp; In contrast, user interface is the most complex requirements of WFA - it must provide a flexible user interface with dynamic forms and document management.&lt;BR&gt;
&lt;LI&gt;&lt;STRONG&gt;Data Transformation and Mapping:&lt;/STRONG&gt;&amp;nbsp; This is key to EAI solutions and the requirement for sophisticated data transformation and mapping capabilities is paramount.&amp;nbsp; Each application within the enterprise typically saves data in its own format, thus the EAI environment must be capable of mapping information from one application to another.&amp;nbsp; WFA has only limited data transformation and mapping requirements since it deals primarily with people centric situations.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Given all of this, it becomes clear why two distinct categories exist and typically products are optimised to perform one or the other.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;BPM is converging though&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;While requirements for EAI and WFA are different, market requirements have produced an encompassing category - Business Process Management.&amp;nbsp; So what is driving this convergence?&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;STRONG&gt;Business Processes are heterogeneous&lt;/STRONG&gt;&lt;BR&gt;&lt;BR&gt;More and more EAI processes are involving humans - whether to handle exceptions or provide human knowledge / judgement, people are being used in a optimised way.&amp;nbsp; Similarly, many people centric solutions are being extended to incorporate enterprise applications to allow processes to be streamlined.&lt;BR&gt;
&lt;LI&gt;&lt;STRONG&gt;Web Services make integration simpler&lt;/STRONG&gt;&lt;BR&gt;&lt;BR&gt;Although there will always be a need for specialist, high-performance&amp;nbsp;integration environments that EAI will cater for, the introduction of web services has lowered this barrier significantly.&amp;nbsp; The use of a standard mechanism for performing typical integration tasks has dramatically reduced the cost of integration.&lt;BR&gt;
&lt;LI&gt;&lt;STRONG&gt;BPM must span multiple&amp;nbsp;Enterprise Applications&lt;/STRONG&gt;&lt;BR&gt;&lt;BR&gt;Many enterprise applications provide embedded workflow management within the ERP or CRM environment.&amp;nbsp; However, this route was limited since typically there are multiple enterprise applications and business processes span across these.&amp;nbsp; The requirement for an external BPM / workflow environment was necessary.&lt;BR&gt;
&lt;LI&gt;&lt;STRONG&gt;Organisations are building BPM platforms&lt;/STRONG&gt;&lt;BR&gt;&lt;BR&gt;Becuase of the drivers for BPM to span the enterprise, many organisations are building a platform that includes EAI and WFA capabilities.&amp;nbsp; This platform typically includes all the server components and design tools for building any BPM applications, and also the tools to operationally manage the lifecycle of business processes.&amp;nbsp; These BPM platforms typically include the following:&lt;/LI&gt;&lt;/OL&gt;
&lt;UL&gt;
&lt;UL&gt;
&lt;LI&gt;Business Process Tools 
&lt;LI&gt;Resource Management Tools 
&lt;LI&gt;IT Developer Tools 
&lt;LI&gt;Collaboration Tools 
&lt;LI&gt;Repository 
&lt;LI&gt;Administration Tools 
&lt;LI&gt;Business Activity Monitoring 
&lt;LI&gt;Workflow Engine 
&lt;LI&gt;EAI Engine 
&lt;LI&gt;Clients / User Interface / Forms 
&lt;LI&gt;Web Services&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://consultingblogs.emc.com/aggbug.aspx?PostID=1083" width="1" height="1"&gt;</content><author><name>dave.morris</name><uri>http://consultingblogs.emc.com/members/dave.morris.aspx</uri></author></entry><entry><title>Using BizTalk Pipelines to Split Records</title><link rel="alternate" type="text/html" href="http://consultingblogs.emc.com/davemorris/archive/2005/02/21/1039.aspx" /><id>http://consultingblogs.emc.com/davemorris/archive/2005/02/21/1039.aspx</id><published>2005-02-21T16:24:00Z</published><updated>2005-02-21T16:24:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial size=2&gt;I've been looking into issues caused by using BizTalk disassembler pipeline components to split out records in a large flat file for processing in a project I am currently working on and have seen some interesting issues with it.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Technically this is a very easy thing to do and both the XML and Flat File&amp;nbsp;disassembler components can be&amp;nbsp;easily&amp;nbsp;used to publish multiple messages into the Message Box from a single input document.&amp;nbsp; There is a very good discussion of how this is achieved technically on &lt;A href="http://blogs.msdn.com/scottwoo/archive/2004/02/06/68694.aspx"&gt;Scott Woodgate's Blog&lt;/A&gt;.&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;This is a very easy and consequently very tempting way of processing through records from an input file.&amp;nbsp; For example, each line of the file is published as a separate message and processed individually by its own orchestration instance.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;So why Blog about this then?&amp;nbsp; Well what I'm really interested in here is the gotchas around doing this, particularly once the inputs start to get relatively big.&amp;nbsp; All worth thinking about, but not obvious when you initially look at using this sort of processing.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;On the project I am working on, the input file contains over 300,000 records and each is published as a seperate message and each is processed by a separate orchestration.&amp;nbsp; This particular piece of processing was implemented on a previous phase of the project and has suddenly become an issue, although the volumes involved have not actually changed.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Where the issues occur are at the SQL Server level and concurrency with other processing at the same time - particularly that requiring relatively low latency.&amp;nbsp; When the file is picked up, it is processed into the Message Box as a single transaction - rightly so since we do not want some of the records being published and others not.&amp;nbsp; Obviously this is a very large transaction and uses up a lot of SQL Server resources while it is happening.&amp;nbsp; The TLOG grows significantly and there is blocking of other processing occurring too.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Looking at the application server running the pipeline, it also saw a lot of&amp;nbsp;resource&amp;nbsp;issues, with it&amp;nbsp;CPU pegged at 100% for some time (over an hour).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Both these resource issues cause other processing to slow down and even fail.&amp;nbsp; Interestingly, once all the records are published, the 300,000 odd orchestrations process through without any real issue.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;There are plenty of patterns around for how to process high-volumes in BizTalk so I am not going to go on about it here.&amp;nbsp; For those who are interested, we now BCP the file into a database table and work through those in "manageable" batches using BizTalk and the SQL adapter.&amp;nbsp; Both the application and database servers are now very happy!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://consultingblogs.emc.com/aggbug.aspx?PostID=1039" width="1" height="1"&gt;</content><author><name>dave.morris</name><uri>http://consultingblogs.emc.com/members/dave.morris.aspx</uri></author></entry><entry><title>BizTalk Time-Based Batching</title><link rel="alternate" type="text/html" href="http://consultingblogs.emc.com/davemorris/archive/2005/02/16/1022.aspx" /><id>http://consultingblogs.emc.com/davemorris/archive/2005/02/16/1022.aspx</id><published>2005-02-16T15:04:00Z</published><updated>2005-02-16T15:04:00Z</updated><content type="html">&lt;FONT face=Arial size=2&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Think I'm going to start to get a reputation for going on about the same sort of thing all the time - hey it's been the bugging me for weeks so I'm going to tell everyone all about it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;There is a scenario I've been working on recently where IDOC's generated by an SAP system need to be batch together to form a single output flat file for an AS400 system.  If you want more information about integrating BizTalk 2004 with SAP, see my colleague &lt;A href="http://blogs.conchango.com/tamershaaban/archive/2005/01/24/873.aspx"&gt;Tamer Shaaban's blog&lt;/A&gt; on the subject.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;The issue here was how multiple IDOC's from SAP were correlated.&lt;SPAN style="mso-spacerun: yes"&gt;  &lt;/SPAN&gt;The correlation was simply IDOC&amp;#8217;s of a particular type within a given time window, e.g. all &amp;#8220;delivery&amp;#8221; IDOC&amp;#8217;s within a 10 minute window of the first one received should go in the same batch file.&lt;SPAN style="mso-spacerun: yes"&gt;  &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;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Easy really, correlate on the message type and use a sequential convoy to group them, in a loop until the time window completes.&lt;SPAN style="mso-spacerun: yes"&gt;  &lt;/SPAN&gt;This is ok and works most of the time but has a couple of issues that would make it hard to support:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN-LEFT: 54pt; TEXT-INDENT: -36pt; mso-list: l0 level1 lfo1; tab-stops: list 54.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-fareast-font-family: Arial"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1)&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;                   &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;If a single IDOC processing fails for some reason, the whole batch processing fails.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN-LEFT: 54pt; TEXT-INDENT: -36pt; mso-list: l0 level1 lfo1; tab-stops: list 54.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-fareast-font-family: Arial"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2)&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;                   &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;There is always a processing window (albeit small) where messages can be discarded (zombies).&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;The latter of these isn&amp;#8217;t that obvious but while the orchestration instance is running, all IDOC&amp;#8217;s of that type will be correlated to that instance, even once it has finished receiving and is heading towards its exit point.&lt;SPAN style="mso-spacerun: yes"&gt;  &lt;/SPAN&gt;The issue is you cannot &amp;#8220;turn-off&amp;#8221; a correlation set once you have received all messages you need into an instance of an orchestration.&lt;SPAN style="mso-spacerun: yes"&gt;  &lt;/SPAN&gt;Normally this would not be an issue as the number of correlated messages being received is a determinate number.&lt;SPAN style="mso-spacerun: yes"&gt;  &lt;/SPAN&gt;However, in this time-based scenario, the number of messages is totally indeterminate and there is no guarantee that after the last receive shape completes more messages won&amp;#8217;t arrive and be correlated to the orchestration instance.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;The solution to this to make the batch size determinate so that correlation is on a know number of messages and there cannot ever be zombies created.&lt;SPAN style="mso-spacerun: yes"&gt;  &lt;/SPAN&gt;Also by splitting the processing into 2 phases (a pre-process and a batch-process), processing failures for individual IDOC&amp;#8217;s can be isolated from the batch.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;The following diagram shows the basic pattern for this processing:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/SPAN&gt;&lt;IMG src="/davemorris/files/timebatch.JPG"&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;The key to this is the &amp;#8220;repository&amp;#8221; in the middle.&lt;SPAN style="mso-spacerun: yes"&gt;  &lt;/SPAN&gt;This is there purely for assigning each message received into a batch and determining when a batch completes (and consequently its size).&lt;SPAN style="mso-spacerun: yes"&gt;  &lt;/SPAN&gt;By using this mechanism we are now determinate in our batch processing and can guarantee no zombies.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;/FONT&gt; &lt;/P&gt;&lt;img src="http://consultingblogs.emc.com/aggbug.aspx?PostID=1022" width="1" height="1"&gt;</content><author><name>dave.morris</name><uri>http://consultingblogs.emc.com/members/dave.morris.aspx</uri></author></entry><entry><title>Zombies and Convoys</title><link rel="alternate" type="text/html" href="http://consultingblogs.emc.com/davemorris/archive/2005/02/16/1020.aspx" /><id>http://consultingblogs.emc.com/davemorris/archive/2005/02/16/1020.aspx</id><published>2005-02-16T14:22:00Z</published><updated>2005-02-16T14:22:00Z</updated><content type="html">&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;Just so you know, because I wouldn't want to lead anyone on,&amp;nbsp;I&amp;#8217;m talking BizTalk 2004 here and not the somewhat dodgy 1980&amp;#8217;s horror film by Jesus Franco, &lt;/FONT&gt;&lt;A href="http://www.allthingszombie.com/movies/oasisofzombies.php"&gt;&lt;FONT face=Arial size=2&gt;Oasis of the Zombies&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;I&amp;#8217;ve recently spent some time looking into a Singleton pattern for orchestrations to apply to the current project I am working on.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Basically we have a lot of interfaces that are scheduled in particular time slots but can only run once and must act as singletons.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;This sounds initially very easy to do with a sequential convoy but is prone to zombies &amp;#8211; i.e. the orchestration completes with discarded messages.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;This occurs when messages that are part of the convoy set are queued for the orchestration but not consumed by it.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;The topic of zombies itself is much wider than this narrow scenario I am looking at here but there are some very good details on the subject in the &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/biztalk_core_engine/archive/2004/06/30/169430.aspx"&gt;&lt;FONT face=Arial size=2&gt;BizTalk Core Engine&amp;#8217;s WebLog&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;Since the length of processing time for any particular singleton is indeterminate the challenge has been to make sure all messages are consumed in every case.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Take the following example:&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;An interface is &amp;#8220;kicked off&amp;#8221; by its schedule every 15 minutes and its typical processing is within one minute so it&amp;#8217;s never likely to receive multiple &amp;#8220;kick off&amp;#8221; messages in a single instance.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;However, at month end, the volume is much higher and it can take as much as 4 hours to process, maybe a bit longer, maybe a bit shorter.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Here all subsequent &amp;#8220;kick off&amp;#8221; messages need to be consumed while it is running to stop multiple instances from running.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;Here&amp;#8217;s the basic solution that uses a parallel action in its processing, one branch consuming convoy messages and the other performing the singleton&amp;#8217;s processing.&lt;/FONT&gt; &lt;/SPAN&gt;
&lt;P&gt;&lt;SPAN&gt;
&lt;P&gt;&lt;IMG src="/davemorris/files/singleton.jpg" width=700&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&lt; SPAN&gt;&lt;/P&gt;&lt;SPAN&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt; 
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;It looks pretty complicated but is actually very straightforward and involves synchronised scopes and a completed flag.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;The processing branch sets a flag to say it is finished and the next time the receive branch times out it spots this and breaks out of its loop.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;Why synchronised scopes?&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Basically this is needed to allow parallel branches to update the same variables without trampling all over each other - it makes the orchestration thread safe.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;The BizTalk development environment is good enough to not allow you to be unsafe and if you try and use the same variable in multiple branches you will get a build error.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Essentially it serialises access to the data.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;So why shout about something so simple?&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Well there are a few gotchas here.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;First of all by only checking for completion in a timeout situation, you are guaranteeing not to leave zombies if there are several queued up &amp;#8211; obviously your timeout needs to be much shorted than the scheduling frequency.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Here I&amp;#8217;ve got a 10 second timeout with a likely scheduling frequency of around 15 minutes.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;This is a race condition but by being sensible about the timeout versus schedule frequency, it should never have an effect on the processing.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;Next is the use of two variables, one for the loop condition and one for the finished state.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;This is so the size of the synchronised scope in the receive branch can be as small as possible to limit the locking of the variables.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;If only one variable is used, this means that a scope is needed around the entire loop.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;The problem this causes is that is locks the loop condition variable so the processing branch cannot set it.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Essentially everything deadlocks. &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;Also be aware of the scopes themselves.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Here I&amp;#8217;ve only got 2, one for checking the finished state and one for processing.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Both are non-transactional.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;However, if they are transactional, then their locking of variables is moved out to the scope level rather than the individual shape level and again we can block.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;The checking blocks until the main processing scope completes.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;It then immediately sees the finished state set true and falls out the loop.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Since its been blocking on the check, there may well be queued messages for the orchestration that it has not consumed &amp;#8211; zombies again.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;I have a scenario where the main processing is in a transaction where the setting of the finished flag has been moved out into its own non-transactional scope after the main processing scope.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;The last issue I saw was quite unexpected and occurred only because I was being overly anal about my testing for some reason &amp;#8211; must have been bored!&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;If you leave the orchestration stopped but enlisted and queue up messages for it everything looks just fine.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;However once you start up, the instance always completes with discarded messages.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;The first message submitted is always received twice &amp;#8211; once to activate the instance and then again as the first correlated message.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;After a bit of head scratching it was straight onto Microsoft support since this is a blatant bug, although one we are unlikely to hit in this particular scenario.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;It is the case for any sequential convoy though.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Here all subsequent messages are just swallowed to prevent further processing but imagine if you were actually processing them and adding up data!&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;There will be a fix available for this soon - once it has been verified.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Be aware it has not made it into SP1 though.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;(See my colleague Matt Hall&amp;#8217;s Blog on the &lt;/FONT&gt;&lt;A href="http://blogs.conchango.com/matthall/archive/2005/01/18/841.aspx"&gt;&lt;FONT face=Arial size=2&gt;Contents of SP1&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;.)&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;I&amp;#8217;ve packaged up the sample solution that can be downloaded from &lt;A href="http://blogs.conchango.com/davemorris/files/Singleton.zip"&gt;here&lt;/A&gt;.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;img src="http://consultingblogs.emc.com/aggbug.aspx?PostID=1020" width="1" height="1"&gt;</content><author><name>dave.morris</name><uri>http://consultingblogs.emc.com/members/dave.morris.aspx</uri></author></entry></feed>
