<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Udi Dahan - The Software Simplist &#187; EDA</title>
	<atom:link href="http://www.udidahan.com/category/eda/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.udidahan.com</link>
	<description>Enterprise Development Expert &#38; SOA Specialist</description>
	<lastBuildDate>Tue, 31 Aug 2010 09:56:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Search and Messaging</title>
		<link>http://www.udidahan.com/2009/11/01/search-and-messaging/</link>
		<comments>http://www.udidahan.com/2009/11/01/search-and-messaging/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 05:33:35 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Caching]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=1134</guid>
		<description><![CDATA[
One question that I get asked about quite a bit with relation to messaging is about search. Isn&#8217;t search inherently request/response? Doesn&#8217;t it have to return immediately? Wouldn&#8217;t messaging in this case hurt our performance?
While I tend to put search in the query camp in the when keeping the responsibility of commands and queries separate, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.udidahan.com/wp-content/uploads/search.png" width="200" height="204" style="float:right; margin-left:10px; margin-bottom:10px;" alt="search" title="search" /><br />
One question that I get asked about quite a bit with relation to messaging is about search. Isn&#8217;t search inherently request/response? Doesn&#8217;t it have to return immediately? Wouldn&#8217;t messaging in this case hurt our performance?</p>
<p>While I tend to put search in the query camp in the when keeping the responsibility of commands and queries separate, and often recommend that those queries be done without messaging, there are certain types of search where messaging does make sense.</p>
<p>In this post, I&#8217;ll describe certain properties of the problem domain that make messaging a good candidate for a solution.</p>
<h3>Searching is besides the point &#8211; Finding is what it&#8217;s all about</h3>
<p>Remember that search is only a means to an end in the eyes of the user &#8211; they want to find something. One of the difficulties we users have is expressing what we want to find in ways that machines can understand.</p>
<p>In thinking about how we build systems to interact with users, we need to take this fuzziness into account. The more data that we have, the less homogeneous it is, the harder this problem becomes.</p>
<p>When talking about speed, while users are sensitive to the technical interactivity, the thing that matters most is the total time it takes for them to find what they want. If the result of each search screen pops up in 100ms, but the user hasn&#8217;t found what they&#8217;re looking for after clicking through 20 screens, the search function is ultimately broken.</p>
<p>Notice that the finding process isn&#8217;t perceived as &#8220;immediate&#8221; in the eyes of the user &#8211; the evaluation they do in their heads of the search results is as much a part of finding as the search itself.</p>
<p>Also, if the user needs to refine their search terms in order to find what they want, we&#8217;re now talking about a multi-request/multi-response process. There is nothing in the problem domain which indicates that finding is inherently request/response.</p>
<h3>Relationships in the data</h3>
<p>When bringing back data as the result of a search, what we&#8217;re saying is that there is a property which is the same across the result elements. But there may be more than one such property. For example, if we search for &#8220;blue&#8221; on Google Images, we get back pictures of the sky, birds, flowers, and more. Obvious so far &#8211; but let&#8217;s exploit the obvious a bit.</p>
<p>When the user sees that too many irrelevant results come back, they&#8217;ll want to refine their search. One way they can do that is to perform a new search and put in a more specific search phrase &#8211; like &#8220;blue sky&#8221;. Another way is for them to indicate this is by selecting an image and saying &#8220;not like this&#8221; or &#8220;more of these&#8221;. Then we can use the additional properties we know about those images to further refine the result group &#8211; either adding more images of one kind, or removing images of another.</p>
<p>Here&#8217;s something else that&#8217;s obvious:</p>
<p>Users often click or change their search before the entire result screen is shown. </p>
<p>It&#8217;s beginning to sound like users are already interacting with search in an asynchronous manner. What if we actually designed a system that played to that kind of interaction model?</p>
<h3>Data-space partitioning</h3>
<p>Once we accept the fact that the user is willing to have more results appear in increments, we can talk about having multiple servers processing the search in parallel. For large data spaces, it is unlikely for us to be able to store all the required meta data for search on one server anyway.</p>
<p>All we really need is a way to index these independent result-sets so that the user can access them. This can be done simply by allocating a GUID/UUID for the search request and storing the result-sets along with that ID.</p>
<h3>Browser interaction</h3>
<p>When the browser calls a server with the search request the first time, that server allocates an ID to that request, returns a URL containing that ID to the browser, and publishes an event containing the search term and the ID. Each of our processing nodes is subscribed to that event, performs the search on its part of the data-space, and writes its results (likely to a distributed cache) along with that ID. </p>
<p>The browser polls the above URL, which queries the cache (give me everything with this ID), and the browser sees which resources have been added since the last time it polled, and shows them to the user.</p>
<p>If the user clicks &#8220;more of these&#8221;, that initiates a new search request to the server, which follows the same pattern as before, just that the system is able to pull more relevant information. When implementing &#8220;not like this&#8221;, this performs a similar search but, instead of adding to the list of items shown, we&#8217;re removing items from the list shown based on the response from the server.</p>
<p>In this kind of user-system interaction model, having the user page through the result set doesn&#8217;t make very much sense as we&#8217;re not capturing the intent of the user, which is &#8220;you&#8217;re not showing me what I want&#8221;. By making it easy for the user to fine tune the result set, we get them closer to finding what they want. By performing work in parallel in a non-blocking manner on smaller sets of data, we greatly decrease the &#8220;time to first byte&#8221; as well as the time when the user can refine their search.</p>
<h3>But Google doesn&#8217;t work like that</h3>
<p>I know that this isn&#8217;t like the search UI we&#8217;ve all grown used to.</p>
<p>But then again, the search that you&#8217;re providing your users is more specific &#8211; not just pages on the web. If you&#8217;re a retailer allowing your users to search for a gift, this kind of &#8220;more like this, less like that&#8221; model is how users would interact with a real sales-person when shopping in a store. Why not model your system after the ways that people behave in the real world?</p>
<h3>In closing</h3>
<p>If we were to try to make use of messaging underneath &#8220;classical&#8221; search interaction models, it probably wouldn&#8217;t have been the greatest fit. If all we&#8217;re doing at a logical level is blocking RPC, then messaging would probably make the system slower. The real power that you get from messaging is being able to technically do things in parallel &#8211; that&#8217;s how it makes things faster. If you can find ways to see that parallelism in your problem domain, not only will messaging make sense technically &#8211; it will really be the only way to build that kind of system.</p>
<p>Learning how to disconnect from seeing the world through the RPC-tinted glasses of our technical past takes time. Focusing on the problem domain, seeing it from the user&#8217;s perspective without any technical constraints &#8211; that&#8217;s the key to finding elegant solutions. More often than not, you&#8217;ll see that the real world is non-blocking and parallel, and then you&#8217;ll be able to make the best use of messaging and other related patterns.</p>
<p>What are your thought? Post a comment and let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2009/11/01/search-and-messaging/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>[Article] EDA: SOA through the looking glass</title>
		<link>http://www.udidahan.com/2009/09/29/article-eda-soa-through-the-looking-glass/</link>
		<comments>http://www.udidahan.com/2009/09/29/article-eda-soa-through-the-looking-glass/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 11:05:33 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Articles]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=1117</guid>
		<description><![CDATA[

My latest article has been published in issue 21 of the Microsoft Architecture Journal:
EDA: SOA Through The Looking Glass

While event-driven architecture (EDA) is a broadly known topic, both giving up ACID integrity guarantees and introducing eventual consistency make many architects uncomfortable. Yet it is exactly these properties that can direct architectural efforts toward identifying coarsely [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://msdn.microsoft.com/en-us/architecture/aa699424.aspx"><br />
<img src="http://www.udidahan.com/wp-content/uploads/arcjournal21.png" style="float:right; margin-left:20px; margin-bottom:10px; border:1px solid black" alt="Microsoft Architecture Journal" title="Microsoft Architecture Journal" /></a></p>
<p>My latest article has been published in issue 21 of the Microsoft Architecture Journal:</p>
<p><u>EDA: SOA Through The Looking Glass</u></p>
<div style="font-size:12px">
While event-driven architecture (EDA) is a broadly known topic, both giving up ACID integrity guarantees and introducing eventual consistency make many architects uncomfortable. Yet it is exactly these properties that can direct architectural efforts toward identifying coarsely grained business-service boundaries—services that will result in true IT-business alignment.</p>
<p>Business events create natural temporal boundaries across which there is no business expectation of immediate consistency or confirmation. When they are mapped to technical solutions, the loosely coupled business domains on either side of business events simply result in autonomous, loosely coupled services whose contracts explicitly reflect the inherent publish/subscribe nature of the business.</p>
<p>This article will describe how all of these concepts fit together, as well as how they solve thorny issues such as high availability and fault tolerance.</p>
<p><a href="http://msdn.microsoft.com/en-us/architecture/aa699424.aspx">Continue reading&#8230;</a>
</div>
<p>Please leave questions and comments here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2009/09/29/article-eda-soa-through-the-looking-glass/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>The Fallacy Of ReUse</title>
		<link>http://www.udidahan.com/2009/06/07/the-fallacy-of-reuse/</link>
		<comments>http://www.udidahan.com/2009/06/07/the-fallacy-of-reuse/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 08:40:16 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[OO]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=1026</guid>
		<description><![CDATA[This industry is pre-occupied with reuse.
There&#8217;s this belief that if we just reused more code, everything would be better.
Some even go so far as saying that the whole point of object-orientation was reuse &#8211; it wasn&#8217;t, encapsulation was the big thing. After that component-orientation was the thing that was supposed to make reuse happen. Apparently [...]]]></description>
			<content:encoded><![CDATA[<p>This industry is pre-occupied with reuse.</p>
<p>There&#8217;s this belief that if we just reused more code, everything would be better.</p>
<p>Some even go so far as saying that the whole point of object-orientation was reuse &#8211; it wasn&#8217;t, encapsulation was the big thing. After that component-orientation was the thing that was supposed to make reuse happen. Apparently that didn&#8217;t pan out so well either because here we are now pinning our reuseful hopes on service-orientation.</p>
<p>Entire books of patterns have been written on how to achieve reuse with the orientation of the day.<br />
Services have been classified every which way in trying to achieve this, from entity services and activity services, through process services and orchestration services. Composing services has been touted as the key to reusing, and creating reusable services.</p>
<p>I might as well let you in on the dirty-little secret:</p>
<h3>Reuse is a fallacy</h3>
<p>Before running too far ahead, let&#8217;s go back to what the actual goal of reuse was: getting done faster.</p>
<p>That&#8217;s it.</p>
<p>It&#8217;s a fine goal to have.</p>
<p>And here&#8217;s how reuse fits in to the picture:</p>
<blockquote><p>
If we were to write all the code of a system, we&#8217;d write a certain amount of code.<br />
If we could reuse some code from somewhere else that was written before, we could write less code.<br />
The more code we can reuse, the less code we write.<br />
The less code we write, the sooner we&#8217;ll be done!
</p></blockquote>
<p>However, the above logical progression is based on another couple of fallacies:</p>
<h3>Fallacy: All code takes the same amount of time to write</h3>
<h3>Fallacy: Writing code is the primary activity in getting a system done</h3>
<p>Anyone who&#8217;s actually written some code that&#8217;s gone into production knows this.</p>
<p>There&#8217;s the time it takes us to understand what the system should do.<br />
Multiply that by the time it takes the users to understand what the system should do <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Then there&#8217;s the integrating that code with all the other code, databases, configuration, web services, etc.<br />
Debugging. Deploying. Debugging. Rebugging. Meetings. Etc.</p>
<p>Writing code is actually the least of our worries.<br />
We actually spend less time writing code than&#8230;</p>
<h3>Rebugging code</h3>
<p>Also known as bug regressions.</p>
<p>This is where we fix one piece of code, and in the process break another piece of code.<br />
It&#8217;s not like we do it on purpose. It&#8217;s all those dependencies between the various bits of code.<br />
The more dependencies there are, the more likely something&#8217;s gonna break.<br />
Especially when we have all sorts of hidden dependencies,<br />
like when other code uses stuff we put in the database without asking us what it means,<br />
or, heaven forbid, changing it without telling us.</p>
<p>These debugging/rebugging cycles can make stabilizing a system take a long time.</p>
<p>So, how does reuse help/hinder with that?</p>
<p>Here&#8217;s how:</p>
<h3>Dependencies multiply by reuse</h3>
<p>It&#8217;s to be expected. If you wrote the code all in one place, there are no dependencies. By reusing code, you&#8217;ve created a dependency. The more you reuse, the more dependencies you have. The more dependencies, the more rebugging.</p>
<p>Of course, we need to keep in mind the difference between&#8230;</p>
<h3>Reuse &#038; Use</h3>
<p>Your code <b>uses</b> the runtime API (JDK, .NET BCL, etc).<br />
Likewise other frameworks like (N)Hibernate, Spring, WCF, etc.</p>
<p>Reuse happens when you extend and override existing behaviors within other code.<br />
This is most often done by inheritance in OO languages.</p>
<p>Interestingly enough, by the above generally accepted definition, most web services &#8220;reuse&#8221; is actually really use.</p>
<p>Let&#8217;s take a look at the characteristics of the code we&#8217;re using and reusing to see where we get the greatest value:</p>
<h3>The value of (re)use</h3>
<p>If we were to (re)use a piece of code in only one part of our system, it would be safe to say that we would get less value than if we could (re)use it in more places. For example, we could say that for many web applications, the web framework we use provides more value than a given encryption algorithm that we may use in only a few places.</p>
<p>So, what characterizes the code we use in many places?</p>
<p>Well, it&#8217;s very <b>generic</b>.</p>
<p>Actually, the more generic a piece of code, the less likely it is that we&#8217;ll be changing something in it when fixing a bug in the system.</p>
<p><b>That&#8217;s important</b>.</p>
<p>However, when looking at the kind of code we reuse, and the reasons around it, we tend to see very <b>non-generic</b> code &#8211; something that deals with the domain-specific behaviors of the system. Thus, the likelihood of a bug fix needing to touch that code is higher than in the generic/use-not-reuse case, often much higher.</p>
<h3>How it all fits together</h3>
<blockquote><p>
Goal:&#09;Getting done faster<br />
Via:&#09;Spending less time debugging/rebugging/stabilizing<br />
Via:&#09;Having less dependencies reasonably requiring a bug fix to touch the dependent side<br />
Via:&#09;Not reusing non-generic code
</p></blockquote>
<p>This doesn&#8217;t mean you shouldn&#8217;t use generic code / frameworks where applicable &#8211; absolutely, you should.<br />
Just watch the number of kind of dependencies you introduce.</p>
<h3>Back to services</h3>
<p>So, if we follow the above advice with services, we wouldn&#8217;t want domain specific services reusing each other.<br />
If we could get away with it, we probably wouldn&#8217;t even want them using each other either.</p>
<p>As use and reuse go down, we can see that service autonomy goes up. And vice-versa.<br />
Luckily, we have service interaction mechanisms from Event-Driven Architecture that enable use without breaking autonomy.<br />
Autonomy is actually very similar to the principle of encapsulation that drove object-orientation in the first place.<br />
Interesting, isn&#8217;t it?</p>
<h3>In summary</h3>
<p>We all want to get done faster.</p>
<p>Way back when, someone told us reuse was the way to do that.</p>
<p>They were wrong.</p>
<p>Reuse may make sense in the most tightly coupled pieces of code you have, but not very much anywhere else.</p>
<p>When designing services in your SOA, stay away from reuse, and minimize use (with EDA patterns).</p>
<p>The next time someone pulls the &#8220;reuse excuse&#8221;, you&#8217;ll be ready.</p>
<hr size="1" />
<h3>Further Reading</h3>
<ul>
<li><a href="http://www.udidahan.com/2008/10/22/additional-logic-required-for-service-autonomy/">Additional logic required for service autonomy</a></li>
<li><a href="http://www.udidahan.com/2008/12/13/self-contained-events-and-soa/">Self-contained events &#038; SOA</a></li>
<li><a href="http://msdn2.microsoft.com/en-us/arcjournal/bb245672">Autonomous Services and Enterprise Entity Aggregation</a> [MS Architecture Journal]</li>
<li><a href="http://udidahan.weblogs.us/2006/05/26/podcast-does-soa-mean-the-end-of-oo/">Does SOA mean the end of OO?</a> [Podcast]</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2009/06/07/the-fallacy-of-reuse/feed/</wfw:commentRss>
		<slash:comments>49</slash:comments>
		</item>
		<item>
		<title>Saga Persistence and Event-Driven Architectures</title>
		<link>http://www.udidahan.com/2009/04/20/saga-persistence-and-event-driven-architectures/</link>
		<comments>http://www.udidahan.com/2009/04/20/saga-persistence-and-event-driven-architectures/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 11:50:44 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=992</guid>
		<description><![CDATA[When working with clients, I run into more than a couple of people that have difficulty with event-driven architecture (EDA). Even more people have difficulty understanding what sagas really are, let alone why they need to use them. I&#8217;d go so far to say that many people don&#8217;t realize the importance of how sagas are [...]]]></description>
			<content:encoded><![CDATA[<p><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 0px 10px 10px; border-right-width: 0px" height="128" alt="image" src="http://www.udidahan.com/wp-content/uploads/saga_persistence.jpg" width="200" align="right" border="0" />When working with clients, I run into more than a couple of people that have difficulty with event-driven architecture (EDA). Even more people have difficulty understanding what sagas really are, let alone why they need to use them. I&#8217;d go so far to say that many people don&#8217;t realize the importance of how sagas are persisted in making it all work (including the Workflow Foundation team).</p>
<h3>The common e-commerce example</h3>
<p>We accept orders, bill the customer, and then ship them the product.</p>
<p>Fairly straight-forward.</p>
<p>Since each part of that process can be quite complex, let&#8217;s have each step be handled by a service:</p>
<p>Sales, Billing, and Shipping. Each of these services will publish an event when it&#8217;s done its part. Sales will publish OrderAccepted containing all the order information &#8211; order Id, customer Id, products, quantities, etc. Billing will publish CustomerBilledForOrder containing the customer Id, order Id, etc. And Shipping will publish OrderShippedToCustomer with its data.</p>
<p>So far, so good. EDA and SOA seem to be providing us some value.</p>
<h3>Where&#8217;s the saga?</h3>
<p>Well, let&#8217;s consider the behavior of the Shipping service. It shouldn&#8217;t ship the order to the customer until it has received the CustomerBilledForOrder event as well as the OrderAccepted event. In other words, Shipping needs to hold on to the state that came in the first event until the second event comes in. And this is exactly what sagas are for.</p>
<p>Let&#8217;s take a look at the saga code that implements this. In order to simplify the sample a bit, I&#8217;ll be omitting the product quantities.</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<div class="csharpcode">
<pre class="alt"><span class="lnum">   1:  </span>    <span class="kwrd">public</span> <span class="kwrd">class</span> ShippingSaga : Saga&lt;ShippingSagaData&gt;,</pre>
<pre><span class="lnum">   2:  </span>        ISagaStartedBy&lt;OrderAccepted&gt;,</pre>
<pre class="alt"><span class="lnum">   3:  </span>        ISagaStartedBy&lt;CustomerBilledForOrder&gt;</pre>
<pre><span class="lnum">   4:  </span>    {</pre>
<pre class="alt"><span class="lnum">   5:  </span>        <span class="kwrd">public</span> <span class="kwrd">void</span> Handle(OrderAccepted message)</pre>
<pre><span class="lnum">   6:  </span>        {</pre>
<pre class="alt"><span class="lnum">   7:  </span>            <span class="kwrd">this</span>.Data.ProductIdsInOrder = message.ProductIdsInOrder;</pre>
<pre><span class="lnum">   8:  </span>        }</pre>
<pre class="alt"><span class="lnum">   9:  </span>&nbsp;</pre>
<pre><span class="lnum">  10:  </span>        <span class="kwrd">public</span> <span class="kwrd">void</span> Handle(CustomerBilledForOrder message)</pre>
<pre class="alt"><span class="lnum">  11:  </span>        {</pre>
<pre><span class="lnum">  12:  </span>             <span class="kwrd">this</span>.Bus.Send&lt;ShipOrderToCustomer&gt;(</pre>
<pre class="alt"><span class="lnum">  13:  </span>                (m =&gt;</pre>
<pre><span class="lnum">  14:  </span>                {</pre>
<pre class="alt"><span class="lnum">  15:  </span>                    m.CustomerId = message.CustomerId;</pre>
<pre><span class="lnum">  16:  </span>                    m.OrderId = message.OrderId;</pre>
<pre class="alt"><span class="lnum">  17:  </span>                    m.ProductIdsInOrder = <span class="kwrd">this</span>.Data.ProductIdsInOrder;</pre>
<pre><span class="lnum">  18:  </span>                }</pre>
<pre class="alt"><span class="lnum">  19:  </span>                ));</pre>
<pre><span class="lnum">  20:  </span>&nbsp;</pre>
<pre class="alt"><span class="lnum">  21:  </span>            <span class="kwrd">this</span>.MarkAsComplete();</pre>
<pre><span class="lnum">  22:  </span>        }</pre>
<pre class="alt"><span class="lnum">  23:  </span>&nbsp;</pre>
<pre><span class="lnum">  24:  </span>        <span class="kwrd">public</span> <span class="kwrd">override</span> <span class="kwrd">void</span> Timeout(<span class="kwrd">object</span> state)</pre>
<pre class="alt"><span class="lnum">  25:  </span>        {</pre>
<pre><span class="lnum">  26:  </span>            </pre>
<pre class="alt"><span class="lnum">  27:  </span>        }</pre>
<pre><span class="lnum">  28:  </span>    }</pre>
</div>
<p>First of all, this looks fairly simple and straightforward, which is good.<br/><br />
It&#8217;s also wrong, which is not so good.</p>
<p>One problem we have here is that events may arrive out of order &#8211; first CustomerBilledForOrder, and only then OrderAccepted. What would happen in the above saga in that case? Well, we wouldn&#8217;t end up shipping the products to the customer, and customers tend not to like that (for some reason).</p>
<p>There&#8217;s also another problem here. See if you can spot it as I go through the explanation of ISagaStartedBy&lt;T&gt;.</p>
<h3>Saga start up and correlation</h3>
<p>The &#8220;ISagaStartedBy&lt;T&gt;&#8221; that is implemented for both messages indicates to the infrastructure (NServiceBus) that when a message of that type arrives, if an existing saga instance cannot be found, that a new instance should be started up. Makes sense, doesn&#8217;t it? For a given order, when the OrderAccepted event arrives first, Shipping doesn&#8217;t currently have any sagas handling it, so it starts up a new one. After that, when the CustomerBilledForOrder event arrives for that same order, the event should be handled by the saga instance that handled the first event &#8211; not by a new one.</p>
<p>I&#8217;ll repeat the important part: &#8220;the event should be handled by the saga instance that handled the first event&#8221;.</p>
<p>Since the only information we stored in the saga was the list of products, how would we be able to look up that saga instance when the next event came in containing an order Id, but no saga Id?</p>
<p>OK, so we need to store the order Id from the first event so that when the second event comes along we&#8217;ll be able to find the saga based on that order Id. Not too complicated, but something to keep in mind.</p>
<p>Let&#8217;s look at the updated code:</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<div class="csharpcode">
<pre class="alt"><span class="lnum">   1:  </span>    <span class="kwrd">public</span> <span class="kwrd">class</span> ShippingSaga : Saga&lt;ShippingSagaData&gt;,</pre>
<pre><span class="lnum">   2:  </span>        ISagaStartedBy&lt;OrderAccepted&gt;,</pre>
<pre class="alt"><span class="lnum">   3:  </span>        ISagaStartedBy&lt;CustomerBilledForOrder&gt;</pre>
<pre><span class="lnum">   4:  </span>    {</pre>
<pre class="alt"><span class="lnum">   5:  </span>        <span class="kwrd">public</span> <span class="kwrd">void</span> Handle(CustomerBilledForOrder message)</pre>
<pre><span class="lnum">   6:  </span>        {</pre>
<pre class="alt"><span class="lnum">   7:  </span>            <span class="kwrd">this</span>.Data.CustomerHasBeenBilled = <span class="kwrd">true</span>;</pre>
<pre><span class="lnum">   8:  </span>&nbsp;</pre>
<pre class="alt"><span class="lnum">   9:  </span>            <span class="kwrd">this</span>.Data.CustomerId = message.CustomerId;</pre>
<pre><span class="lnum">  10:  </span>            <span class="kwrd">this</span>.Data.OrderId = message.OrderId;</pre>
<pre class="alt"><span class="lnum">  11:  </span>&nbsp;</pre>
<pre><span class="lnum">  12:  </span>            <span class="kwrd">this</span>.CompleteIfPossible();</pre>
<pre class="alt"><span class="lnum">  13:  </span>        }</pre>
<pre><span class="lnum">  14:  </span>&nbsp;</pre>
<pre class="alt"><span class="lnum">  15:  </span>        <span class="kwrd">public</span> <span class="kwrd">void</span> Handle(OrderAccepted message)</pre>
<pre><span class="lnum">  16:  </span>        {</pre>
<pre class="alt"><span class="lnum">  17:  </span>            <span class="kwrd">this</span>.Data.ProductIdsInOrder = message.ProductIdsInOrder;</pre>
<pre><span class="lnum">  18:  </span>&nbsp;</pre>
<pre class="alt"><span class="lnum">  19:  </span>            <span class="kwrd">this</span>.Data.CustomerId = message.CustomerId;</pre>
<pre><span class="lnum">  20:  </span>            <span class="kwrd">this</span>.Data.OrderId = message.OrderId;</pre>
<pre class="alt"><span class="lnum">  21:  </span>&nbsp;</pre>
<pre><span class="lnum">  22:  </span>            <span class="kwrd">this</span>.CompleteIfPossible();</pre>
<pre class="alt"><span class="lnum">  23:  </span>        }</pre>
<pre><span class="lnum">  24:  </span>&nbsp;</pre>
<pre class="alt"><span class="lnum">  25:  </span>        <span class="kwrd">private</span> <span class="kwrd">void</span> CompleteIfPossible()</pre>
<pre><span class="lnum">  26:  </span>        {</pre>
<pre class="alt"><span class="lnum">  27:  </span>            <span class="kwrd">if</span> (<span class="kwrd">this</span>.Data.ProductIdsInOrder != <span class="kwrd">null</span> &amp;&amp; <span class="kwrd">this</span>.Data.CustomerHasBeenBilled)</pre>
<pre><span class="lnum">  28:  </span>            {</pre>
<pre><span class="lnum">  29:  </span>                <span class="kwrd">this</span>.Bus.Send&lt;ShipOrderToCustomer&gt;(</pre>
<pre class="alt"><span class="lnum">  30:  </span>                   (m =&gt;</pre>
<pre><span class="lnum">  31:  </span>                   {</pre>
<pre class="alt"><span class="lnum">  32:  </span>                       m.CustomerId = <span class="kwrd">this</span>.Data.CustomerId;</pre>
<pre><span class="lnum">  33:  </span>                       m.OrderId = <span class="kwrd">this</span>.Data.OrderId;</pre>
<pre class="alt"><span class="lnum">  34:  </span>                       m.ProductIdsInOrder = <span class="kwrd">this</span>.Data.ProductIdsInOrder;</pre>
<pre><span class="lnum">  35:  </span>                   }</pre>
<pre class="alt"><span class="lnum">  36:  </span>                   ));</pre>
<pre><span class="lnum">  37:  </span>                <span class="kwrd">this</span>.MarkAsComplete();</pre>
<pre class="alt"><span class="lnum">  38:  </span>            }</pre>
<pre><span class="lnum">  39:  </span>        }</pre>
<pre class="alt"><span class="lnum">  40:  </span>    }</pre>
</div>
<p>And that brings us to&#8230;</p>
<h3>Saga persistence</h3>
<p>We already saw why Shipping needs to be able to look up its internal sagas using data from the events, but what that means is that simple blob-type persistence of those sagas is out. NServiceBus comes with an NHibernate-based saga persister for exactly this reason, though any persistence mechanism which allows you to query on something other than saga Id would work just as well.</p>
<p>Let&#8217;s take a quick look at the saga data that we&#8217;ll be storing and see how simple it is:</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<div class="csharpcode">
<pre class="alt"><span class="lnum">   1:  </span>    <span class="kwrd">public</span> <span class="kwrd">class</span> ShippingSagaData : ISagaEntity</pre>
<pre><span class="lnum">   2:  </span>    {</pre>
<pre class="alt"><span class="lnum">   3:  </span>        <span class="kwrd">public</span> <span class="kwrd">virtual</span> Guid Id { get; set; }</pre>
<pre><span class="lnum">   4:  </span>        <span class="kwrd">public</span> <span class="kwrd">virtual</span> <span class="kwrd">string</span> Originator { get; set; }</pre>
<pre class="alt"><span class="lnum">   5:  </span>        <span class="kwrd">public</span> <span class="kwrd">virtual</span> Guid OrderId { get; set; }</pre>
<pre><span class="lnum">   6:  </span>        <span class="kwrd">public</span> <span class="kwrd">virtual</span> Guid CustomerId { get; set; }</pre>
<pre class="alt"><span class="lnum">   7:  </span>        <span class="kwrd">public</span> <span class="kwrd">virtual</span> List&lt;Guid&gt; ProductIdsInOrder { get; set; }</pre>
<pre><span class="lnum">   8:  </span>        <span class="kwrd">public</span> <span class="kwrd">virtual</span> <span class="kwrd">bool</span> CustomerHasBeenBilled { get; set; }</pre>
<pre class="alt"><span class="lnum">   9:  </span>    }</pre>
</div>
<p>You might have noticed the &#8220;Originator&#8221; property in there and wondered what it is for. First of all, the ISagaEntity interface requires the two properties Id and Originator. Originator is used to store the return address of the message that started the saga. Id is for what you think it&#8217;s for. In this saga, we don&#8217;t need to send any messages back to whoever started the saga, but in many others we do. In those cases, we&#8217;ll often be handling a message from some other endpoint when we want to possibly report some status back to the client that started the process. By storing that client&#8217;s address the first time, we can then &#8220;ReplyToOriginator&#8221; at any point in the process.</p>
<p>The manufacturing sample that comes with <a href="http://www.NServiceBus.com">NServiceBus</a> shows how this works.</p>
<h3>Saga Lookup</h3>
<p>Earlier, we saw the need to search for sagas based on order Id. The way to hook into the infrastructure and perform these lookups is by implementing &#8220;IFindSagas&lt;T&gt;.Using&lt;M&gt;&#8221; where T is the type of the saga data and M is the type of message. In our example, doing this using NHibernate would look like this:</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<div class="csharpcode">
<pre class="alt"><span class="lnum">   1:  </span>    <span class="kwrd">public</span> <span class="kwrd">class</span> ShippingSagaFinder : </pre>
<pre><span class="lnum">   2:  </span>        IFindSagas&lt;ShippingSagaData&gt;.Using&lt;OrderAccepted&gt;,</pre>
<pre class="alt"><span class="lnum">   3:  </span>        IFindSagas&lt;ShippingSagaData&gt;.Using&lt;CustomerBilledForOrder&gt;</pre>
<pre><span class="lnum">   4:  </span>    {</pre>
<pre class="alt"><span class="lnum">   5:  </span>        <span class="kwrd">public</span> ShippingSagaData FindBy(CustomerBilledForOrder message)</pre>
<pre><span class="lnum">   6:  </span>        {</pre>
<pre class="alt"><span class="lnum">   7:  </span>            <span class="kwrd">return</span> FindBy(message.OrderId)</pre>
<pre><span class="lnum">   8:  </span>        }</pre>
<pre class="alt"><span class="lnum">   9:  </span>&nbsp;</pre>
<pre><span class="lnum">  10:  </span>        <span class="kwrd">public</span> ShippingSagaData FindBy(OrderAccepted message)</pre>
<pre class="alt"><span class="lnum">  11:  </span>        {</pre>
<pre><span class="lnum">  12:  </span>            <span class="kwrd">return</span> FindBy(message.OrderId)</pre>
<pre class="alt"><span class="lnum">  13:  </span>        }</pre>
<pre><span class="lnum">  14:  </span>&nbsp;</pre>
<pre class="alt"><span class="lnum">  15:  </span>        <span class="kwrd">private</span> ShippingSagaData FindBy(Guid orderId)</pre>
<pre><span class="lnum">  16:  </span>        {</pre>
<pre class="alt"><span class="lnum">  17:  </span>            <span class="kwrd">return</span> sessionFactory.GetCurrentSession().CreateCriteria(<span class="kwrd">typeof</span>(ShippingSagaData))</pre>
<pre><span class="lnum">  18:  </span>                .Add(Expression.Eq(<span class="str">"OrderId"</span>, orderId))</pre>
<pre class="alt"><span class="lnum">  19:  </span>                .UniqueResult&lt;ShippingSagaData&gt;();</pre>
<pre><span class="lnum">  20:  </span>        }</pre>
<pre class="alt"><span class="lnum">  21:  </span>&nbsp;</pre>
<pre><span class="lnum">  22:  </span>        <span class="kwrd">private</span> ISessionFactory sessionFactory;</pre>
<pre class="alt"><span class="lnum">  23:  </span>&nbsp;</pre>
<pre><span class="lnum">  24:  </span>        <span class="kwrd">public</span> <span class="kwrd">virtual</span> ISessionFactory SessionFactory</pre>
<pre class="alt"><span class="lnum">  25:  </span>        {</pre>
<pre><span class="lnum">  26:  </span>            get { <span class="kwrd">return</span> sessionFactory; }</pre>
<pre class="alt"><span class="lnum">  27:  </span>            set { sessionFactory = <span class="kwrd">value</span>; }</pre>
<pre><span class="lnum">  28:  </span>        }</pre>
<pre class="alt"><span class="lnum">  29:  </span>    }</pre>
</div>
<p>For a performance boost, we&#8217;d probably index our saga data by order Id.</p>
<h3>On concurrency</h3>
<p>Another important note is that for this saga, if both messages were handled in parallel on different machines, the saga could get stuck. The persistence mechanism here needs to prevent this. When using NHibernate over a database with the appropriate isolation level (Repeatable Read &#8211; the default in NServiceBus), this &#8220;just works&#8221;. If/When implementing your own saga persistence mechanism, it is important to understand the kind of concurrency your business logic can live with.</p>
<p>Take a look at Ayende&#8217;s example for <a href="http://ayende.com/Blog/archive/2009/01/23/rhino-dht-concurrency-handling-example-ndash-the-phone-billing-system.aspx">mobile phone billing</a> to get a feeling for what that&#8217;s like.</p>
<h3>Summary</h3>
<p>In almost any event-driven architecture, you&#8217;ll have services correlating multiple events in order to make decisions. The saga pattern is a great fit there, and not at all difficult to implement. You do need to take into account that events may arrive out of order and implement the saga logic accordingly, but it&#8217;s really not that big a deal. Do take the time to think through what data will need to be stored in order for the saga to be fault-tolerant, as well as a persistence mechanism that will allow you to look up that data based on event data.</p>
<p>If you feel like giving this approach a try, but don&#8217;t have an environment handy for this, download <a href="http://www.NServiceBus.com">NServiceBus</a> and take a look at the samples. It&#8217;s really quick and easy to get set up.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2009/04/20/saga-persistence-and-event-driven-architectures/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Messaging ROI</title>
		<link>http://www.udidahan.com/2009/02/22/messaging-roi/</link>
		<comments>http://www.udidahan.com/2009/02/22/messaging-roi/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 10:12:59 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Scalability]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/2009/02/22/messaging-roi/</guid>
		<description><![CDATA[There&#8217;s been some recent discussion as to the &#8220;cost&#8221; of messaging:
Greg Young asserts: 
&#8220;I believe that this shows there to be a rather negligible cost associated with the use of such a model. There is however a small cost, this cost however I believe only exists when one looks at the system in isolation.&#8221;

Ayende adds [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s been some recent discussion as to the &#8220;cost&#8221; of messaging:</p>
<p>Greg Young <a href="http://codebetter.com/blogs/gregyoung/archive/2009/02/09/cost.aspx">asserts</a>:<a href="http://codebetter.com/blogs/gregyoung/archive/2009/02/09/cost.aspx"><img style="border-right: 0px; border-top: 0px; margin: 0px 0px 10px 10px; border-left: 0px; border-bottom: 0px" height="79" alt="image" src="http://www.udidahan.com/wp-content/uploads/image54.png" width="79" align="right" border="0"></a> </p>
<blockquote><p>&#8220;I believe that this shows there to be a rather negligible cost associated with the use of such a model. There is however a small cost, this cost however I believe only exists when one looks at the system in isolation.&#8221;</p>
</blockquote>
<p>Ayende adds <a href="http://ayende.com/Blog/archive/2009/02/09/the-cost-of-messaging.aspx">his perspective</a>:<a href="http://ayende.com/Blog/archive/2009/02/09/the-cost-of-messaging.aspx"><img style="border-right: 0px; border-top: 0px; margin: 0px 0px 10px 10px; border-left: 0px; border-bottom: 0px" height="77" alt="image" src="http://www.udidahan.com/wp-content/uploads/image55.png" width="85" align="right" border="0"></a> </p>
<blockquote><p>&#8220;The cost of messaging, and a very real one, comes when you need to understand the system. In a system where message exchange is the form of communication, it can be significantly harder to understand what is going on.&#8221;</p>
</blockquote>
<p>Of course, both these intelligent fellows are right. The reason for the apparent disparity in viewpoints has to do with which part of the following graph you look at. Ayende zooms in on the left side:</p>
<p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="225" alt="left graph" src="http://www.udidahan.com/wp-content/uploads/image56.png" width="404" border="0"> </p>
<p>As systems get larger, though, the only way to understand them is by working at higher levels of abstraction. That&#8217;s where messaging really shines, as the incremental complexity remains the same by maintaining the same modularity as before:</p>
<p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="232" alt="full graph" src="http://www.udidahan.com/wp-content/uploads/image57.png" width="404" border="0"> </p>
<p>In Ayende&#8217;s post, he follows the design I described a while back on using messaging for user management and <a href="http://www.udidahan.com/2007/11/10/asynchronous-high-performance-login-for-web-farms/">login for a high-scale web scenario</a>. In his comments, he agrees with the above stating:</p>
<blockquote><p>&#8220;I certainly think that a similar solution using RPC would be much more complex and likely more brittle.&#8221;</p>
</blockquote>
<p>I feel quite conservative in saying the most enterprise solutions fall on the right side of the intersection in the graph.</p>
<p>That being said, don&#8217;t underestimate the learning curve developers go through with messaging. While the mechanics are similar, the mindset is very different. Think about it like this:<a href="http://www.udidahan.com/wp-content/uploads/image58.png"><img style="border-right: 0px; border-top: 0px; margin: 5px 0px 10px 10px; border-left: 0px; border-bottom: 0px" height="100" alt="image" src="http://www.udidahan.com/wp-content/uploads/image-thumb36.png" width="80" align="right" border="0"></a> </p>
<blockquote><p>You&#8217;ve driven a car for years in the US. It&#8217;s practically second nature. Then you fly to the UK, rent a car, and all of a sudden, your brain is in meltdown. (or vice versa for those going from the UK to the US)</p>
</blockquote>
<h3>Summary</h3>
<p>If you are going down the messaging route, please be aware that there are shades of gray there as well. You don&#8217;t <em>have</em> to implement your user management and login the way I outlined in my post if you don&#8217;t require such high levels of scalability, but even lower levels of scalability can benefit from messaging.</p>
<p>Just as there isn&#8217;t a single correct design for non-messaging solutions, the same is true for those using messaging. Finding the right balance is tricky, and critical. </p>
<p>When the code is simple in every part of the system, and the asynchronous interactions are what provide for the necessary complexity the problem domain requires, that&#8217;s when you know you&#8217;ve got it just right.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2009/02/22/messaging-roi/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SOA, REST, and Pub/Sub</title>
		<link>http://www.udidahan.com/2008/12/15/soa-rest-and-pubsub/</link>
		<comments>http://www.udidahan.com/2008/12/15/soa-rest-and-pubsub/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 08:34:24 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[Integrated Simplicity]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Scalability]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/2008/12/15/soa-rest-and-pubsub/</guid>
		<description><![CDATA[From Integrated Simplicity:
 
The question of how web-based (or 3rd party) consumers can work with pub/sub based services comes up a lot.
Many developers are used to implementing web services exposing methods on them like GetAllCustomers.
When moving to pub/sub and other more loosely coupled messaging patterns, developers look to implement the same pattern, opting for something [...]]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://www.IntegratedSimplicity.com">Integrated Simplicity</a>:</p>
<p><a href="http://www.udidahan.com/wp-content/uploads/image49.png"><img style="border-right: 0px; border-top: 0px; margin: 0px 0px 10px; border-left: 0px; border-bottom: 0px" height="277" alt="SOA &amp; Web" src="http://www.udidahan.com/wp-content/uploads/image-thumb34.png" width="526" border="0"></a> </p>
<p>The question of how web-based (or 3rd party) consumers can work with pub/sub based services comes up a lot.</p>
<p>Many developers are used to implementing web services exposing methods on them like GetAllCustomers.</p>
<p>When moving to pub/sub and other more loosely coupled messaging patterns, developers look to implement the same pattern, opting for something like duplex GetCustomersRequest and GetCustomersResponse. The reasoning is simple and straightforward &#8211; it is difficult to push data over the web to consumers.</p>
<p>However, there are still ways to disconnect the preparation of the data from its usage thus gaining many of the advantages of pub/sub.</p>
<p>By employing REST principles and modelling our customer list as an explicit resource, web-based consumers would simply perform regular HTTP GET operations on the URI to get the list of customers.</p>
<p>The resource itself could be a simple XML file &#8211; it wouldn&#8217;t need to be dynamic at all.</p>
<p>You can get all the scalability benefits of pub/sub for web based consumers. All you need is a bit of REST <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/12/15/soa-rest-and-pubsub/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Self-Contained Events and SOA</title>
		<link>http://www.udidahan.com/2008/12/13/self-contained-events-and-soa/</link>
		<comments>http://www.udidahan.com/2008/12/13/self-contained-events-and-soa/#comments</comments>
		<pubDate>Sat, 13 Dec 2008 23:35:08 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[Master Data Management]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/2008/12/13/self-contained-events-and-soa/</guid>
		<description><![CDATA[In the architectural principle of fully self contained messages, events &#8220;can &#8211; instantly and in future &#8211; be interpreted as the respective event without the need to rely on additional data stores that would need to be in time-sync with the event during message-processing.&#8221;
Also, &#8220;passing reference data in a message makes the message-consuming systems dependent [...]]]></description>
			<content:encoded><![CDATA[<p><img style="border-right: 0px; border-top: 0px; margin: 0px 0px 10px 10px; border-left: 0px; border-bottom: 0px" height="237" alt="diamond" src="http://www.udidahan.com/wp-content/uploads/diamond.jpg" width="214" align="right" border="0">In <a href="http://soa-eda.blogspot.com/2008/11/architectural-principle-of-fully-self.html">the architectural principle of fully self contained messages</a>, events &#8220;can &#8211; instantly and in future &#8211; be interpreted as the respective event without the need to rely on additional data stores that would need to be in time-sync with the event during message-processing.&#8221;</p>
<p>Also, &#8220;passing reference data in a message makes the message-consuming systems dependent on the knowledge and availability of actual persistent data that is stored “somewhere”. This data must separately be accessed for the sake of understanding the event that is represented by the message.&#8221; </p>
<p>The discussion of self-contained events can be compared to <a href="http://martinfowler.com/bliki/IntegrationDatabase.html">integration databases</a> vs <a href="http://martinfowler.com/bliki/ApplicationDatabase.html">application databases</a>. </p>
<h3>Centralized Integration &#8211; Pros &amp; Cons</h3>
<p>If everything in a system can access a central datastore, it is enough for one party to publish an event containing only the ID of an entity that that party previously entered/updated. Upon receiving that event, a subscriber would go to the central datastore and get the fields its interested in for that ID. The advantage of this approach is that the minimal amount of data necessary crosses the network, as subscribers only retrieve the fields that interest them. Martin Fowler describes the disadvantages as:</p>
<blockquote><p>&#8220;An integration database needs a schema that takes all its client applications into account. The resulting schema is either more general, more complex or both. The database usually is controlled by a separate group to the applications and database changes are more complex because they have to be negotiated between the database group and the various applications.&#8221;</p>
</blockquote>
<p>This is far from being aligned with the principle of autonomy so important to SOA. In that respect, the architectural principle of self-contained messages points us away from those problems and towards more autonomous services.</p>
<p>However, once we have these autonomous business services in place, we may find that we don&#8217;t need 100% fully self-contained messages anymore. </p>
<h3>A Real-World Example</h3>
<p>Let&#8217;s say we have 3 business services, Sales, Fulfillment, and Billing.</p>
<p>Sales publishes an OrderAccepted event when it accepts an order. That event contains all the order information.</p>
<p>Both Fulfillment and Billing are subscribed to this event, and thus receive it. </p>
<p>Fulfillment does not ship products to the customer until the customer has been billed, so it just stores the order information internally, and is done.</p>
<p>Billing starts the process of billing the customer for their order, possibly joining several orders into a single bill. After completing this process, it publishes a CustomerBilled event containing all billing information, as well as the IDs of the orders in that bill. It does not put all the order information in that event, as it is not the authoritative owner of that data.</p>
<p>When Fulfillment receives the CustomerBilled event, it uses the IDs of the orders contained in the event to find the order information it previously stored internally. It does not need to call the Sales service for this information or contact some central Master Data Management system. It uses the data it has, and goes about fulfilling the orders and shipping the products to the customer, finally publishing its own OrderShipped event.</p>
<p>Notice, as well, that in the original OrderAccepted event there were the IDs of products the customer ordered. These product IDs originated from another service, Merchandising, responsible for the product catalog. The same thing can be said for the customer ID originating from another service &#8211; Customer Care.</p>
<h3>The Issue of Time</h3>
<p>One could argue that since subscribers use previously cached data when processing new events, that data might not be up to date. Also, we may have race conditions between our services. In the above example, if Billing was extremely fast and more highly available than Fulfillment. Billing could have received the OrderAccepted event, processed it, and published the CustomerBilled event before Fulfillment had received the OrderAccepted event. In short, the CustomerBilled and OrderAccepted messages could be out of order in Fulfillment’s queue.</p>
<p>What would Fulfillment do when trying to process the CustomerBilled message when it doesn’t have the order information?
<p>Well, it knows that the world is parallel and non-sequential, so it does NOT return/log an error, but rather puts that message in the back of the queue to be processed again later (or maybe in some other temporary holding area). This enables the OrderAccepted message to be processed before the CustomerBilled message is retried. When the retry occurs, well, everything’s OK – it’s worked itself out over time.
<p>In the case where we retry again and again and things don’t work themselves out (maybe the OrderAccepted event was lost), we move that message off to a different queue for something else to resolve the conflict (maybe a person, maybe software). If/when the conflict is resolved (got the Sales system / messaging system to replay the OrderAccepted event), the conflict resolver returns the CustomerBilled message to the queue, and now everything works just fine.
<p>As all of this is occurring, the only thing that’s visible to external parties is that it happens to be taking longer than usual for the OrderShipped event to be published. In other words, time is the only difference.<br />
<h3>&nbsp;</h3>
<h3>Summary</h3>
<p>The problem of non-self-contained events is mitigated first and foremost by business services in SOA, and the apparent issue of time-synchronization by business logic inside these services.</p>
<p>Don&#8217;t be afraid to put IDs in your messages and events.</p>
<p>Do be afraid of using those IDs to access datastores shared by multiple &#8220;services&#8221;.</p>
<p>Using IDs to correlated current events to data from previous events is not only OK, it&#8217;s to be expected.</p>
<p>The architectural principle of fully self-contained messages steers us away from the problems of Integration Databases and towards Application Databases, autonomous services, and a better SOA implementation. From there, following the principle of autonomy from a business perspective, will lead us to services not publishing data in their messages that is owned by other services, taking us the next step of our journey to SOA.</p>
<hr size="1">
<h3> Related Content</h3>
<blockquote><p><a href="http://www.udidahan.com/2008/01/01/podcast-message-ordering-is-it-cost-effective/">[Podcast] Message Ordering &#8211; Is it cost effective?</a></p>
<p><a href="http://www.udidahan.com/2007/08/16/dont-eda-between-existing-systems/">Don&#8217;t EDA between existing systems</a></p>
<p><a href="http://www.udidahan.com/2007/05/31/podcast-handling-dependencies-between-subscribers-in-soa/">[Podcast] Handling dependencies between subscribers in SOA</a></p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/12/13/self-contained-events-and-soa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lost Notifications? No Problem.</title>
		<link>http://www.udidahan.com/2008/12/07/lost-notifications-no-problem/</link>
		<comments>http://www.udidahan.com/2008/12/07/lost-notifications-no-problem/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 09:46:05 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[Reliability]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/2008/12/07/lost-notifications-no-problem/</guid>
		<description><![CDATA[ One of the most common questions I get on the topic of pub/sub messaging is what happens if a notification is lost. Interestingly enough, there are some who almost entirely write-off this pattern because of this issue, preferring the control of request/response-exception. So, what should be done about lost messages? The short answer is [...]]]></description>
			<content:encoded><![CDATA[<p><img style="border-right: 0px; border-top: 0px; margin: 0px 0px 10px 10px; border-left: 0px; border-bottom: 0px" height="148" alt="" src="http://www.udidahan.com/wp-content/uploads/image48.png" width="240" align="right" border="0"> One of the most common questions I get on the topic of pub/sub messaging is what happens if a notification is lost. Interestingly enough, there are some who almost entirely write-off this pattern because of this issue, preferring the control of request/response-exception. So, what should be done about lost messages? The short answer is durable messaging. The long answer is design.</p>
<h3>Durable Messaging</h3>
<p>In order to prevent a message from being lost when it is sent from a publisher to a subscriber, the message is written to disk on the publisher side, and then forwarded to the subscriber, where it is also written to disk. This store-and-forward mechanism enables our systems to gracefully recover from either side being temporarily unavailable.</p>
<p>In my <a href="http://msdn.microsoft.com/en-us/magazine/cc663023.aspx">MSDN article on this topic</a>, I outlined some problems with this approach. These problems are exacerbated for publishers. Imagine a publisher with 40 subscribers, publishing 10 messages a second, each containing 1MB of XML. If 10 of the subscribers are unavailable, that&#8217;s 100MB of data being written to the publisher&#8217;s disk every second, 6GB every minute. That&#8217;s liable to bring down a publisher before an administrator brews a cup of coffee.</p>
<p>Publishers have no choice but to throw away messages after a certain period of time.</p>
<h3>Publisher Contracts</h3>
<p>The whole issue of contracts and schema is considered one of the better understand parts of SOA. Unfortunately, the operational aspects of service contracts is hardly ever taken into account.</p>
<p>On top of the schema of the messages a service publishers, additional information is needed in the contract:</p>
<ol>
<li>How big will this message be?
<li>How often will it be published?
<li>How long will this message be stored if a subscriber is unavailable?</li>
</ol>
<p>This first two pieces of information are important for subscribers to do load and capacity planning. The last one is the most important as it dictates the required availability and fault-tolerance characteristic of subscribers.</p>
<h3>For Example</h3>
<p>In the canonical retail scenario, when our sales service accepts an order, it publishes an order accepted event. Other services subscribed to this event include shipping, billing, and business intelligence.</p>
<p>While shipping and billing are highly available and able to keep up with the rate at which orders are accepted, the business intelligence service is not. BI has two main parts to it &#8211; a nightly batch that does the number crunching, and a UI for reporting off of the results of that number crunching. Some even do the reporting in a semi-offline fashion, emailing reports back to the user when they&#8217;re ready.</p>
<p>Furthermore, nobody&#8217;s going to invest in servers for making BI highly available.</p>
<p>And wasn&#8217;t the whole point of this publish/subscribe messaging to keep our services autonomous? That not all services have to have the same level uptime?</p>
<p>Houston, do we have a problem.?</p>
<h3>Data Freshness</h3>
<p>There is a glimmer of light in all this doom and gloom.</p>
<p>Not all services have the same data freshness requirements.</p>
<p>The business intelligence service above doesn&#8217;t need to know about orders the second they&#8217;re accepted. A daily roll-up would be fine, and an hourly roll-up bring us that much closer to &#8220;real time business intelligence&#8221;.</p>
<p>So, while BI is ready to accept the sales message schema, it would like a slightly different contract around it &#8211; less messages per unit of time, more data in each message.</p>
<p>From the operational perspective of the sales service, it would be cost effective to have less &#8220;online&#8221; subscribers. It could even take things a few steps further. Instead of using the regular messaging backbone for transmitting these hourly messages, it could use FTP. The data could even be zipped to take up even less space. Since the total data size is less than the corresponding online stream, is stored on cheaper, large storage, and the number of subscribers for this zipped, hourly update is fairly small, these messages can be kept around far longer.</p>
<p>If you&#8217;ve heard about <a href="http://martinfowler.com/articles/consumerDrivenContracts.html">consumer-driven contracts</a>, this is it.</p>
<p>Note that we&#8217;re still talking about the same logical message schema.</p>
<h3>Summary</h3>
<p>It&#8217;s not that lost notifications aren&#8217;t a problem.</p>
<p><a href="http://en.wikipedia.org/wiki/Tesseract"><img style="margin: 0px 0px 10px 10px" src="http://upload.wikimedia.org/wikipedia/commons/5/55/Tesseract.gif" align="right"></a>
<p>It&#8217;s that they feed the design process in such a way that the resulting service ecosystem is set up in such a way that notifications won&#8217;t get lost. I know that that sounds kind of recursive, but that&#8217;s how it works. Either subscribers take care of their SLA allowing them to process the online stream of events, or they should subscribe to a different pipe (which will have different SLA requirements, but maybe they can deal with those).</p>
<p>It make sense to have multiple pipes for the same logical schema.</p>
<p>It&#8217;s practically a necessity to make pub/sub a feasible solution.</p>
<p>&nbsp;</p>
<hr size="1">
<h3>Related Content</h3>
<blockquote><p><a href="http://msdn.microsoft.com/en-us/magazine/cc663023.aspx">MSDN article on messaging and lost messages</a></p>
<p><a href="http://www.udidahan.com/2008/07/17/durable-messaging-dilemmas/">Durable messaging dilemmas</a></p>
<p><a href="http://www.udidahan.com/2008/10/22/additional-logic-required-for-service-autonomy/">Additional logic required for service autonomy</a></p>
<p><a href="http://www.udidahan.com/2008/11/01/soa-eda-and-cep-a-winning-combo/">More in depth example on events and pub/sub between services</a></p>
<p><a href="http://martinfowler.com/articles/consumerDrivenContracts.html">Consumer-Driven Contracts</a></p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/12/07/lost-notifications-no-problem/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SOA, EDA, and CEP a winning combo</title>
		<link>http://www.udidahan.com/2008/11/01/soa-eda-and-cep-a-winning-combo/</link>
		<comments>http://www.udidahan.com/2008/11/01/soa-eda-and-cep-a-winning-combo/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 22:57:14 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/2008/11/01/soa-eda-and-cep-a-winning-combo/</guid>
		<description><![CDATA[ There&#8217;s been some discussion on the SOA yahoo group around the connection between SOA, EDA, and CEP (complex event processing) since Jack&#8217;s original post on the topic. I&#8217;ve been waiting for the right opportunity to jump in and it seems to have come.
Dennis asked this:

There are different design choices in a SOA, even when [...]]]></description>
			<content:encoded><![CDATA[<p><img style="border-right: 0px; border-top: 0px; margin: 0px 0px 10px 10px; border-left: 0px; border-bottom: 0px" height="240" alt="jump in" src="http://www.udidahan.com/wp-content/uploads/image46.png" width="320" align="right" border="0"> There&#8217;s been some discussion on the SOA yahoo group around the connection between SOA, EDA, and CEP (complex event processing) since Jack&#8217;s <a href="http://soa-eda.blogspot.com/2008/10/eda-versus-cep-and-soa.html">original post</a> on the topic. I&#8217;ve been waiting for the right opportunity to jump in and it seems to have come.
<p>Dennis asked this:<br />
<blockquote>
<p>There are different design choices in a SOA, even when you already have identified the services. I have a simple example that I would like to share:</p>
<p>Imagine a order-to-cash process. One part of that process is to register an order. Suppose we have two services, Order Service and Inventory Service. The task is to register the order and make a corresponding reservation of the stock level. I would be pleased to have the groups view on the following 3 design options (A, B, C):</p>
<p>A.<br />1. The &#8220;process/application&#8221; sends a message (sync or async) to &#8220;registerOrder&#8221; on the Order Service.<br />2. The &#8220;process/application&#8221; sends another message (sync or async) to &#8220;reserveStock&#8221; on the the Inventory Service.</p>
<p>B.<br />1. The &#8220;process/application&#8221; sends a message (sync or async) to &#8220;registerOrder&#8221; on the Order Service.<br />2. The Order Service sends a message (sync or async) to &#8220;reserveStock&#8221; on the the Inventory Service.</p>
<p>C.<br />1. The &#8220;process/application&#8221; sends a message (sync or async) to &#8220;registerOrder&#8221; on the Order Service.<br />2. The Order Service publishes an &#8220;orderReceived&#8221; event.<br />3. The Inventory Service subscribes to the &#8220;orderReceived&#8221; event .</p>
</blockquote>
<p>On the whole &#8220;already identified the services&#8221; thing &#8211; naming a service doesn&#8217;t mean much. It&#8217;s all about allocating responsibility, and until that&#8217;s been done, those &#8220;services&#8221; don&#8217;t give us very much information.
<p>&nbsp;<br />
<h3>Business Services</h3>
<p>If we were to view this example in light of business services, and look at the business events that make up this process, maybe we’d get a different perspective.<br />
<blockquote>
<p>Three business services: <strong>Sales</strong>, <strong>Inventory</strong>, and <strong>Shipping</strong>.</p>
</blockquote>
<p>In Sales, many applications and people may operate, including the person and the application he used to submit the order. When the order is submitted and goes through all the internal validation stuff, Sales raises an OrderTentativelyAccepted event.<br />
<h4>Inventory and Orders</h4>
<p>Inventory, which is subscribed to this event, checks if it has everything in stock for the order. For every item in the order on stock, it allocates that stock to the order and publishes the InventoryAllocatedToOrder event for it. For items/quantities not in stock, it starts a long running process which watches for inventory changes.
<p>When an InventoryChanged event occurs, it matches that against orders requiring allocation – if it finds one that requires stock, based on some logic to choose which order gets precedence, it publishes the InventoryAllocatedToOrder event.
<p>Sales, which is subscribed to the InventoryAllocatedToOrder event, upon receiving all events pertaining to the order tentatively accepted, will publish an OrderAccepted event.<br />
<h4>Orders and Shipping</h4>
<p>When Inventory receives the OrderAccepted event, it generates the pick list to bring all the stock from the warehouses to the loading docks, finally publishing the PickListGenerated event containing target docks.
<p>When Shipping receives the PickListGenerated event, it starts the yard management necessary to bring the needed kinds of trucks to the docks.
<p>&nbsp;<br />
<h3>What else is possible</h3>
<p>I could go on, talking about things like the maximum amount of time stock of various kinds can wait to be loaded on trucks, subscribing to earlier events to employ all kinds of optimization and prediction algorithms, having a Customer Care service notifying the customer about what’s going on with their order (probably different for different kinds of customers and preferred communication definitions). Obviously, we&#8217;d need a Billing service to handle the various kinds of billing procedures, whether or not the customer has credit, pays upon delivery, etc.
<p>It turns out that many business domains map very well to this join of SOA and EDA.
<p>&nbsp;<br />
<h3>What an ESB is for</h3>
<p>When we have these kinds of business services primarily publishing events and subscribing to those of other services, you don&#8217;t need much else from your &#8220;enterprise service bus&#8221;. All sorts of transformation, routing, and orchestration capabilities don&#8217;t come into play at all.
<p>In all truthfullness, those bits of functionality are really just a historical artifact of their broker heritage.
<p>Don&#8217;t get me wrong, sometimes a broker is a nice thing to have &#8211; behind a service boundary in order to perform some complex integration between existing legacy applications.
<p>Just keep that stuff in its place &#8211; not between services.<br />
<h3>&nbsp;</h3>
<h3>Complex Event Processing</h3>
<p>We can look at how Sales transitions an order from being tentatively accepted to being accepted as requiring event correlation around InventoryAllocatedToOrder events. This isn&#8217;t exactly &#8220;complex&#8221; in its own right. If there were some kind of CEP engine that did this for us out of the box, it might be a possible technology choice for implementing this logic within our service.
<p>As we add more concerns, like time, we may find new ways to make use of this engine. For instance, if the time to provide the order to the customer is approaching, we may choose to split the order into two &#8211; accepting one for which we have all the stock allocated, and leaving the second as tentatively accepted.<br />
<h3>&nbsp;</h3>
<h3>Summary</h3>
<p>While it is difficult to move forward on service responsibility without discussing the events it raises and those it subscribe to, the whole issue of CEP can be postponed for a while.
<p>Although there aren&#8217;t many who would say that EDA is necessary for driving down coupling in SOA, or that SOA won&#8217;t likely provide much value without EDA, or that SOA is necessary for providing the right boundaries for EDA, it&#8217;s been my experience that that is exactly the case.
<p>CEP, while being a challenging engineering field, and managing the technical risks around it necessary for a project to succeed in some circumstances, and really shines when used under the SOA/EDA umbrella, it should not be taken by itself and used at the topmost architectural levels.
<p>&nbsp;</p>
<hr size="1">
<h3>Related Content</h3>
<blockquote><p><a href="http://www.udidahan.com/2008/04/23/visual-cobol-enterprise-processes-and-soa/">SOA and Enterprise Processes</a></p>
<p><a href="http://www.udidahan.com/2008/08/11/command-query-separation-and-soa/">How client interaction fits with SOA</a></p>
<p><a href="http://www.udidahan.com/2008/04/20/time-dimension-necessary-for-successful-soa-data-strategy/">Time and SOA</a></p>
<p><a href="http://www.udidahan.com/2008/01/09/durable-messaging-is-not-enough/">Durable Messaging for Fault-Tolerant Services</a></p>
</blockquote>
<p>And if you&#8217;re wondering about how to handle all that complexity inside services (different kinds of billing, periodic tests for electronics inventory, etc), you might like listening to this <a href="http://www.udidahan.com/2006/08/28/podcast-business-and-autonomous-components-in-soa/">podcast about business components</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/11/01/soa-eda-and-cep-a-winning-combo/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Additional Logic Required For Service Autonomy</title>
		<link>http://www.udidahan.com/2008/10/22/additional-logic-required-for-service-autonomy/</link>
		<comments>http://www.udidahan.com/2008/10/22/additional-logic-required-for-service-autonomy/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 22:12:06 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[Caching]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/2008/10/22/additional-logic-required-for-service-autonomy/</guid>
		<description><![CDATA[Of the tenets of Service Orientation, the tenet of Autonomy is one that many understand intuitively. Interestingly enough, many in that same intuitive category don&#8217;t see pub/sub as a necessity for that autonomy.
Watch that first step
Although sometimes described as the first step of an organization moving to SOA, web-service-izing everything results in synchronous, blocking, request/response [...]]]></description>
			<content:encoded><![CDATA[<p>Of the tenets of Service Orientation, the tenet of Autonomy is one that many understand intuitively. Interestingly enough, many in that same intuitive category don&#8217;t see pub/sub as a necessity for that autonomy.</p>
<h3>Watch that first step</h3>
<p>Although sometimes described as the first step of an organization moving to SOA, web-service-izing everything results in synchronous, blocking, request/response interaction between services. The problem being that if one service were to become unavailable, all consumers of that service would not be able to perform any work. With the deep service &#8220;call stacks&#8221; this architectural style condones, the availability and performance of the entire organization will be dictated by the weakest link.</p>
<p>&nbsp;<img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 0px 0px 100px; border-right-width: 0px" height="93" alt="weak link" src="http://www.udidahan.com/wp-content/uploads/image45.png" width="382" border="0"> </p>
<p>So, while I&#8217;d agree that many organizations do need to take this step, I&#8217;d caution against going into production at this step.</p>
<h3>Pub/Sub Considered Helpful</h3>
<p>When services interact with each other using publish/subscribe semantics we don&#8217;t have that technical problem of blocking. Subscribers cache the data published to them (either in memory or durably depending on their fault-tolerance requirements) thus enabling them to function and process requests even if the publisher is unavailable.</p>
<p>Consider the following scenario:</p>
<p>Let&#8217;s say we have an e-commerce site, a part of our Sales service responsible for selling products. Another service, let&#8217;s call it merchandising, is responsible for the catalog of products, and how much each product costs. Sales is subscribed to price update events published by Merchandising and saves (caches) those prices in its own database. When a customer orders some products on the site, Sales does not need to call Merchandising to get the price of the product and just uses the previously saved (cached) price. Thus, even if Merchandising is unavailable, Sales is able to accept orders. This is a big win as our merchandising application is not nearly as robust as our sales systems.</p>
<p>Yet, there are scenarios where data freshness requirements prevent this.</p>
<h3>Too Much of a Good Thing?</h3>
<p>Technically, the above story is accurate. There is nothing technically preventing Sales from accepting orders. Yet consider a scenario where Merchandising is down or unavailable for an extended period of time. While this may not be entirely likely for two servers in the same data center, consider physical kiosks which customers can use to buy products. Those kiosks may not receive updates for days. Should they accept orders?</p>
<p>That&#8217;s really a question to the business. If pricing data is stale for a time period greater than X, do not sell that item. The value of X may even be different for different kinds of products. Keep in mind that this issue only arose since we architected our services to be fully autonomous. In a synchronous systems architecture, this issue would not come up. As such, it is our responsibility as architects to go digging for these requirements as well as explaining to the business what the tradeoffs are.</p>
<p>In order to have more up to date data, we need to invest in more available hardware, networks, and infrastructure. This needs to be balanced against the predicted increase in revenue that more up to date (read higher) prices would give us.</p>
<h3>You Can Get What You Pay For</h3>
<p>Beyond the additional cost of writing that additional logic, and the perceived increased complexity, another difference to note between this architectural style and the synchronous/traditional one is that it puts control of spending back in the hands of business. </p>
<p>In a synchronous architecture, in order to achieve required performance and availability, all systems need to be performant requiring across the board investments in servers, networks, and storage. Without investing everywhere, the weakest link is liable to undo all other investments. In other words, your developers have made your investment choices for you. Scary, isn&#8217;t it.</p>
<p>A more prudent investment strategy would prefer spending on services that give the biggest bang for the buck, better known as return on investment. A pub/sub based architecture allows investing in data-freshness where it makes the most sense. For example, in sales of high profit products to strategic customers rather than inventory management of raw materials for products slated to be decommissioned. </p>
<p>That sounds a lot like IT-Business Alignment.</p>
<p>Maybe there&#8217;s something to this SOA thing after all&#8230;</p>
<hr size="1">
<p> Read more about:</p>
<blockquote><p><a href="http://www.udidahan.com/2008/05/16/7-simple-questions-for-service-selection/">7 Questions for Service Selection</a></p>
<p><a href="http://www.udidahan.com/2008/04/20/time-dimension-necessary-for-successful-soa-data-strategy/">7 Questions around data freshness</a>&nbsp;</p>
<p><a href="http://www.udidahan.com/2007/08/16/dont-eda-between-existing-systems/">Event-Driven Architecture and Legacy Applications</a></p>
<p><a href="http://www.udidahan.com/2007/02/20/autonomous-services-and-enterprise-entity-aggregation/">Autonomous Services and Enterprise Entity Aggregation</a></p>
</blockquote>
<p>Or listen to a podcast describing Business Components, <a href="http://www.udidahan.com/2006/08/28/podcast-business-and-autonomous-components-in-soa/">the connection of pub/sub and SOA</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/10/22/additional-logic-required-for-service-autonomy/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>7 Simple Questions for Service Selection</title>
		<link>http://www.udidahan.com/2008/05/16/7-simple-questions-for-service-selection/</link>
		<comments>http://www.udidahan.com/2008/05/16/7-simple-questions-for-service-selection/#comments</comments>
		<pubDate>Fri, 16 May 2008 22:21:09 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[Business Rules]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/05/16/7-simple-questions-for-service-selection/</guid>
		<description><![CDATA[&#8220;So, which services do I need?&#8221;
This innocuous question comes up a lot. Usually I get this question after a short problem domain description. One of these came up on the nServiceBus discussion groups. Ayende took it and ran with it turning it into a nice blog post, An exercise in designing SOA systems. I&#8217;ve been [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;So, which services do I need?&#8221;</p>
<p>This innocuous question comes up a lot. Usually I get this question after a short problem domain description. One of these came up on the nServiceBus discussion groups. Ayende took it and ran with it turning it into a nice blog post, <a href="http://ayende.com/Blog/archive/2008/04/08/An-exercise-in-designing-SOA-systems.aspx">An exercise in designing SOA systems</a>. I&#8217;ve been meaning to write something myself. Bill put up a response already in his <a href="http://bill-poole.blogspot.com/2008/05/service-granularity-example.html">Service Granularity Example</a>. So, I&#8217;m late to the party, again, but here we go.</p>
<p>It&#8217;s almost impossible to know, right away, which services are appropriate.</p>
<p>So, I&#8217;m going to focus more on the process of getting there, rather than describing the solution itself.</p>
<p>The domain deals with a placement agency placing physicians in positions at hospitals. <a href="http://udidahan.weblogs.us/wp-content/uploads/doctor.png"><img style="border-right: 0px; border-top: 0px; margin: 0px 0px 10px 10px; border-left: 0px; border-bottom: 0px" height="244" alt="doctor" src="http://udidahan.weblogs.us/wp-content/uploads/doctor-thumb.png" width="225" align="right" border="0"></a> </p>
<h3>1. So, what does it actually <em>do</em>?</h3>
<p>In Ayende&#8217;s post, he describes several services, but I&#8217;d rather look at them as use cases: registering an open position, registering a candidate, verifying their credentials, etc. It&#8217;s worth going through this <em>requirements</em> process. It doesn&#8217;t necessarily translate immediately to services, but there&#8217;s value in it.</p>
<h3>2. What does it do it <em>to</em>?</h3>
<p>We should also be looking at the data model, an entity relationship diagram (ERD) , where we see that we may have placed a certain physician at a number of positions. It&#8217;s also important for us to know about under which circumstances a physician finished their employment at a previous position before, say, trying to place them at a position in the same hospital or chain of hospitals. Don&#8217;t go thinking that this what the database schema will look like, it&#8217;s all about understanding connections between various bits of data.</p>
<h3>3. When does that happen?</h3>
<p>The next step is to map the uses cases above to the entities in the ERD, which entity is used in which use case. It&#8217;s also important to differentiate between entities (or even more importantly, specific fields of entities) that are used in a read-only fashion within a given use case. For instance, when registering a new position, we&#8217;ll want to check that against other open positions in the same hospital so we don&#8217;t end up registering the same position twice. Also, we might want to suggest verified physicians whose credentials match the position&#8217;s requirements. Data we wouldn&#8217;t be interested in might be which other physicians we placed at that hospital.</p>
<h3>4. What just happened?</h3>
<p>Another valuable perspective on the problem domain is the business process view &#8211; what are the interesting business events in the system and how they unfold over time. For instance, physician registered, position opened, physician&#8217;s credentials verified, and physician placed in position (or position filled by physician) are events that describe a different business perspective than use cases.<a href="http://udidahan.weblogs.us/wp-content/uploads/image20.png"><img style="border-right: 0px; border-top: 0px; margin: 0px 0px 0px 10px; border-left: 0px; border-bottom: 0px" height="241" alt="image" src="http://udidahan.weblogs.us/wp-content/uploads/image-thumb17.png" width="244" align="right" border="0"></a></p>
<h3>5. How do I decide? </h3>
<p>Once we know what events there are, we can start looking at what kind of decisions we might want to make when those events occur and what data we&#8217;d need to make those decisions. These decisions may be as simple as updating a database or sending an email to a user. They also may include more advanced logic like when the profitability of an agreement with a specific hospital chain changes, prefer placing physicians in positions in that chain over others.</p>
<h3>6. How do I deal with all this information?</h3>
<p>After we have all of this information, we can start looking for cohesive bunching across all of these axes using these rules:</p>
<ul>
<li>Data that is modified by a use case gets published as an event.</li>
<li>Data that is required by a use case for read-only purposes, arrives as the result of subscribing to some event.</li>
</ul>
<p>Look for rules that differentiate behaviour based on the properties of data. Look for a correlation to some business concept. For instance, physicians probably won&#8217;t be changing their specialization, and open positions often deal with a certain specialization. Therefore, specific data instances tied to two different specializations can be said to be loosely coupled.</p>
<h3><strong>7. Which property slices across the domain?<a href="http://udidahan.weblogs.us/wp-content/uploads/image21.png"><img style="border-right: 0px; border-top: 0px; margin: 0px 0px 10px 10px; border-left: 0px; border-bottom: 0px" height="161" alt="image" src="http://udidahan.weblogs.us/wp-content/uploads/image-thumb18.png" width="244" align="right" border="0"></a> </strong></h3>
<p>Even though the ERD may not have made it clear, and the use cases didn&#8217;t show any particular break-down, nor did the events call out this point, the key to finding the way a business domain decomposes into services lies in decoupling specific data instances.</p>
<p>Actually, at this point we can clump autonomous components (mere technical bits) that handle a single message, into more granular business components.</p>
<blockquote><p>If you think about it, it makes a lot of sense. The kind of credential checking you&#8217;d do for physicians specializing in brain surgery would likely be different than for general practitioners. The kind of information you&#8217;d store would, therefore, also be different.</p>
</blockquote>
<h3>But, which services do I need?</h3>
<p>Quite frankly, I don&#8217;t have enough information to know. </p>
<p>But if we had continued this conversation, going through issues like transactional consistency, availability requirements, and other non-functional issues we could have&nbsp; gotten there. </p>
<p>If there&#8217;s one thing that I hope you got out of this, it&#8217;s that the questions are what&#8217;s important. The iterative process of looking at the problem domain from various perspectives, incorporating the new-found knowledge, and asking more questions is what leads us to a solution. But we don&#8217;t stop there. We keep looking for characteristics which split services apart into business components, and for consistency requirements that brings autonomous components together into services.</p>
<p>It&#8217;s not easy, but by focusing on these simple questions, you can get to a coherent service oriented architecture.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/05/16/7-simple-questions-for-service-selection/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>[Video] Messaging and Architecture Discussion at ALT.NET</title>
		<link>http://www.udidahan.com/2008/04/28/video-messaging-and-architecture-discussion-at-altnet/</link>
		<comments>http://www.udidahan.com/2008/04/28/video-messaging-and-architecture-discussion-at-altnet/#comments</comments>
		<pubDate>Mon, 28 Apr 2008 21:53:00 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[Scalability]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/04/28/video-messaging-and-architecture-discussion-at-altnet/</guid>
		<description><![CDATA[In this video, Greg Young, Martin Fowler, Evan Hoff, Dru Sellers, myself and some others discussed various aspects of event-based systems, how Domain-Driven Design works with them, what role messaging has, and how all these connect to architectural properties like scalability and fault tolerance.
One of the questions that Martin started answering was how teams can [...]]]></description>
			<content:encoded><![CDATA[<p>In this video, <a href="http://codebetter.com/blogs/gregyoung/">Greg Young</a>, <a href="http://www.martinfowler.com/bliki/">Martin Fowler</a>, <a href="http://www.lostechies.com/blogs/evan_hoff/">Evan Hoff</a>, <a href="http://geekswithblogs.net/dsellers/Default.aspx">Dru Sellers</a>, myself and some others discussed various aspects of event-based systems, how Domain-Driven Design works with them, what role messaging has, and how all these connect to architectural properties like scalability and fault tolerance.</p>
<p>One of the questions that Martin started answering was how teams can start getting into the messaging state-of-mind. Unfortunately, the conversation veered off into what kind of messaging interactions are appropriate leaving the original question unanswered.</p>
<p>I&#8217;m hoping to address this topic with some of the information I&#8217;m putting up on the <a href="http://www.nServiceBus.com">nServiceBus site</a>. There&#8217;s always Gregor and Bobby&#8217;s excellent <a href="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&amp;camp=1789&amp;tag=thesoftwaresi-20&amp;creative=9325&amp;path=tg/detail/-/0321200683/qid=1117231639/sr=8-1/ref=pd_csp_1?v=glance%26s=books%26n=507846">EIP book</a> that I think is a must for anybody writing distributed systems.</p>
<p> <object id="viddler" height="370" width="437" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="_cx" value="11562"><param name="_cy" value="9790"><param name="FlashVars" value=""><param name="Movie" value="http://www.viddler.com/player/e8529fc5/"><param name="Src" value="http://www.viddler.com/player/e8529fc5/"><param name="WMode" value="Window"><param name="Play" value="0"><param name="Loop" value="-1"><param name="Quality" value="High"><param name="SAlign" value="LT"><param name="Menu" value="0"><param name="Base" value=""><param name="AllowScriptAccess" value="always"><param name="Scale" value="NoScale"><param name="DeviceFont" value="0"><param name="EmbedMovie" value="0"><param name="BGColor" value=""><param name="SWRemote" value=""><param name="MovieData" value=""><param name="SeamlessTabbing" value="1"><param name="Profile" value="0"><param name="ProfileAddress" value=""><param name="ProfilePort" value="0"><param name="AllowNetworking" value="all"><param name="AllowFullScreen" value="true"><embed src="http://www.viddler.com/player/e8529fc5/" width="437" height="370" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" name="viddler"></embed></object></p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/04/28/video-messaging-and-architecture-discussion-at-altnet/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Visual Cobol, Enterprise Processes, and SOA</title>
		<link>http://www.udidahan.com/2008/04/23/visual-cobol-enterprise-processes-and-soa/</link>
		<comments>http://www.udidahan.com/2008/04/23/visual-cobol-enterprise-processes-and-soa/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 15:15:08 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/04/23/visual-cobol-enterprise-processes-and-soa/</guid>
		<description><![CDATA[There&#8217;s a fairly intense discussion going on these days amongst the SOA illuminati. In the hopes that people will see me standing beside them and conclude that I too know something, I&#8217;ve decided to chip in.
Jim brought the concept of cohesion to the regular SOA discussions around loose coupling in his post Anemic Service Model, [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a fairly intense discussion going on these days amongst the SOA illuminati. In the hopes that people will see me standing beside them and conclude that I too know something, I&#8217;ve decided to chip in.</p>
<p>Jim brought the concept of cohesion to the regular SOA discussions around loose coupling in his post <a href="http://jim.webber.name/2008/04/19/30b4f0e9-f67a-4310-bf38-ca0a3423206e.aspx">Anemic Service Model</a>, which I think, all in all, is a very good idea.</p>
<h3>Naïve Service Composition</h3>
<p><a href="http://udidahan.weblogs.us/wp-content/uploads/image15.png"><img style="border-right: 0px; border-top: 0px; margin: 0px 10px; border-left: 0px; border-bottom: 0px" height="173" alt="image" src="http://udidahan.weblogs.us/wp-content/uploads/image-thumb12.png" width="124" align="right" border="0"></a> Jim first calls out a common anti-pattern that seems to have become quite rampant &#8211; I&#8217;d call it <a href="http://jim.webber.name/?img=77cfd6f8-b2e0-4abe-bbbd-94c09036a5d4">naïve service composition</a> if only the things being composed could even be called services. And I think the tone being set is correct &#8211; a service needs to meet a stronger set of criteria than just being able to be composed. Multiple services sharing the same logical data store (in that the same actual rows/data elements are managed by multiple services) probably means there&#8217;s an encapsulation problem here. I agree with Jim sentiment here:</p>
<blockquote><p>&#8220;On the one hand we&#8217;re inclined, and indeed encouraged by the SOA brigade, to think of this architecture as a good fit for purpose because it is very loosely coupled. Since every component or service is decoupled from every other component or service it should be possible to arrange and re-arrange them in a Lego-style in a myriad of useful ways. Building out &#8220;business services&#8221; from some more fundamental set of services is how the books tell us to do it. In fact we could even do that quite easily with point-and-[click] BPM tools, ruling out such overheads as developers and change management along the way. Right?&#8221;</p>
</blockquote>
<h3>MVC? There are, like, 6 of them!<a href="http://udidahan.weblogs.us/wp-content/uploads/image16.png"><img style="border-right: 0px; border-top: 0px; margin: 0px 10px; border-left: 0px; border-bottom: 0px" height="146" alt="image" src="http://udidahan.weblogs.us/wp-content/uploads/image-thumb13.png" width="133" align="right" border="0"></a> </h3>
<p> However, I disagree with some of the conclusions that Jim draws from that point. Jim states &#8220;build your services to implement business processes&#8221;, and that services are &#8220;just an instance of MVC&#8221;. I&#8217;m going to leave alone the MVC statement since there are like 6 documented kinds of MVC not including the Front Controller stuff that the web guys are now calling MVC. I&#8217;m going to focus on the business process advice. JJ also <a href="http://www.ebpml.org/blog/75.htm">doesn&#8217;t seem to agree with this advice</a>. As Savas has already <a href="http://savas.parastatidis.name/2008/04/22/0a938298-7e90-42e5-9ab0-64e0fd7c7184.aspx">taken issue</a> with the tone of JJ&#8217;s response, I&#8217;ll keep my focus on the content.</p>
<h3>Visual Cobol</h3>
<p>First of all, in my previous conversations with Jim he had already denounced the procedural nature of composing higher-level business processes out of smaller services which implement small bits of common activities. Visual Cobol was how he described it. In JJ&#8217;s <a href="http://www.ebpml.org/blog/76.htm">follow-up post</a>, he called out the necessary aspect of autonomy that jives with Jim&#8217;s cohesion principle.</p>
<p>I&#8217;m a bit concerned about the way JJ tends to version what SOA means over time. It might make it impossible to have intelligent design discussions without tagging each sentence with &#8220;as SOA meant in 2006&#8243;. I acknowledge that the accepted meaning of SOA by various vendors has changed over the years. However, I&#8217;ve found that meanings rooted in decades of computer science tend to last and provide value that outlasts much of the industry-buzzword-bingo (SOA 2.0 anyone?).</p>
<h3>Cohesion, Business Domains, and Business Processes</h3>
<p><a href="http://udidahan.weblogs.us/wp-content/uploads/image17.png"><img style="border-right: 0px; border-top: 0px; margin: 0px 10px; border-left: 0px; border-bottom: 0px" height="204" alt="image" src="http://udidahan.weblogs.us/wp-content/uploads/image-thumb14.png" width="204" align="right" border="0"></a> My view of the original cohesion principles Steve discusses in his 2005 article <a href="http://steve.vinoski.net/pdf/IEEE-Old_Measures_for_New_Services.pdf">Old Measures for New Services</a> takes a business spin to Functional Cohesion:</p>
<blockquote><p>A service should be responsible for one business domain.</p>
</blockquote>
<p>If we jump off from this point, we&#8217;ll see that certain business processes which occur entirely in one business domain are fully encapsulated, whereas those macro-processes which cross many domains (like Order to Cash) cross multiple services &#8211; they do not become a service since that would break the &#8220;one business domain&#8221; rule. Given that services are loosely coupled, avoiding temporal coupling leads to services raising events. Thus, macro-processes are really just a series of events of various services where each service does its own internal business processes.</p>
<h3>Enterprise Processes &gt;&gt; Business Processes</h3>
<p>I think that maybe some of the difficulty in discussing concrete SOA guidance has to do with granularity. I&#8217;ve started calling those macro-processes something different from business processes, and that may just bring me full circle to Jim&#8217;s guidance.</p>
<blockquote><p>An Enterprise Process is any process which involves multiple business domains.</p>
</blockquote>
<p>Under that definition, a service may be responsible for multiple business processes in the same business domain. But still, one business process is usually not a service by itself.</p>
<h3>Business Components &amp; Autonomous Components to the Rescue</h3>
<p><a href="http://udidahan.weblogs.us/wp-content/uploads/image18.png"><img style="border-right: 0px; border-top: 0px; margin: 0px 10px; border-left: 0px; border-bottom: 0px" height="242" alt="image" src="http://udidahan.weblogs.us/wp-content/uploads/image-thumb15.png" width="183" align="right" border="0"></a> Finally, by introducing the additional levels of decomposition of business components and autonomous components I&#8217;ve found that we can focus the discourse on one concern at a time. My presentation on the topic can be found <a href="http://cid-c8ad44874742a74d.skydrive.live.com/self.aspx/Blog/Avoid_a_failed_SOA.ppsx">here</a>. The 30 second pitch is this:</p>
<blockquote><p>Business domains are inherently partitionable &#8211; data and rules. A business component represents one partition. An example of this is the domain of Sales being partitioned by strategic and non-strategic customers. Although the data structure might be similar or the same, the actual rows/data elements are not shared. Rules around discounts are different.</p>
<p>Within a business component, different activities should not interfere with each other. An autonomous component represents one activity. In our example, reporting on orders from strategic customers should not interfere with accepting their orders. As such, those activities should have different messages coming in on different endpoints. Each endpoint could have different characteristics, like durability. Losing a request for a report when a server restarts isn&#8217;t a big deal, however not a good idea for orders.</p>
</blockquote>
<p>For more information you could check out these episodes from my podcast:</p>
<blockquote><h4><b></b><a href="http://udidahan.weblogs.us/2006/08/28/podcast-business-and-autonomous-components-in-soa/">Business and Autonomous Components in SOA</a></h4>
<h4><a href="http://udidahan.weblogs.us/2007/06/02/podcast-using-autonomous-components-for-slas-in-soa/">Using Autonomous Components for SLAs in SOA</a></h4>
</blockquote>
<p>Questions and comments are always welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/04/23/visual-cobol-enterprise-processes-and-soa/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Sundblad Mistaken on Services</title>
		<link>http://www.udidahan.com/2008/03/16/sundblad-mistaken-on-services/</link>
		<comments>http://www.udidahan.com/2008/03/16/sundblad-mistaken-on-services/#comments</comments>
		<pubDate>Sun, 16 Mar 2008 13:29:39 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[Master Data Management]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/03/16/sundblad-mistaken-on-services/</guid>
		<description><![CDATA[The brilliant guys at 2xSundbland have launched their architect academy and it looks quite promising. I haven&#8217;t yet taken the trial lesson, but its in the queue. I have taken a look at the articles they have on the site as well, and they&#8217;re quite good. I especially like the Software Architecture vs. Software Engineering [...]]]></description>
			<content:encoded><![CDATA[<p>The brilliant guys at 2xSundbland have launched their <a href="http://academy.2xsundblad.com/">architect academy</a> and it looks quite promising. I haven&#8217;t yet taken the trial lesson, but its in the queue. I have taken a look at the articles they have on the site as well, and they&#8217;re quite good. I especially like the <a href="http://academy.2xsundblad.com/articles/Software_Architecture_vs_Software_Engineering.pdf">Software Architecture vs. Software Engineering</a> one. There is one topic in that article where I beg to differ, and it&#8217;s around services. The article (on page 7) describes the following scenario:</p>
<blockquote><p>Typically, in such an environment [SOA], services tend to be parts of multiple systems. For example, consider a Products service! It might start its life as part of a sales system. Later it might be involved in a purchasing system, a product development system, a marketing system, a warehousing system, and perhaps in several other systems too. This process may take years, and it really never ends. The service is the same, but its responsibilities and its external exposure are increased with each system it&#8217;s enrolled in.</p>
</blockquote>
<p>One of the core tenets of SOA that all vendors and analysts agree upon is that there should be <strong>loose coupling</strong> between services. If you were to design such a product service, it&#8217;s clear that changing part of its interface could break almost every system in the enterprise. That doesn&#8217;t sound like loose coupling to me.</p>
<p>If there&#8217;s one place that is the source of loose coupling &#8211; it&#8217;s the business. Warehousing is viewed by the business as being fairly independent of Marketing. While Sales might make use of data created in Product Development, business wouldn&#8217;t want any problems in IT related to Product Development to inhibit Sales ability to accept orders. That is another kind of loose coupling &#8211; the ability of one service to make use of &#8220;not-accurate-up-to-the-millisecond&#8221; data created by another service. That&#8217;s known as loose &#8220;temporal&#8221; coupling, as in <strong>loose coupling in the dimension of time</strong>.</p>
<h3>Loosely-Coupled Services</h3>
<p>So, in the example described we&#8217;d see the following services:</p>
<ul>
<li>Sales</li>
<li>Purchasing</li>
<li>Product Development</li>
<li>Marketing</li>
<li>Warehousing / Inventory</li>
</ul>
<p>Product data would flow between the services but each would have a very different internal view of it. </p>
<ul>
<li>Product Development would be more interested in managing the schedule and risk around a product&#8217;s development. </li>
<li>Marketing would probably be more focused on its relation to competing products and pricing. </li>
<li>Purchasing would be maintaining data as to which suppliers are being used to supply raw materials for the production of the product. </li>
<li>Sales would be looking at actually accepting orders and giving discounts.</li>
<li>Warehousing would be focused on the storage and transportation aspects of the product.</li>
</ul>
<p>As you can see, there is very little overlap in the data between these services even on something similar like product data. The logic of each service around the management of its data would be even more different. This leads to services with a high level of <strong>autonomy</strong>.</p>
<h3>There Be Dragons&#8230;</h3>
<p>Without starting at this business-level loose coupling, I doubt that any technical effort will succeed. That is to say every time I&#8217;ve seen this style implemented it has failed, but that&#8217;s no proof. Conversely, every time that we did start our SOA efforts by identifying the clear business fracture lines, we were able to maintain loose coupling all the way down. That is not to say that it always will succeed, but the logic is sound.</p>
<p>I suppose that the difference between my view on SOA and Sundblad&#8217;s stems from the fact that they put systems at a higher level of abstraction than services, and I put <strong>services on top</strong>. Regardless, I do agree with their views about architecture and engineering and consider them quite valuable. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/03/16/sundblad-mistaken-on-services/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Interested in SOA Training Videos?</title>
		<link>http://www.udidahan.com/2008/02/08/interested-in-soa-training-videos/</link>
		<comments>http://www.udidahan.com/2008/02/08/interested-in-soa-training-videos/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 03:57:33 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Courses]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/02/08/interested-in-soa-training-videos/</guid>
		<description><![CDATA[This past 2 weeks I was in Australia doing some in-depth training on Service Oriented Architecture, Enterprise Development, and nServiceBus implementation. We managed to record one full week of sessions and are in the process of compressing, editing, and other video whatever stuff.
I was wondering if any of my loyal subscribers would be interested in [...]]]></description>
			<content:encoded><![CDATA[<p>This past 2 weeks I was in Australia doing some in-depth training on Service Oriented Architecture, Enterprise Development, and nServiceBus implementation. We managed to record one full week of sessions and are in the process of compressing, editing, and other video whatever stuff.</p>
<p>I was wondering if any of my loyal subscribers would be interested in getting a set of DVDs containing Udi talking for hours and hours about how to identify services, map out cross-service business processes, zero in on business fracture points to further decompose services into business components, and decompose those into autonomous components by analyzing non-functional message properties,  summing up with using all that information for choosing cost-effective technologies for each autonomous component.</p>
<p>In other words, get 5 days of training you can pause, think about, and replay as many times as you need. There&#8217;s something for almost every phase of an enterprise project, from top level architecture, through coding, testing, to deployment tips and monitoring tactics, so you can pick up what you need &#8211; right when you need it.</p>
<p>Please bear with me as I get the processes in place for getting this out.</p>
<p>I&#8217;m wondering &#8211; how valuable do you think it would be to have weekly live online Q&amp;A sessions as opposed to the more asynchronous (and scalable) simple forum thing?</p>
<p>Just so I can see what I need to be preparing myself for, please leave a comment below expressing your interest. If you also know someone else who might benefit from this, drop them a link. The last thing I want to have happen is for this to take months and months to get out because I didn&#8217;t prepare things in advance that I could have.</p>
<p>And a big thanks to Simon and the gang in Australia for helping make this happen. It was a great two weeks and I thank you for that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/02/08/interested-in-soa-training-videos/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>NServiceBus implements Erlang Concurrency</title>
		<link>http://www.udidahan.com/2008/02/08/nservicebus-implements-erlang-concurrency/</link>
		<comments>http://www.udidahan.com/2008/02/08/nservicebus-implements-erlang-concurrency/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 14:19:07 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/02/08/nservicebus-implements-erlang-concurrency/</guid>
		<description><![CDATA[Going over the concurrency features of Erlang, the language famed for nine 9&#8217;s of uptime, I find that nServiceBus covers almost every single one.
Here&#8217;s the core list from Joe Armstrong&#8217;s book, Programming Erlang:
“In Erlang:

Creating and destroying processes is very fast.
Sending messages between processes is very fast.
Processess behave the same way on all operating systems.
We can [...]]]></description>
			<content:encoded><![CDATA[<p>Going over <a href="http://ulf.wiger.net/weblog/?p=10">the concurrency features of Erlang</a>, the language famed for nine 9&#8217;s of uptime, I find that nServiceBus covers almost every single one.</p>
<p>Here&#8217;s the core list from Joe Armstrong&#8217;s book, <a href="http://www.amazon.com/Programming-Erlang-Software-Concurrent-World/dp/193435600X/ref=pd_bbs_sr_1/105-5162226-7304414?ie=UTF8&amp;s=books&amp;qid=1184837752&amp;sr=8-1">Programming Erlang</a>:</p>
<blockquote><p>“In Erlang:</p>
<ul>
<li>Creating and destroying processes is very fast.</li>
<li>Sending messages between processes is very fast.</li>
<li>Processess behave the same way on all operating systems.</li>
<li>We can have very large numbers of processes.</li>
<li>Processes share no memory and are completely independent.</li>
<li>The only way for processes to interact is through message passing.”</li>
</ul>
</blockquote>
<p>In nServiceBus, we don&#8217;t create or destroy processes &#8211; that&#8217;s a Windows issue. Instead, we just do messaging with endpoints. If there&#8217;s a process behind that endpoint, and it responds, then other interesting things can occur.</p>
<p>In the continued list:</p>
<blockquote>
<ul>
<li>Message passing is asynchronous.</li>
<li>Processes can monitor each other.</li>
<li>It is possible to selectively receive messages.</li>
<li>Remote processes appear largely the same as local processes.</li>
</ul>
</blockquote>
<p>All of this is part of the design philosophy of nServiceBus. While I have yet to see a carrier-grade implementation of nServiceBus, we are enjoying very impressive system-wide uptimes in production. Oh, and the programming model is still plain-old .NET, so you don&#8217;t have to learn any new languages or environments (even though I think that you might learn something &#8211; I know I did).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/02/08/nservicebus-implements-erlang-concurrency/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sagas and Unit Testing &#8211; Business Process Verification Made Easy</title>
		<link>http://www.udidahan.com/2008/02/04/sagas-and-unit-testing-business-process-verification-made-easy/</link>
		<comments>http://www.udidahan.com/2008/02/04/sagas-and-unit-testing-business-process-verification-made-easy/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 13:09:51 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[Business Rules]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/02/04/sagas-and-unit-testing-business-process-verification-made-easy/</guid>
		<description><![CDATA[Sagas have always been designed with unit testing in mind. By keeping them disconnected from any communications or persistence technology, it was my belief that it should be fairly easy to use mock objects to test them. I&#8217;ve heard back from projects using nServiceBus this way that they were pleased with their ability to test [...]]]></description>
			<content:encoded><![CDATA[<p>Sagas have always been designed with unit testing in mind. By keeping them disconnected from any communications or persistence technology, it was my belief that it should be fairly easy to use mock objects to test them. I&#8217;ve heard back from projects using nServiceBus this way that they were pleased with their ability to test them, and thought all was well.</p>
<p>Not so.</p>
<p>The other day I sat down to implement and test a non-trivial business process, and the testing was far from easy. Now as developers go, I&#8217;m not great, or an expert on unit testing or TDD, but I&#8217;m above average. It should not have been this hard. And I tried doing it with <a href="http://www.ayende.com/projects/rhino-mocks.aspx">Rhino.Mocks</a>, <a href="http://www.typemock.com/">TypeMock</a>, and finally <a href="http://code.google.com/p/moq/">Moq</a>. It seemed like I was in a no-mans-land, between trying to do state-based testing, and setting expectations on the messages being sent (as well as correct values in those messages), nothing flowed.</p>
<p>Until I finally stopped trying to figure out how to test, and focused on what needed to be tested. I mean, it&#8217;s not like I was trying to build a generic mocking framework like <a href="http://feeds.feedburner.com/~r/DanielCazzulino/~3/228130195/NewMoqfeaturesformockverificationandcreation.aspx">Daniel</a>.</p>
<p>Here&#8217;s an example business process, or actually, part of one, and then we&#8217;ll see how that can be tested. By the way, there will be a post coming soon which describes how we go about analysing a system, coming up with these message types, and how these sagas come into being, so stay tuned. Either that, or just come to <a href="http://qcon.infoq.com/london/presentation/Build+Scalable%2C+Maintainable%2C+Distributed+Enterprise+.NET+Solutions+with+nServiceBus">my tutorial at QCon.</a></p>
<p>On with the process:</p>
<blockquote><p>1. When we receive a CreateOrderMessage, whose “Completed” flag is true, we’ll send 2 AuthorizationRequestMessages to internal systems (for managers to authorize the order), one OrderStatusUpdatedMessage to the caller with a status “Received”, and a TimeoutMessage to the TimeoutManager requesting to be notified – so that the process doesn’t get stuck if one or both messages don’t get a response.</p>
<p>2. When we receive the first AuthorizationResponseMessage, we notify the initiator of the Order by sending them a OrderStatusUpdatedMessage with a status “Authorized1”.</p>
<p>3. When we get “timed out” from the TimeoutManager, we check if at least one AuthorizationResponseMessage has arrived, and if so, publish an OrderAcceptedMessage, and notify the initator (again via the OrderStatusUpdatedMessage) this time with a status of “Accepted”.</p></blockquote>
<p>And here&#8217;s the test:</p>
<div style="overflow: scroll; width: 95%"><!-- code formatted by http://manoli.net/csharpformat/ --><br />
<style type="text/css">            .csharpcode, .csharpcode pre  {  	font-size: small;  	color: black;  	font-family: consolas, "Courier New", courier, monospace;  	background-color: #ffffff;  	/*white-space: pre;*/  }  .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt   {  	background-color: #f4f4f4;  	width: 100%;  	margin: 0em;  } .csharpcode .lnum { color: #606060; }</style>
<pre class="csharpcode">    <span class="kwrd">public</span> <span class="kwrd">class</span> OrderSagaTests
    {
        <span class="kwrd">private</span> OrderSaga orderSaga = <span class="kwrd">null</span>;
        <span class="kwrd">private</span> <span class="kwrd">string</span> timeoutAddress;
        <span class="kwrd">private</span> Saga Saga;     

        [SetUp]
        <span class="kwrd">public</span> <span class="kwrd">void</span> Setup()
        {
            timeoutAddress = <span class="str">"timeout"</span>;
            Saga = Saga.Test(<span class="kwrd">out</span> orderSaga, timeoutAddress);
        }     

        [Test]
        <span class="kwrd">public</span> <span class="kwrd">void</span> OrderProcessingShouldCompleteAfterOneAuthorizationAndOneTimeout()
        {
            Guid externalOrderId = Guid.NewGuid();
            Guid customerId = Guid.NewGuid();
            <span class="kwrd">string</span> clientAddress = <span class="str">"client"</span>;     

            CreateOrderMessage createOrderMsg = <span class="kwrd">new</span> CreateOrderMessage();
            createOrderMsg.OrderId = externalOrderId;
            createOrderMsg.CustomerId = customerId;
            createOrderMsg.Products = <span class="kwrd">new</span> List&lt;Guid&gt;(<span class="kwrd">new</span> Guid[] { Guid.NewGuid() });
            createOrderMsg.Amounts = <span class="kwrd">new</span> List&lt;<span class="kwrd">float</span>&gt;(<span class="kwrd">new</span> <span class="kwrd">float</span>[] { 10.0F });
            createOrderMsg.Completed = <span class="kwrd">true</span>;     

            TimeoutMessage timeoutMessage = <span class="kwrd">null</span>;     

            Saga.WhenReceivesMessageFrom(clientAddress)
                .ExpectSend&lt;AuthorizeOrderRequestMessage&gt;(
                    <span class="kwrd">delegate</span>(AuthorizeOrderRequestMessage m)
                    {
                        <span class="kwrd">return</span> m.SagaId == orderSaga.Id;
                    })
                .ExpectSend&lt;AuthorizeOrderRequestMessage&gt;(
                    <span class="kwrd">delegate</span>(AuthorizeOrderRequestMessage m)
                    {
                        <span class="kwrd">return</span> m.SagaId == orderSaga.Id;
                    })
                .ExpectSendToDestination&lt;OrderStatusUpdatedMessage&gt;(
                    <span class="kwrd">delegate</span>(<span class="kwrd">string</span> destination, OrderStatusUpdatedMessage m)
                    {
                        <span class="kwrd">return</span> m.OrderId == externalOrderId &amp;&amp; destination == clientAddress;
                    })
                .ExpectSendToDestination&lt;TimeoutMessage&gt;(
                    <span class="kwrd">delegate</span>(<span class="kwrd">string</span> destination, TimeoutMessage m)
                    {
                        timeoutMessage = m;
                        <span class="kwrd">return</span> m.SagaId == orderSaga.Id &amp;&amp; destination == timeoutAddress;
                    })
                .When(<span class="kwrd">delegate</span> { orderSaga.Handle(createOrderMsg); });     

            Assert.IsFalse(orderSaga.Completed);     

            AuthorizeOrderResponseMessage response = <span class="kwrd">new</span> AuthorizeOrderResponseMessage();
            response.ManagerId = Guid.NewGuid();
            response.Authorized = <span class="kwrd">true</span>;
            response.SagaId = orderSaga.Id;     

            Saga.ExpectSendToDestination&lt;OrderStatusUpdatedMessage&gt;(
                    <span class="kwrd">delegate</span>(<span class="kwrd">string</span> destination, OrderStatusUpdatedMessage m)
                    {
                        <span class="kwrd">return</span> (destination == clientAddress &amp;&amp;
                                m.OrderId == externalOrderId &amp;&amp;
                                m.Status == OrderStatus.Authorized1);
                    })
                .When(<span class="kwrd">delegate</span> { orderSaga.Handle(response); });     

            Assert.IsFalse(orderSaga.Completed);     

            Saga.ExpectSendToDestination&lt;OrderStatusUpdatedMessage&gt;(
                    <span class="kwrd">delegate</span>(<span class="kwrd">string</span> destination, OrderStatusUpdatedMessage m)
                    {
                        <span class="kwrd">return</span> (destination == clientAddress &amp;&amp;
                                m.OrderId == externalOrderId &amp;&amp;
                                m.Status == OrderStatus.Accepted);
                    })
                .ExpectPublish&lt;OrderAcceptedMessage&gt;(
                    <span class="kwrd">delegate</span>(OrderAcceptedMessage m)
                    {
                        <span class="kwrd">return</span> (m.CustomerId == customerId);
                    })
                .When(<span class="kwrd">delegate</span> { orderSaga.Timeout(timeoutMessage.State); });     

            Assert.IsTrue(orderSaga.Completed);
        }
    }</pre>
</div>
<p>You might notice that this style is a bit similar to the fluent testing found in Rhino Mocks. That&#8217;s not coincidence. It actually makes use of Rhino Mocks internally. The thing that I discovered was that in order to test these sagas, you don&#8217;t need to actually see a mocking framework. All you should have to do is express how messages get sent, and under what criteria those messages are valid.</p>
<p>If you&#8217;re wondering what the OrderSaga looks like, you can find the code right here. It&#8217;s not a complete business process implementation, but its enough to understand how one would look like:</p>
<div style="overflow: scroll; width: 95%"><!-- code formatted by http://manoli.net/csharpformat/ --><br />
<style type="text/css">            .csharpcode, .csharpcode pre  {  	font-size: small;  	color: black;  	font-family: consolas, "Courier New", courier, monospace;  	background-color: #ffffff;  	/*white-space: pre;*/  }  .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt   {  	background-color: #f4f4f4;  	width: 100%;  	margin: 0em;  } .csharpcode .lnum { color: #606060; }</style>
<pre class="csharpcode"><span class="kwrd">using</span> System;
<span class="kwrd">using</span> System.Collections.Generic;
<span class="kwrd">using</span> ExternalOrderMessages;
<span class="kwrd">using</span> NServiceBus.Saga;
<span class="kwrd">using</span> NServiceBus;
<span class="kwrd">using</span> InternalOrderMessages;     

<span class="kwrd">namespace</span> ProcessingLogic
{
    [Serializable]
    <span class="kwrd">public</span> <span class="kwrd">class</span> OrderSaga : ISaga&lt;CreateOrderMessage&gt;,
        ISaga&lt;AuthorizeOrderResponseMessage&gt;,
        ISaga&lt;CancelOrderMessage&gt;
    {
        <span class="preproc">#region</span> config info     

        [NonSerialized]
        <span class="kwrd">private</span> IBus bus;
        <span class="kwrd">public</span> IBus Bus
        {
            set { <span class="kwrd">this</span>.bus = <span class="kwrd">value</span>; }
        }     

        [NonSerialized]
        <span class="kwrd">private</span> Reminder reminder;
        <span class="kwrd">public</span> Reminder Reminder
        {
            set { <span class="kwrd">this</span>.reminder = <span class="kwrd">value</span>; }
        }     

        <span class="preproc">#endregion</span>     

        <span class="kwrd">private</span> Guid id;
        <span class="kwrd">private</span> <span class="kwrd">bool</span> completed;
        <span class="kwrd">public</span> <span class="kwrd">string</span> clientAddress;
        <span class="kwrd">public</span> Guid externalOrderId;
        <span class="kwrd">public</span> <span class="kwrd">int</span> numberOfPendingAuthorizations = 2;
        <span class="kwrd">public</span> List&lt;CreateOrderMessage&gt; orderItems = <span class="kwrd">new</span> List&lt;CreateOrderMessage&gt;();     

        <span class="kwrd">public</span> <span class="kwrd">void</span> Handle(CreateOrderMessage message)
        {
            <span class="kwrd">this</span>.clientAddress = <span class="kwrd">this</span>.bus.SourceOfMessageBeingHandled;
            <span class="kwrd">this</span>.externalOrderId = message.OrderId;     

            <span class="kwrd">this</span>.orderItems.Add(message);     

            <span class="kwrd">if</span> (message.Completed)
            {
                <span class="kwrd">for</span> (<span class="kwrd">int</span> i = 0; i &lt; <span class="kwrd">this</span>.numberOfPendingAuthorizations; i++)
                {
                    AuthorizeOrderRequestMessage req = <span class="kwrd">new</span> AuthorizeOrderRequestMessage();
                    req.SagaId = <span class="kwrd">this</span>.id;
                    req.OrderData = orderItems;     

                    <span class="kwrd">this</span>.bus.Send(req);
                }
            }     

            <span class="kwrd">this</span>.SendUpdate(OrderStatus.Recieved);     

            <span class="kwrd">this</span>.reminder.ExpireIn(message.ProvideBy - DateTime.Now, <span class="kwrd">this</span>, <span class="kwrd">null</span>);
        }     

        <span class="kwrd">public</span> <span class="kwrd">void</span> Timeout(<span class="kwrd">object</span> state)
        {
            <span class="kwrd">if</span> (<span class="kwrd">this</span>.numberOfPendingAuthorizations &lt;= 1)
                <span class="kwrd">this</span>.Complete();
        }     

        <span class="kwrd">public</span> Guid Id
        {
            get { <span class="kwrd">return</span> id; }
            set { id = <span class="kwrd">value</span>; }
        }     

        <span class="kwrd">public</span> <span class="kwrd">bool</span> Completed
        {
            get { <span class="kwrd">return</span> completed; }
        }     

        <span class="kwrd">public</span> <span class="kwrd">void</span> Handle(AuthorizeOrderResponseMessage message)
        {
            <span class="kwrd">if</span> (message.Authorized)
            {
                <span class="kwrd">this</span>.numberOfPendingAuthorizations--;     

                <span class="kwrd">if</span> (<span class="kwrd">this</span>.numberOfPendingAuthorizations == 1)
                    <span class="kwrd">this</span>.SendUpdate(OrderStatus.Authorized1);
                <span class="kwrd">else</span>
                {
                    <span class="kwrd">this</span>.SendUpdate(OrderStatus.Authorized2);
                    <span class="kwrd">this</span>.Complete();
                }
            }
            <span class="kwrd">else</span>
            {
                <span class="kwrd">this</span>.SendUpdate(OrderStatus.Rejected);
                <span class="kwrd">this</span>.Complete();
            }
        }     

        <span class="kwrd">public</span> <span class="kwrd">void</span> Handle(CancelOrderMessage message)
        {     

        }     

        <span class="kwrd">private</span> <span class="kwrd">void</span> SendUpdate(OrderStatus status)
        {
            OrderStatusUpdatedMessage update = <span class="kwrd">new</span> OrderStatusUpdatedMessage();
            update.OrderId = <span class="kwrd">this</span>.externalOrderId;
            update.Status = status;     

            <span class="kwrd">this</span>.bus.Send(<span class="kwrd">this</span>.clientAddress, update);
        }     

        <span class="kwrd">private</span> <span class="kwrd">void</span> Complete()
        {
            <span class="kwrd">this</span>.completed = <span class="kwrd">true</span>;     

            <span class="kwrd">this</span>.SendUpdate(OrderStatus.Accepted);     

            OrderAcceptedMessage accepted = <span class="kwrd">new</span> OrderAcceptedMessage();
            accepted.Products = <span class="kwrd">new</span> List&lt;Guid&gt;(<span class="kwrd">this</span>.orderItems.Count);
            accepted.Amounts = <span class="kwrd">new</span> List&lt;<span class="kwrd">float</span>&gt;(<span class="kwrd">this</span>.orderItems.Count);     

            <span class="kwrd">this</span>.orderItems.ForEach(<span class="kwrd">delegate</span>(CreateOrderMessage m)
                                        {
                                            accepted.Products.AddRange(m.Products);
                                            accepted.Amounts.AddRange(m.Amounts);
                                            accepted.CustomerId = m.CustomerId;
                                        });     

            <span class="kwrd">this</span>.bus.Publish(accepted);
        }
    }
}</pre>
</div>
<p>All this code is online in the subversion repository under /Samples/Saga.</p>
<p>Questions, comments, and general thoughts are always appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/02/04/sagas-and-unit-testing-business-process-verification-made-easy/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Differentiated UX &#8211; my a$$</title>
		<link>http://www.udidahan.com/2008/02/04/differentiated-ux-my-a/</link>
		<comments>http://www.udidahan.com/2008/02/04/differentiated-ux-my-a/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 10:41:25 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[Smart Client]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/02/04/differentiated-ux-my-a/</guid>
		<description><![CDATA[As if there wasn&#8217;t enough stuff for developers to deal with.
After the grand release of WPF, and the industry&#8217;s collective shrug and back to business, Microsoft stirs the pot again.
I&#8217;ve read Brian&#8217;s authoritative description, even done some of the examples he&#8217;s outlined, and let me tell you, tech won&#8217;t help.
Again.
I don&#8217;t know about differentiation, but [...]]]></description>
			<content:encoded><![CDATA[<p>As if there wasn&#8217;t enough stuff for developers to deal with.</p>
<p>After the grand release of WPF, and the industry&#8217;s collective shrug and back to business, Microsoft stirs the pot again.</p>
<p>I&#8217;ve read Brian&#8217;s authoritative <a href="http://briannoyes.net/2008/01/07/DifferentiatedUserExperienceUX.aspx">description</a>, even done some of the examples he&#8217;s outlined, and let me tell you, tech won&#8217;t help.</p>
<p>Again.</p>
<p>I don&#8217;t know about differentiation, but empowerment is important. Make the system work for the user. What an idea.</p>
<p>Let the user specify minimal inventory levels for products, and rules for replenishing. Give them a dashboard where they can see the status &#8211; what&#8217;s back ordered, orders expected to be authorized in the next relevant time interval, recent supplier timeliness, etc. If you&#8217;re thinking that this ties in to Event Driven Architecture, you&#8217;re right. Let the user subscribe to business events that interest them, pop up a messenger-like notification when they occur. Let the user click on the data in there, and have the rest of the UI synchronize around that. </p>
<p>Purchasing has struck a new deal with a supplier? Let me know. Click. Products they supply open in one view. Suppliers providing the same or similar products open in another. Contact info in another. Replenishment times in another.</p>
<p>Everything synchronized. Everything in real time. </p>
<p>Let them seamlessly work connected and disconnected.</p>
<p>You do that with regular boring winforms, and they&#8217;ll kiss the ground you walk on.</p>
<p>Differentiated user experience? Shrug.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/02/04/differentiated-ux-my-a/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>[Podcast] Message Ordering: Is it Cost Effective?</title>
		<link>http://www.udidahan.com/2008/01/01/podcast-message-ordering-is-it-cost-effective/</link>
		<comments>http://www.udidahan.com/2008/01/01/podcast-message-ordering-is-it-cost-effective/#comments</comments>
		<pubDate>Tue, 01 Jan 2008 23:01:16 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Ask Udi Podcast]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Threading]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/01/01/podcast-message-ordering-is-it-cost-effective/</guid>
		<description><![CDATA[In this podcast we&#8217;ll be discussing the issues around multi-threaded processing of messages by a service, specifically that the processing of message received second may be finished before that of the first. This scenario tends to rear its ugly head at higher levels of load and is critical for correctness in high-scalability environments.
Our long time [...]]]></description>
			<content:encoded><![CDATA[<p>In this podcast we&#8217;ll be discussing <span class="greenBlurb">the issues around multi-threaded processing of messages by a service, specifically that the processing of message received second may be finished before that of the first. This scenario tends to rear its ugly head at higher levels of load and is critical for correctness in high-scalability environments.</span></p>
<p>Our long time listener Bill asks:</p>
<blockquote><p> Hi Udi,</p>
<p>I have a question  around processing of messages in proper order.  When leveraging multiple  threads to process messages in a message queue, it is possible for the  second message in the queue to get processed before the first &#8211; especially  if the first message is considerably larger than the second.  I have taken  a lot of care to make sure that messages are sent in the correct order, only to  find that the receiving system can process them out of order  anyway.</p>
<p>Consider a  Policy Created notification, which must come before a Policy Approved  notification.  If both messages are sitting in the queue when the receiving  service starts up, the approval message can be processed before the creation  message. How can I make sure that message ordering is respected by the receiving  system?  I am using WCF/MSMQ as the underlying transport by the way.   The only way I have found so far is to limit the receiving service to a single  thread, which is by no means desirable.</p>
<p>Best  Regards,</p>
<p>Bill</p></blockquote>
<h3>Download</h3>
<p><a href="http://www.ddj.com/architect/205206017">Download via the Dr. Dobb&#8217;s site</a></p>
<p>Or download directly <a href="http://www.dobbsprojects.com/media/newengine/dynamp.php/071231ud01.mp3?podcast=071231ud01.mp3">here</a>.</p>
<h3>Additional References</h3>
<ul>
<li>Blog post: <a href="http://udidahan.weblogs.us/2007/12/09/in-order-messaging-a-myth/">In-Order Messaging a Myth?</a></li>
<li>Blog post: <a href="http://udidahan.weblogs.us/2007/12/15/handling-messages-out-of-order/">Handling Messages out of Order</a></li>
</ul>
<h3>Want more?</h3>
<p>Check out the <a href="/ask-udi/">“Ask Udi”</a> archives.</p>
<h3>Got a question?</h3>
<p><a href="mailto:podcast@UdiDahan.com">Send Udi your question to answer on the show.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/01/01/podcast-message-ordering-is-it-cost-effective/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://www.dobbsprojects.com/media/newengine/dynamp.php/071231ud01.mp3?podcast=071231ud01.mp3" length="0" type="audio/mp3" />
		</item>
		<item>
		<title>Handling messages out of order</title>
		<link>http://www.udidahan.com/2007/12/15/handling-messages-out-of-order/</link>
		<comments>http://www.udidahan.com/2007/12/15/handling-messages-out-of-order/#comments</comments>
		<pubDate>Sat, 15 Dec 2007 23:22:24 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Availability]]></category>
		<category><![CDATA[Data Access]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Threading]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/12/15/handling-messages-out-of-order/</guid>
		<description><![CDATA[I wanted to follow up on my recent post, &#8220;In order messaging a myth?&#8221; by showing the exact code that solves the issue. I have a podcast waiting to come online that deals with the specifics, so keep your eye out for that too.
The important thing to note is that if we just automatically return [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to follow up on my recent post, &#8220;<a href="http://udidahan.weblogs.us/2007/12/09/in-order-messaging-a-myth/">In order messaging a myth?</a>&#8221; by showing the exact code that solves the issue. I have a podcast waiting to come online that deals with the specifics, so keep your eye out for that too.</p>
<p>The important thing to note is that if we just automatically return the message to the queue, we may get &#8220;stuck&#8221; with that message if the first PolicyCreatedMessage never arrived. This opens us up to a Denial-of-Service attack by quite simply flooding us with a bunch of messages that never get cleaned up.</p>
<p>Anyway, the general idea is to first try the regular happy path, and only if we see that prerequisite data isn&#8217;t available, do we see if another thread may be working on that data. This is done by decreasing the isolation level of our transaction from the regular ReadCommitted to ReadUncommitted. This will enable our thread to see if some other thread inserted the policy in to the Policies table but hasn&#8217;t committed its transaction yet.</p>
<div style="overflow: auto; ">
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">public</span> <span style="COLOR: blue">class</span> <span style="COLOR: #2b91af">PolicyApprovedMessageHandler</span> : BaseDBMessageHandler&lt;PolicyApprovedMessage&gt;<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">public</span> <span style="COLOR: blue">override</span> <span style="COLOR: blue">void</span> Handle(PolicyApprovedMessage message)<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">bool</span> policyExists = <span style="COLOR: blue">true</span>;<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p><font size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">using</span> (<span style="COLOR: #2b91af">ISession</span> s = OpenSession())<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">using</span> (<span style="COLOR: #2b91af">ITransaction</span> tx = s.BeginTransaction(<span style="COLOR: #2b91af">IsolationLevel</span>.ReadCommitted))<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Policy p = s.Get&lt;Policy&gt;(message.PolicyId);<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p><font size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">if</span> (p != <span style="COLOR: blue">null</span>)<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>p.Approve();<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>tx.Commit();<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">else<o:p></o:p></span></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>policyExists = <span style="COLOR: blue">false</span>;<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p><font size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">if</span> (!policyExists) <span style="COLOR: green">// check to make sure<o:p></o:p></span></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">using</span> (<span style="COLOR: #2b91af">ISession</span> s = OpenSession())<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes">&nbsp;</span><span style="COLOR: blue">using</span> (<span style="COLOR: #2b91af">ITransaction</span> tx = s.BeginTransaction(<span style="COLOR: #2b91af">IsolationLevel</span>.ReadUncommitted))<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Policy p = s.Get&lt;Policy&gt;(message.PolicyId);<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p><font size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">if</span> (p != <span style="COLOR: blue">null</span>) <span style="COLOR: green">// another thread hasn&#8217;t committed its tx yet, so try message again later<o:p></o:p></span></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">this</span>.bus.HandleCurrentMessageLater();<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">else<o:p></o:p></span></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">this</span>.bus.Return((<span style="COLOR: blue">int</span>)ErrorCodes.PolicyNotFound);<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 10pt"><span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><font size="3"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>}</font></span><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%"><o:p></o:p></span></p>
</div>
<p>The next step will be how we take this code and make it generic, so that we don&#8217;t have write the same code over and over again for the different kinds of message handlers we have.</p>
<p>But that will have to wait until the next installment <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/12/15/handling-messages-out-of-order/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>In-Order Messaging a Myth?</title>
		<link>http://www.udidahan.com/2007/12/09/in-order-messaging-a-myth/</link>
		<comments>http://www.udidahan.com/2007/12/09/in-order-messaging-a-myth/#comments</comments>
		<pubDate>Sun, 09 Dec 2007 06:00:04 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/12/09/in-order-messaging-a-myth/</guid>
		<description><![CDATA[I got this question the other day from one of my long-time readers Bill about nServiceBus and I thought I&#8217;d share:
I have a question around processing of messages in proper order.&#160; When leveraging multiple threads to process messages in a message queue, it is possible for the second message in the queue to get processed [...]]]></description>
			<content:encoded><![CDATA[<p>I got this question the other day from one of my long-time readers Bill about <a href="http://www.nServiceBus.com">nServiceBus</a> and I thought I&#8217;d share:</p>
<blockquote><p>I have a question around processing of messages in proper order.&#160; When leveraging multiple threads to process messages in a message queue, it is possible for the second message in the queue to get processed before the first &#8211; especially if the first message is considerably larger than the second.&#160; I have taken a lot of care to make sure that messages are sent in the correct order, only to find that the receiving system can process them out of order anyway.</p>
<p>Consider a Policy Created notification, which must come before a Policy Approved notification.&#160; If both messages are sitting in the queue when the receiving service starts up, the approval message can be processed before the creation message. How can I make sure that message ordering is respected by the receiving system?&#160; I am using <a href="http://udidahan.weblogs.us/category/wcf">WCF</a>/<a href="http://udidahan.weblogs.us/category/msmq">MSMQ</a> as the underlying transport by the way.&#160; The only way I have found so far is to limit the receiving service to a single thread, which is by no means desirable.</p>
</blockquote>
<p>Well, the solution is really quite simple (at first). </p>
<p>If you&#8217;ve received a message that you think has arrived out of order, just call:</p>
<p><font face="Consolas" size="4">this.bus.HandleCurrentMessageLater();</font></p>
<p>and that will put the message back at the end of the queue. </p>
<p>Once you start considering the fact that you don&#8217;t know when the first message is supposed to arrive, you might turn to using a <a href="http://udidahan.weblogs.us/category/workflow">workflow</a> to handle the logic. The workflow would store the policy id, and then allow for N round-trips, before it decided that something bad had happened (like the Policy Created message getting lost), and then it could forward that to an operator, or possibly contact the first system and ask for a replay of the policy created message &#8211; or whatever automated fault resolution protocol you like.</p>
<p>In other words, message ordering is probably more trouble than its worth.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/12/09/in-order-messaging-a-myth/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Creating Stateful Services with NServiceBus</title>
		<link>http://www.udidahan.com/2007/10/04/creating-stateful-services-with-nservicebus/</link>
		<comments>http://www.udidahan.com/2007/10/04/creating-stateful-services-with-nservicebus/#comments</comments>
		<pubDate>Thu, 04 Oct 2007 23:40:58 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[Caching]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/10/04/creating-stateful-services-with-nservicebus/</guid>
		<description><![CDATA[On one of the projects I&#8217;m consulting on they needed some special behavior to handle the following scenario:

Since the service needs to perform all request processing in near-real-time, it caches all data from the DB in memory (yes, that&#8217;s a lot of memory). Since the service needs to handle multiple requests concurrently, we&#8217;re using multiple [...]]]></description>
			<content:encoded><![CDATA[<p>On one of the projects I&#8217;m consulting on they needed some special behavior to handle the following scenario:</p>
<blockquote><p>
Since the service needs to perform all request processing in near-real-time, it caches all data from the DB in memory (yes, that&#8217;s a lot of memory). Since the service needs to handle multiple requests concurrently, we&#8217;re using multiple threads (so far, so good). The problem is that we don&#8217;t want the service to handle messages received until it&#8217;s finished caching everything. Also, we don&#8217;t want that check to show up in every message handler (important when you have lots of message types).
</p></blockquote>
<p>This is actually quite easy to do with <a href="http://www.NServiceBus.com">NServiceBus</a>. Here&#8217;s how:</p>
<p>Have a thread-safe class, let&#8217;s call it Loader, for the API to the caching. Something along the lines of:</p>
<p>If (!Loader.HasCachedEverything)<br />
&nbsp;&nbsp;Loader.CacheEverything();</p>
<p>Obviously, the Loader will have internal logic for checking if it has already started loading things from the DB, so that it won&#8217;t do the same thing twice. </p>
<p>OK, now on to the interesting stuff.</p>
<p>We&#8217;d like to have the above code run no matter which kind of message we&#8217;ve received, so we just write a &#8220;generic&#8221; message handler &#8211; which handles &#8220;IMessage&#8221; like so:</p>
<div style="border: solid black 1px; background-color:beige; padding: 0em 1em; overflow:auto; width:550; font-family:courier">
public class CachingMessageHandler : BaseMessageHandler&lt;IMessage&gt;<br />
{<br />
&nbsp;&nbsp;public void Handle(IMessage message)<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;If (!Loader.HasCachedEverything)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Loader.CacheEverything();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.bus.HandleCurrentMessageLater();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.CanContinue = false;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
}
</div>
<p>When the message handler calls &#8220;HandleCurrentMessageLater&#8221;, the bus puts the current message in the back of the queue. If you&#8217;ve configured a transactional transport, this will be safe even in the case of a server restart.</p>
<p>Also, notice the &#8220;CanContinue = false&#8221;. This tells the bus that the message should not be passed on to any other message handlers, even if there are those that are configured to handle it.</p>
<p>We&#8217;ll also package this class up by itself, keeping it separate from the core logic of the service &#8211; making it easier to version these cross cutting concerns and the service logic. Let&#8217;s put it in &#8220;CrossCuttingConcerns.dll&#8221;</p>
<p>The final thing needed in order to achieve the behavior described above is to configure this message handler to run before any other handler. This is done in the config file of the process, under the &#8220;bus&#8221; object, in the &#8220;MessageHandlerAssemblies&#8221; property like so:</p>
<pre>
        &lt;property name="MessageHandlerAssemblies"&gt;
          &lt;list&gt;
            &lt;value&gt;CrossCuttingConcerns&lt;/value&gt;
            &lt;value>ServiceLogic&lt;/value&gt;
          &lt;/list&gt;
        &lt;/property&gt;
</pre>
<p>This is similar to the way HttpHandlers are (were?) configured in IIS &#8211; the order of the handlers defines the order in which the bus dispatches messages to them.</p>
<p>And that&#8217;s it.</p>
<p>We&#8217;re done.</p>
<p>If you have any questions you&#8217;d like to ask about NServiceBus, please feel free to send them my way: <a href="mailto:Questions@NServiceBus.com">Questions@NServiceBus.com</a>.</p>
<p>And just in closing I&#8217;d like to say that I don&#8217;t necessarily think you should be creating stateful services, but that there&#8217;s a time and place for everything.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/10/04/creating-stateful-services-with-nservicebus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t EDA between existing systems</title>
		<link>http://www.udidahan.com/2007/08/16/dont-eda-between-existing-systems/</link>
		<comments>http://www.udidahan.com/2007/08/16/dont-eda-between-existing-systems/#comments</comments>
		<pubDate>Thu, 16 Aug 2007 12:54:21 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[BPM]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Simplicity]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/08/16/dont-eda-between-existing-systems/</guid>
		<description><![CDATA[In Nick Malik&#8217;s great post, EDA: Avoiding coupling on the name he describes additional &#8220;handshakes&#8221; to be used to avoid the following problems:

Let&#8217;s say I have a system to handle a call center for financial services or telco.  When a customer calls on the phone and asks to be enrolled in &#8220;Heavily Advertised Program [...]]]></description>
			<content:encoded><![CDATA[<p>In Nick Malik&#8217;s great post, <a href="http://blogs.msdn.com/nickmalik/archive/2007/08/12/eda-avoiding-coupling-on-the-name.aspx">EDA: Avoiding coupling on the name</a> he describes additional &#8220;handshakes&#8221; to be used to avoid the following problems:</p>
<blockquote><p>
Let&#8217;s say I have a system to handle a call center for financial services or telco.  When a customer calls on the phone and asks to be enrolled in &#8220;Heavily Advertised Program ABC,&#8221; there may need to be three or four systems that interact to make that real.</p>
<p>&#8230;</p>
<p>Harry asks me to consider using a &#8216;logical name&#8217; of the receiver.  The sender contacts a logical end point, the addressing infrastructure turns that into a physical end point, and we still have decoupling.  </p>
<p>Honestly, I like it but I think it is insufficient.  What if we need to contact 20 downstream systems in a complex workflow, but I don&#8217;t want a single &#8220;orchestration coordinator&#8221; to be a bottleneck (or single point of failure).  I don&#8217;t want to hand the orchestration off from my app to a central orchestration hub.
</p></blockquote>
<p>Let me propose a different approach.</p>
<p>When we use SOA/EDA (the same thing as far as I&#8217;m concerned), the top-level building block used is the Service. A service may make use of a number of existing systems to perform its work. The business-level events that we publish (and subscribe to) are done by the service, not the existing systems.</p>
<p>If there&#8217;s any orchestration/workflow that needs to be done as a result of a service receiving an event, it is done entirely internal to that service. Inter-service orchestrations don&#8217;t really exist, as in there is no orchestration coordinator that is not in a service. And the orchestration coordinators within a service don&#8217;t touch other services&#8217; back-end systems &#8211; if anything, they publish other business level events.</p>
<p>Be aware: when just starting out on an SOA, you&#8217;ll find that multiple Services make use of the same backend systems. This may be necessary, but not a desirable state to stay in for too long since it embodies the most insidious and invisible kind of inter-service coupling there is.</p>
<p>I want to go back to Nick&#8217;s original question:</p>
<blockquote><p>So what if no one picks the message up?  Is that an error? </p></blockquote>
<p>The answer is mu.</p>
<p>If a service publishes a business-event (message) and no other services currently care, that&#8217;s fine. It&#8217;s not an error. Actually, you&#8217;d probably have some kind of infrastructure &#8220;queue&#8221; where messages that haven&#8217;t been received more than X time get sent to, so that the event isn&#8217;t &#8220;lost&#8221;. On the other hand, within a service &#8211; if an existing system sends out a message that <i>needs</i> to arrive at another system, and that message doesn&#8217;t arrive or isn&#8217;t picked up &#8220;in time&#8221;, that is an error.</p>
<p>This is one of the advantages SOA brings to the table in terms of EDA (again, the same as far as I&#8217;m concerned). You get simple messaging semantics between services, while within the &#8220;sphere of control&#8221; of a service you need, and more importantly can do more complex messaging and orchestration.</p>
<p>Bottom line: you need higher abstractions than your existing systems to employ EDA effectively.</p>
<p>You might also want to check out my podcast on this topic: <a href="http://udidahan.weblogs.us/2006/06/13/podcast-soa-esb-and-events-no-20/">SOA, ESB, and Events</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/08/16/dont-eda-between-existing-systems/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>[Podcast] Can We Do Away with Services and Just Leave the Messaging?</title>
		<link>http://www.udidahan.com/2007/08/11/podcast-can-we-do-away-with-services-and-just-leave-the-messaging/</link>
		<comments>http://www.udidahan.com/2007/08/11/podcast-can-we-do-away-with-services-and-just-leave-the-messaging/#comments</comments>
		<pubDate>Sat, 11 Aug 2007 09:18:38 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Ask Udi Podcast]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/08/11/podcast-can-we-do-away-with-services-and-just-leave-the-messaging/</guid>
		<description><![CDATA[This week we have a comment from a fellow SOA blogger, Jack van Hoof:

ESB&#8217;s are a lot about messaging and therefore a better name might be &#8220;Enterprise Data Bus&#8221;. It&#8217;s the asynchronous messaging that needs such an infrastructure with persistency and mediation facilities. All the WS-* standards are about messaging as well, leveraging the message [...]]]></description>
			<content:encoded><![CDATA[<p>This week we have a comment from a fellow SOA blogger, <a href="http://soa-eda.blogspot.com">Jack van Hoof</a>:</p>
<blockquote><p>
ESB&#8217;s are a lot about messaging and therefore a better name might be &#8220;Enterprise Data Bus&#8221;. It&#8217;s the asynchronous messaging that needs such an infrastructure with persistency and mediation facilities. All the WS-* standards are about messaging as well, leveraging the message itself to tell the infrastructure how it has to be handled. </p>
<p>I think WS-* will make it possible to have the ESB evolve from a vendor-product to a concept implemented in the operating systems an network devices that understand WS-*. Then you can leave the prefix &#8220;Enterprise&#8221; and we will be ready for an univeral asynchronous data bus over the Internet (or any other network you like). This will help breaking the current &#8220;services centric&#8221; idea of SOA into a &#8220;messages centric&#8221; perspective.</p>
<p>What are your thoughts?
</p></blockquote>
<p><a href="http://www.ddj.com/web-development/201306152">Download via the Dr. Dobb&#8217;s site</a></p>
<p>Or download directly <a href="http://www.dobbsprojects.com/media/newengine/dynamp.php/070808ud01.mp3?podcast=070808ud01.mp3">here</a>.</p>
<p><u>Additional References:</u></p>
<ul>
<li><a href="http://udidahan.weblogs.us/2006/06/02/podcast-does-an-soa-require-an-esb/">Podcast on if you need an ESB for SOA</a></li>
<li><a href="http://udidahan.weblogs.us/2007/03/29/podcast-enterprise-service-discovery/">Podcast on Enterprise Service Discovery</a></li>
<li><a href="http://soa-eda.blogspot.com/2006/11/esb-as-global-dataspace.html">Blog post on ESBs as a global dataspace</a></li>
<li><a href="http://soa-eda.blogspot.com/2006/06/brave-new-world-with-ws.html">Blog post about what the brave new world of WS-* brings us</a></li>
</ul>
<p><b>Want more?</b> Check out the <a href="/ask-udi/">&#8220;Ask Udi&#8221; archives</a>.</p>
<p><b>Got a question?</b> Have Udi answer it on the podcast &#8211; <a href="mailto:podcast@UdiDahan.com">podcast@UdiDahan.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/08/11/podcast-can-we-do-away-with-services-and-just-leave-the-messaging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.dobbsprojects.com/media/newengine/dynamp.php/070808ud01.mp3?podcast=070808ud01.mp3" length="13990964" type="audio/mp3" />
		</item>
		<item>
		<title>No such thing as a centralized ESB</title>
		<link>http://www.udidahan.com/2007/06/30/no-such-thing-as-a-centralized-esb/</link>
		<comments>http://www.udidahan.com/2007/06/30/no-such-thing-as-a-centralized-esb/#comments</comments>
		<pubDate>Sat, 30 Jun 2007 13:09:55 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[Availability]]></category>
		<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[SCA & SDO]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Scalability]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/06/30/no-such-thing-as-a-centralized-esb/</guid>
		<description><![CDATA[Via David McGhee&#8217;s Q&#038;A with Dr. Don Ferguson, but read the whole thing.

Q: Could you tell you your thoughts or preference for a distributed or centralized ESB? 
DON: there is no such thing as a centralized ESB.

This is the problem with a lot of the products that call themselves ESBs. They are centralized brokers which [...]]]></description>
			<content:encoded><![CDATA[<p>Via <a href="http://blogs.msdn.com/davidmcg/archive/2007/06/28/soa-esb-integration-in-the-real-world.aspx">David McGhee&#8217;s Q&#038;A</a> with <a href="http://www.microsoft.com/presspass/exec/techfellow/Ferguson/default.mspx">Dr. Don Ferguson</a>, but read the whole thing.</p>
<blockquote><p>
Q: Could you tell you your thoughts or preference for a distributed or centralized ESB? </p>
<p>DON: there is no such thing as a centralized ESB.
</p></blockquote>
<p>This is the problem with a lot of the products that call themselves ESBs. They are centralized brokers which may be clustered for availability. But they are in no way an implementation of the Bus Architectural Pattern. Please check this before cutting a check to your vendor.</p>
<p>Also, understand that if you do security related things in your ESB, possibly as a part of your routing rules, that if the security infrastructure is centralized that means your ESB is too. Even if it really was distributed to begin with.</p>
<p>Buyer beware.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/06/30/no-such-thing-as-a-centralized-esb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
