<?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; BizTalk</title>
	<atom:link href="http://www.udidahan.com/category/biztalk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.udidahan.com</link>
	<description>Enterprise Development Expert &#38; SOA Specialist</description>
	<lastBuildDate>Sun, 08 Jan 2012 12:45:00 +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>The Danger of Centralized Workflows</title>
		<link>http://www.udidahan.com/2011/07/13/the-danger-of-centralized-workflows/</link>
		<comments>http://www.udidahan.com/2011/07/13/the-danger-of-centralized-workflows/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 08:05:19 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[BPM]]></category>
		<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[Business Rules]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[OO]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=1493</guid>
		<description><![CDATA[It isn&#8217;t uncommon for me to have a client or student at one of my courses ask me about some kind of workflow tool. This could be Microsoft Workflow Foundation, BizTalk, K2, or some kind of BPEL/orchestration engine. The question usually revolves around using this tool for all workflows in the system as opposed to [...]]]></description>
			<content:encoded><![CDATA[<p>It isn&#8217;t uncommon for me to have a client or student at one of my courses ask me about some kind of workflow tool. This could be Microsoft Workflow Foundation, BizTalk, K2, or some kind of BPEL/orchestration engine. The question usually revolves around using this tool for all workflows in the system as opposed to the SOA-EDA-style publish/subscribe approach I espouse.</p>
<h3>The question</h3>
<p>The main touted benefit of these workflow-centric architectures is that we don&#8217;t have to change the code of the system in order to change its behavior resulting in ultimate flexibility!</p>
<p>Some of you may have already gone down this path and are shaking your heads remembering how your particular road to hell was paved with the exact same good intentions.</p>
<p>Let me explain why these things tend to go horribly wrong.</p>
<h3>What&#8217;s behind the curtain</h3>
<p>It starts with the very nature of workflow &#8211; a flow chart, is procedural in nature. First do this, then that, if this, then that, etc. As we&#8217;ve experienced first hand in our industry, procedural programming is fine for smaller problems but isn&#8217;t powerful enough to handle larger problems. That&#8217;s why we&#8217;ve come up with object-oriented programming.</p>
<p>I have yet to see an object-oriented workflow drag-and-drop engine. Yes, it works great for simple demo-ware apps. But if you try to through your most complex and volatile business logic at it, it will become a big tangled ball of spaghetti &#8211; just like if you were using text rather than pictures to code it.</p>
<p>And that&#8217;s one of the fundamental fallacies about these tools &#8211; you are still writing code. The fact that it doesn&#8217;t look like the rest of your code doesn&#8217;t change that fact. Changing the definition of your workflow in the tool IS changing your code. </p>
<h3>On productivity</h3>
<p>Sometimes people mention how much more productive it would be to use these tools than to write the code &#8220;by hand&#8221;. Occasionally I hear about an attempt to have &#8220;the business&#8221; use these tools to change the workflows themselves &#8211; without the involvement of developers (&#8221;imagine how much faster we could go without those pesky developers!&#8221;).</p>
<p>For those of us who have experienced this first-hand, we know that&#8217;s all wrong. </p>
<p>If &#8220;the business&#8221; is changing the workflows without developer involvement, invariably something breaks, and then they don&#8217;t know what to do. They haven&#8217;t been trained to think the way that developers have &#8211; they don&#8217;t really know how to debug. So the developers are brought back in anyway and from that point on, the business is once again giving requirements and the devs are the one implementing it.</p>
<p>Now when it comes to developer productivity, I can tell you that the keyboard is at least 10x more productive than the mouse. I can bang out an if statement in code much faster than draggy-dropping a diamond on the canvas, and two other activities for each side of the clause.</p>
<h3>On maintainability</h3>
<p>Sometimes the visualization of the workflow is presented as being much more maintainable than &#8220;regular code&#8221;. </p>
<p>When these workflows get to be to big/nested/reused, it ends up looking like the wiring diagram of an Intel chip (or worse). Check out the following diagram taken from the DailyWTF on a <a href="http://thedailywtf.com/Articles/The_Customer-Friendly_System.aspx">customer friendly system</a>:</p>
<p><img src="http://www.udidahan.com/wp-content/uploads/stateModel.gif" alt="stateModel" title="stateModel" width="500" height="564" /></p>
<p>The bigger these get, the less maintainable they are.</p>
<p>Now, some would push back on this saying that a method with 10,000 lines of code in it may be just as bad, if not worse. The thing is that these workflow tools guide developers down a path where it is very likely to end up with big, monolithic, procedural, nested code. When working in real code, we know we need to take responsibility for the cleanliness of our code using object-orientation, patterns, etc and refactoring things when they get too messy.</p>
<p>Here is where I&#8217;d bring up the SOA/pub-sub approach as an alternative &#8211; there is no longer this idea of a centralized anything. You have small pieces of code, each encapsulating a single business responsibility, working in concert with each other &#8211; reacting to each others events.</p>
<h3>Productivity take 2: testing and version control</h3>
<p>If you&#8217;re going to take your most complex and volatile business logic and put it into these workflow tools, have you thought about how your going to test it? How do you know that it works correctly? It tends to be VERY difficult to unit-test these kinds of workflows.</p>
<p>When a developer is implementing a change request, how do they know what other workflows might have been broken? Do they have to manually go through each and every scenario in the system to find out? How&#8217;s that for productivity?</p>
<p>Assuming something did break and the developer wants to see a diff &#8211; what&#8217;s different in the new workflow from the old one, what would that look like? When working with a team, the ability to diff and merge code is at the base of the overall team productivity.</p>
<p>What would happen to your team if you couldn&#8217;t diff or merge code anymore?<br />
In this day and age, it should be considered irresponsible to develop without these version control basics.</p>
<h3>In closing</h3>
<p>There are some cases where these tools might make sense, but those tend to be much more rare than you&#8217;d expect (and there are usually better alternatives anyway). Regardless, the architectural analysis should start without the assumption of centralized workflow, database, or centralized anything for that matter.</p>
<p>If someone tries to push one of these tools/architectures on you, don&#8217;t walk away &#8211; run!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2011/07/13/the-danger-of-centralized-workflows/feed/</wfw:commentRss>
		<slash:comments>45</slash:comments>
		</item>
		<item>
		<title>Integration: How and Where</title>
		<link>http://www.udidahan.com/2011/04/08/integration-how-and-where/</link>
		<comments>http://www.udidahan.com/2011/04/08/integration-how-and-where/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 09:18:41 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[ESB]]></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=1428</guid>
		<description><![CDATA[One of the topics that comes up a lot in the context of an Enterprise Service Bus (ESB) is that of integration. Unfortunately, many people take their ideas of reuse and design their integration as being done from a single place &#8211; both logical and physical. That unfortunately creates a bottleneck for all integration activities, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.udidahan.com/wp-content/uploads/integration.jpg" alt="integration" title="integration" width="200" height="150" style="float:right; margin-left:10px; margin-bottom:10px;" />One of the topics that comes up a lot in the context of an Enterprise Service Bus (ESB) is that of integration. Unfortunately, many people take their ideas of reuse and design their integration as being done from a single place &#8211; both logical and physical. That unfortunately creates a bottleneck for all integration activities, where some are likely to be higher priority than others.</p>
<h3>The ugly truth</h3>
<p>You don&#8217;t need an ESB for integration.</p>
<p>There. I&#8217;ve said it. </p>
<p>Most of the ESB products on the market, in focusing on integration, are addressing the wrong problem.</p>
<h3>What integration is about</h3>
<p>There are three primary components to integration &#8211; data format translation, protocol bridging, and logic. Let&#8217;s take the Agile &#8220;simplest solution that could possibly work&#8221; motto and apply it to these elements:</p>
<ol>
<li>Data format translation<br/>
<ul>
<li>Use something like <a href="http://www.altova.com/mapforce.html">MapForce</a> (from Altova, the guys behind XMLSpy).</li>
<li>At under $1200 for a dev license and handling mapping to/from XML, EDI, flat files, and relational databases, you can host the resulting mapping in any endpoint, as XSLT or even Java/C# &#8211; no need to have &#8220;the bus&#8221; do this for you.</li>
</ul>
</li>
<li>Protocol bridging<br/>
<ul>
<li>Use something like <a href="http://www.nsoftware.com/subscriptions/">/n software</a></li>
<li>At about $1500 for a dev license, you get solutions for FTP, HTTP, SMTP, POP, IMAP, LDAP, DNS, RSS, SMS, Jabber, SOAP, WebDav, etc and, again &#8211; you can host the DLLs in any endpoint you want. Don&#8217;t need expensive buses for this</li>
</ul>
</li>
<li>Logic<br/><br />
This is all you &#8211; no technology can do this for you. If anything, the most important thing is to get all the ugly mapping and protocol bridging stuff out of the way and let you focus on your logic. This is Single Responsibility Principle (un)common sense.
</li>
</ol>
<h3>Digging deeper into the logic</h3>
<p>The interesting thing about most of the protocol stuff mentioned above is that they&#8217;re inherently <b>unreliable</b> and also their performance at runtime is unknowable due to the total load on the target server.</p>
<p>We wouldn&#8217;t want any of the above situations to cause our integration to &#8220;get stuck&#8221;. As such, it is best we think of our integration logic as a long-running process that manages other endpoints which do the actual protocol bridging and data transformations.</p>
<p>This is one of the areas where NServiceBus, with its <a href="http://www.nservicebus.com/Sagas.aspx">sagas</a> can actually help a lot. Just like the other pieces of integration mentioned above, these sagas can run on any endpoint.</p>
<p>You could alternatively look at other technologies like BizTalk and Business Process Execution Language (BPEL) engines, though many of those are designed to be physically centralized (just like many of the ESBs out there).</p>
<p>By the way, if you do want to use NServiceBus together with BizTalk, Michael Stephenson has published some great white papers on getting the two to work together. His latest is about integrating NServiceBus into BizTalk&#8217;s RFID processes &#8211; <a href="http://social.technet.microsoft.com/wiki/contents/articles/biztalk-rfid-amp-nservicebus.aspx">check it out</a>.</p>
<h3>Putting it all together</h3>
<p>When we take all of these pieces and look at them in a cohesive architecture, here&#8217;s what it can look like:</p>
<p><img src="http://www.udidahan.com/wp-content/uploads/DistributedIntegration.jpg" alt="Distributed Integration" title="Distributed Integration" width="600" height="385" class="alignnone size-full wp-image-1432" /></p>
<p>As you can see, integration is physically distributed across multiple endpoints.</p>
<p>Not only that, but the integration logic is kept separate from the protocol bridging and data transformation, enabling independent versioning of each. Just as important, it makes it <b>much</b> easier to unit test that the integration logic is correct as we don&#8217;t have to simulate the target technologies.</p>
<h3>Costs</h3>
<p>As you can see, you can get integration capabilities just as powerful as if you went with something like BizTalk, but without creating a single point of failure in your architecture. In terms of costs, it&#8217;s also quite a bit cheaper.</p>
<p>For a high availability BizTalk deployment, you&#8217;ll be paying <a href="http://www.microsoft.com/biztalk/en/us/pricing-licensing.aspx">over $40,000 per CPU</a> for the Enterprise Edition, not including the extra $7000 per CPU for SQL Server Standard Edition (clustered). For a clustered 4-CPU mid-size deployment, you&#8217;d be in the area of $200,000.</p>
<p>For the distributed integration solution above, you&#8217;d be paying around $2700 in dev licenses (for /n software and Altova MapForce), and $500 per core for NServiceBus Standard Edition. The reason there&#8217;s per-core licensing for NServiceBus is that in a virtualized environment, you&#8217;ll be provisioning virtual cores to your virtual machines. No reason to pay for a quad-core CPU when all you&#8217;re using is a single core. You can also use any number of cores running NServiceBus Express Edition at no cost, so a mid-size deployment with say 8 cores running Standard Edition, and another 24 cores running Express Edition would cost (with the volume discount) an additional $3800 &#8211; a total cost of $6,500.</p>
<p>BizTalk: $200,000 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NServiceBus: $6,500</p>
<p>&#8216;Nuff said.</p>
<h3>In closing</h3>
<p>We&#8217;ve been bitten by centralized architectures before.</p>
<p>By having our integration distributed, we can version, upgrade, and scale each piece independently.</p>
<p>You&#8217;ve seen how we can use simple, lightweight, and inexpensive technologies to create distributed integration solutions just as powerful and robust as the centralized ESB vendor-offerings out there, but at a tiny fraction of the cost.</p>
<p>Next time the topic of integration is brought up, you&#8217;ll know not to be suckered in by re-branded EAI brokers.</p>
<p><a href="http://www.nservicebus.com/">Learn more about NServiceBus</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2011/04/08/integration-how-and-where/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Bus and Broker Pub/Sub Differences</title>
		<link>http://www.udidahan.com/2011/03/24/bus-and-broker-pubsub-differences/</link>
		<comments>http://www.udidahan.com/2011/03/24/bus-and-broker-pubsub-differences/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 21:22:13 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></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=1421</guid>
		<description><![CDATA[One of the things which often confuses people using NServiceBus for the first time is that it only allows an endpoint to subscribe to a given event from a single other publishing endpoint. The rule that there can only be a single publisher for a given event type is one of the things that differentiates [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.udidahan.com/wp-content/uploads/difference_of_opinion.jpg" alt="differences" title="differences" width="250" height="150" style="float:right; margin-left:10px; margin-bottom:10px;" />One of the things which often confuses people using NServiceBus for the first time is that it only allows an endpoint to subscribe to a given event from a single other publishing endpoint. The rule that there can only be a single publisher for a given event type is one of the things that differentiates buses from brokers, though both obviously allow you to have multiple subscribers.</p>
<h3>Brokers</h3>
<p>Message brokers, more broadly known and used on the Java platform, don&#8217;t come with this constraint. For example, when using ActiveMQ, you can have any number of endpoints come to the broker and publish a message under a given topic. </p>
<p>So where&#8217;s the problem?</p>
<p>It&#8217;s all about accountability.</p>
<p>Let&#8217;s say you&#8217;ve subscribed to a given topic, and have received two events &#8211; one telling you that the price of bananas next week will be $1/kg and another telling you that it&#8217;ll be $2/kg. </p>
<p>Which one is right?</p>
<p>Especially given that those events may have been published by any other endpoint via the broker.</p>
<p>Is it first one wins? Last one wins? How about first one sent vs. first one received? Ditto for last. As a subscriber, can you really be held accountable for having the logic to choose the right one? Shouldn&#8217;t this responsibility have fallen to the publishing side?</p>
<p>This is one of the big drawbacks of the broker, hub and spoke architecture. No responsibility. No single source of truth &#8211; unless everybody&#8217;s going to some central database, in which case &#8211; what&#8217;s the point of all this messaging anyway?</p>
<h3>Buses</h3>
<p>The Bus Architectural Style is all about accountability. If you are going to publish an event, you are accountable for the correctness of the data in that event &#8211; there is no central database that a subscriber can go to &#8220;just in case&#8221;. And the only way that you can be held accountable, is if you have full responsibility &#8211; ergo, you&#8217;re the only one who can publish that type of event.</p>
<p>If you say bananas are going to cost $1/kg next week, that&#8217;s that. Subscribers will not hear from anybody else on that topic.</p>
<p>Now, this is not to say that you can&#8217;t have more than one <b>physical</b> publishing endpoint.</p>
<p>You see, buses differentiate between the logical and the physical. Brokers tend to assume that the physical hub-and-spoke topology is also the logical.</p>
<p>In a bus, while there can only be one <b>logical</b> endpoint publishing a given type of event, that endpoint can be physically scaled out across multiple machines. It is the responsibility of the bus to provide infrastructure facilities to allow for that to happen in such a way that to subscribers, it still appears as if there is really only one publishing endpoint.</p>
<p>The same is true about the subscriber &#8211; one logical subscribing endpoint may be scaled out across multiple machines.</p>
<h3>Product Mix-ups</h3>
<p>Unfortunately, there are many broker-style technologies out there that are being marketed under the banner of the Enterprise Service Bus. While some products have the ability to be deployed in both a centralized and distributed fashion (sometimes called &#8220;federated&#8221; or &#8220;embedded&#8221; mode), many do not enforce the &#8220;single publishing endpoint per event-type&#8221; rule.</p>
<p>Without this constraint, it is just too easy to make mistakes.</p>
<h3>NServiceBus</h3>
<p>By enforcing this constraint, we see the same kind of question appear on the discussion group time and time again:</p>
<p>&#8220;I have an Audit event that I&#8217;d like all of my machines to publish, and have one machine subscribe to them all, but NServiceBus won&#8217;t let me. How do I make NServiceBus support this scenario?&#8221;</p>
<p>And the answer is the same every time:</p>
<p>&#8220;You should have all the machines <b>Send</b> the Audit message (configured to go to the single machine handling that message), and not Publish. It is not an event until its been handled by the endpoint responsible for it.&#8221;</p>
<p>The semantics of the message matter a lot.</p>
<p>When looking at Service-Oriented Architecture, these messages are the contract and, as any lawyer will tell you, contracts need to be explicit and the intentions really need to be spelled out &#8211; otherwise the contract is practically worthless.</p>
<h3>In closing</h3>
<p>Friction is sometimes a good thing &#8211; it prevents us from making mistakes. It keeps cars on the road. And because that&#8217;s not enough friction, we introduce curbs as well.</p>
<p>If you&#8217;re looking for a service bus technology for your next project, check that it&#8217;ll give you the friction that you need to keep everybody safe. Really check what it is that the vendors are offering you &#8211; more often than not, it&#8217;s some ESB lipstick on a broker pig.</p>
<p>To learn more about how NServiceBus supports this kind of publish/subscribe, <a href="http://www.nservicebus.com/PubSub.aspx">click here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2011/03/24/bus-and-broker-pubsub-differences/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Polymorphism and Messaging</title>
		<link>http://www.udidahan.com/2011/01/13/polymorphism-and-messaging/</link>
		<comments>http://www.udidahan.com/2011/01/13/polymorphism-and-messaging/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 08:52:48 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=1389</guid>
		<description><![CDATA[One of the questions that came up from my NServiceBus &#8211; .NET Service Bus Smackdown post was about the Polymorphic Message Dispatch and Polymorphic Message Routing features. People wanted to know what those are, why they&#8217;re important, and if other technologies (specifically WCF and BizTalk) support them.
Messaging Basics
First of all, when building a system using [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.udidahan.com/wp-content/uploads/polymorphism.jpg" alt="polymorphism" title="polymorphism" width="213" height="131" style="float:right; margin-left:10px; margin-bottom:10px;" />One of the questions that came up from my <a href="http://www.udidahan.com/2010/08/04/nservicebus-net-service-bus-smackdown/">NServiceBus &#8211; .NET Service Bus Smackdown post</a> was about the Polymorphic Message Dispatch and Polymorphic Message Routing features. People wanted to know what those are, why they&#8217;re important, and if other technologies (specifically WCF and BizTalk) support them.</p>
<h2>Messaging Basics</h2>
<p>First of all, when building a system using messaging, you don&#8217;t have methods that are invoked on some remote object (a.k.a &#8220;service&#8221;) to which you pass parameters. Instead, you use some generic piece of infrastructure (in the world of Java, this is most commonly a Message Broker) to send a message where a message can be thought of as a serializable class. Here&#8217;s an example of a message:</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode">
<span class="kwrd">public</span> <span class="kwrd">class</span> UserCreated : IMessage
{
    <span class="kwrd">public</span> Guid UserId { get; set; }
    <span class="kwrd">public</span> <span class="kwrd">string</span> Name { get; set; }
}</pre>
<p>This message would be published using NServiceBus like this:</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode">
bus.Publish&lt;UserCreated&gt;( m =&gt;
{
    m.UserId = Guid.NewGuid();
    m.Name = <span class="str">"John Smith"</span>;
});
</pre>
<p>This can be contrasted with RPC models like WCF where you need to define a &#8220;service&#8221; that has methods on it, where those methods accepts parameters. Sometimes developers try to make this more generic by having a single &#8220;service&#8221; with one method on it named something like &#8220;Process&#8221; where the parameter it accepts is of the type &#8220;object&#8221;, or they introduce generics like this: Process&lt;T&gt;(T message);</p>
<p>This is where Polymorphic Message Dispatch comes in:</p>
<h2>Polymorphic Message Dispatch</h2>
<p>While you can pull of the WCF generics thing, one thing that is more difficult (without writing your own dispatch model) is to have a pipeline of classes which can be invoked based on their relationship to the type passed in. Using NServiceBus, both of the following message handlers will be invoked when UserCreated arrives:</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode">
<span class="kwrd">public</span> <span class="kwrd">class</span> Persistence : IHandleMessages&lt;UserCreated&gt;
{
    <span class="kwrd">public</span> <span class="kwrd">void</span> Handle(UserCreated message) { }
}

<span class="kwrd">public</span> <span class="kwrd">class</span> Audit : IHandleMessages&lt;IMessage&gt;
{
    <span class="kwrd">public</span> <span class="kwrd">void</span> Handle(IMessage message) { }
}</pre>
<p>Now some might say that WCF, BizTalk, and the .NET Service Bus allow you to do auditing in their own internal pipeline, and that&#8217;s true. The place where this becomes more powerful is when you need to build V2 of your system, and the publisher now publishes a slightly different event &#8211; that a user was created as a part of a campaign, requiring the subscriber to register statistics about the campaign. Of course, this event also means that a user was created. Here&#8217;s how you&#8217;d do that with NServiceBus:</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode">
<span class="kwrd">public</span> <span class="kwrd">class</span> UserCreatedFromCampaign : UserCreated
{
    <span class="kwrd">public</span> Guid CampaignId { get; set; }
}

<span class="rem">//publisher code</span>
bus.Publish&lt;UserCreatedFromCampaign&gt;( m =&gt;
{
    m.UserId = Guid.NewGuid();
    m.Name = <span class="str">"John Smith"</span>;
    m.CampaignId = theCampaignId;
}

<span class="rem">//subscriber code</span>
<span class="kwrd">public</span> <span class="kwrd">class</span> Statistics : IHandleMessages&lt;UserCreatedFromCampaign&gt;
{
    <span class="kwrd">public</span> <span class="kwrd">void</span> Handle(UserCreatedFromCampaign message) { }
}</pre>
<p>The important part is what you don&#8217;t see &#8211; since UserCreatedFromCampaign inherits from UserCrated, the Persistence handler we had from V1 will also be invoked, and so will the Audit handler of course. You don&#8217;t have to make your new code call the old code like you would in a method based dispatch model. This makes sure that the coupling in your service layer code remains constant over time as you grow the functionality of your system.</p>
<p>This was one of the main benefits mentioned by Rackspace in their use of NServiceBus (<a href="http://www.nservicebus.com/Customers.aspx">here</a>):</p>
<blockquote><p>&#8220;The main benefit NServiceBus has brought us so far is developer scalability due to lower coupling and higher consistency in our code.&#8221;</p></blockquote>
<p>But, when looking at the above scenario, we can obviously expect that all sorts of things can happen in relation to campaigns &#8211; it is a separate concern, and thus should be handled by a separate subscriber. And this bring us to&#8230;</p>
<h2>Polymorphic Message Routing</h2>
<p>The challenge that we have here is that we no longer have a hierarchy where something clearly belongs on top of something else. We have users created and activities happening related to campaigns &#8211; that may happen in any combination. By having separate subscribers, we could then introduce new handlers/subscribers to our environment without touching or taking down any of the other subscribers. Here&#8217;s what the subscribers would look like:</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode">
<span class="kwrd">public</span> <span class="kwrd">class</span> Persistence : IHandleMessages&lt;UserCreated&gt;
{
    <span class="kwrd">public</span> <span class="kwrd">void</span> Handle(UserCreated message) { }
}

<span class="kwrd">public</span> <span class="kwrd">class</span> Statistics : IHandleMessages&lt;CampaignActivityOccurred&gt;
{
    <span class="kwrd">public</span> <span class="kwrd">void</span> Handle(CampaignActivityOccurred message) { }
}</pre>
<p>But if each of the above messages were a class, how could we define a message which inherited from both?</p>
<p>Before answering that, we need to understand why the publisher wouldn&#8217;t just publish both of the above messages. You see, the publisher can&#8217;t make any assumptions about its subscribers &#8211; it could be that one of them has logic that correlates across both of these messages that could end up counting the occurrence as happening twice rather than once, possibly charging the account associated with the campaign twice. Publishing two messages results in two transactions when there really should have been one.</p>
<p>So, here&#8217;s how to define messages so that we can have multiple inheritance:</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode">
<span class="kwrd">public</span> <span class="kwrd">interface</span> UserCreated : IMessage
{
    Guid UserId { get; set; }
    <span class="kwrd">string</span> Name { get; set; }
}

<span class="kwrd">public</span> <span class="kwrd">interface</span> CampaignActivityOccurred : IMessage
{
    Guid CampaignId { get; set; }
    Guid ActivityId { get; set; }
}

<span class="kwrd">public</span> <span class="kwrd">interface</span> UserCreatedFromCampaign
                 : UserCreated,
                   CampaignActivityOccurred
{
}</pre>
<p>And when the publisher publishes UserCreatedFromCampaign, the event would be routed to both the UserCreated subscriber and the CampaignActivityOccurred subscriber. The power of this approach is felt as we handle new requirements around purchases made related to a campaign. Now we can have another event which inherits from CampaignActivityOccurred and not have to worry since the existing subscriber will be routed those messages automatically.</p>
<p>Since WCF doesn&#8217;t have publish/subscribe capabilities, we might as well move along.</p>
<p>Not to throw a burning match on an ocean of oil, but REST doesn&#8217;t really support this either.</p>
<h2>Not Content-Based Routing</h2>
<p>This may sound like the <a href="http://www.eaipatterns.com/ContentBasedRouter.html">content-based router pattern from EIP</a> (CBR), but it&#8217;s not. The important difference is that there isn&#8217;t some part of the routing that depends on the structure of the messages. The major drawback of CBR is that it creates a central place in your system that needs to be changed any time *syntactic* changes happen to message structure *in addition to* to changes in the subscribers.</p>
<p>Now, this is where the BizTalk guys would say that &#8220;that&#8217;s why we can do message transformations&#8221;, and then the subscribers wouldn&#8217;t need to be changed. However, can we really know when getting a requirement that the change is syntactic and not semantic? I mean, it&#8217;s quite common that changes to message structures happen together with changes to processing logic. </p>
<p>You may be beginning to get the feeling that more and more logic is being sucked out of the subscribers into some monolithic black hole that is likely going to be unmaintainable and quite slow. </p>
<p>This is one of the main differences between using a bus and a broker &#8211; a bus supports the correct distribution of logic keeping the system loosely coupled; brokers are useful integration engines when you absolutely can&#8217;t change the applications being integrated. Enterprise Application Integration (EAI) brokers don&#8217;t usually make good Enterprise Service Bus (ESB) technology.</p>
<h2>In Closing</h2>
<p>NServiceBus has all sorts of features you didn&#8217;t know you needed until you saw what life could be like when you had them. Most of these features don&#8217;t have snazzy drag-and-drop demos that make people ooh-and-aah and TechEds and PDCs, but they&#8217;re really necessary to avoid finding yourself in yet another big-ball-of-mud code base telling your manager/customer (again) that it would be faster to rebuild the system from scratch than to implement that new requirement in the old one.</p>
<p>Take NServiceBus for a spin and <a href="http://www.nservicebus.com/">see for yourself</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2011/01/13/polymorphism-and-messaging/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Logical and Physical Architecture</title>
		<link>http://www.udidahan.com/2010/11/08/logical-and-physical-architecture/</link>
		<comments>http://www.udidahan.com/2010/11/08/logical-and-physical-architecture/#comments</comments>
		<pubDate>Mon, 08 Nov 2010 19:14:04 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=1355</guid>
		<description><![CDATA[One architectural misunderstanding I see repeatedly in my work with clients is in the relationship between logical and physical architecture. The most common building-block of these misunderstandings is the web service (or it&#8217;s &#8220;upgraded&#8221; .net counterpart &#8211; the WCF service).
Don&#8217;t get me wrong, sometimes there is a place for a web service, just not everywhere.
So, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.udidahan.com/wp-content/uploads/orthogonal1.jpg" alt="orthogonal" title="orthogonal" width="300" height="237" style="float:right; margin-left:10px; margin-bottom:10px;" />One architectural misunderstanding I see repeatedly in my work with clients is in the relationship between logical and physical architecture. The most common building-block of these misunderstandings is the web service (or it&#8217;s &#8220;upgraded&#8221; .net counterpart &#8211; the WCF service).</p>
<p>Don&#8217;t get me wrong, sometimes there is a place for a web service, just not everywhere.</p>
<p>So, what&#8217;s the problem?</p>
<p>Well, when developers and architects use web services as the building blocks of their designs, they are creating the same architecture for both the logical and physical elements of their system. Back in 1995, Philippe Kruchten documented his <a href="http://en.wikipedia.org/wiki/4%2B1_Architectural_View_Model">4 + 1 Architectural View Model</a> in which he outlined 4 + 1 different views that should be used to describe an architecture.</p>
<p>Even though since 1995 the number and types of recommended views of software architecture has evolved (with things like the <a href="http://en.wikipedia.org/wiki/Zachman_Framework">Zachman Framework</a> for enterprise architecture numbering some 30 views), there is broad agreement that (at the very least) the logical and physical artifacts should likely be designed differently.</p>
<p>Just because two distinct logical components have been identified in the architecture, that doesn&#8217;t necessarily mean they should be hosted separately (for example by making each one a web/wcf service). In fact, there are significant <b>disadvantages</b> to doing so (as described in the <a href="http://en.wikipedia.org/wiki/Fallacies_of_Distributed_Computing">Fallacies of Distributed Computing</a>).</p>
<p>In some cases, this mistake is exacerbated by a mistaking these components with SOA-type services, resulting in an attempt by developers to have each component have its own contract, which can then be independently versioned. This often results in the need for transformation between the structure of these so-called contracts, but not within the components themselves (oh-no, they&#8217;re &#8220;autonomous&#8221;), but rather in between them using some kind of &#8220;ESB&#8221; technology.</p>
<p>This architectural style is known as the Broker, Hub and Spoke, Mediator, and most importantly &#8211; not SOA. If you find a technology that fits this style perfectly (like BizTalk), that technology is not a Bus, not a Service Bus, and definitely not an Enterprise Service Bus.</p>
<p>One of the problems of this approach is that when any &#8220;service&#8221; contract changes, you have to change all the transformations in your broker that involve it. Unfortunately, most brokers have no unit-testing facility so it&#8217;s very much trial and error, and error, and error. The matter is even more serious since most brokers don&#8217;t enable you to have your transformations or orchestrations in source control, so you can&#8217;t diff to see what changed from the previous version.</p>
<p>It&#8217;s really amazing how much pain can be traced back to that one original misunderstanding. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2010/11/08/logical-and-physical-architecture/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>BizTalk Blogs and UdiDahan.com, strange bedfellows?</title>
		<link>http://www.udidahan.com/2007/12/19/biztalk-blogs-and-udidahancom-strange-bedfellows/</link>
		<comments>http://www.udidahan.com/2007/12/19/biztalk-blogs-and-udidahancom-strange-bedfellows/#comments</comments>
		<pubDate>Wed, 19 Dec 2007 21:04:57 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Scalability]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/12/19/biztalk-blogs-and-udidahancom-strange-bedfellows/</guid>
		<description><![CDATA[So, it turns out that Microsoft has quietly launched a new community-style site.
Titled &#34;BizTalk Blogs&#34;, I wasn&#8217;t quite sure what my blog was doing there. It&#8217;s not that I never write about BizTalk &#8211; every once in a while I even find something nice to say about it   My quick post on BizTalk [...]]]></description>
			<content:encoded><![CDATA[<p>So, it turns out that Microsoft has quietly launched a new community-style site.<a href="http://www.biztalkblogs.com/"><img style="float: right; margin: 0px 20px" src="http://www.wedsg.com/images/biztalkblogs.gif" align="right" border="0" /></a></p>
<p>Titled &quot;BizTalk Blogs&quot;, I wasn&#8217;t quite sure what my blog was doing there. It&#8217;s not that I never write about BizTalk &#8211; every once in a while I even find something nice to say about it <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  My quick post on <a href="http://udidahan.weblogs.us/2007/05/02/biztalk-and-performance/">BizTalk and Performance</a> is one such example. But, let&#8217;s face it, a lot of the work I do is to provide BizTalk-like features like routing, transaction-management, and choreography (orchestration) without the actual product.</p>
<p>Apparently, I&#8217;m not the only non-BizTalk-only blogger there.</p>
<p>Including such names as <a href="http://blogs.thinktecture.com/cweyer/">Christian Weyer</a> and <a href="http://www.dasblonde.net/default.aspx">Michelle Leroux Bustamante</a> , there is a veritable who&#8217;s who in the Microsoft Connected Systems ecosystem and, quite frankly, I&#8217;m surprised the bouncer let me in the door.</p>
<p>So, this post is for my readers who, like me, have pretty much ignored anything looking like BizTalk for the past few years. Don&#8217;t let the name fool you. BizTalk Blogs is a valuable resource even for people who don&#8217;t care about BizTalk &#8211; and hey, you might even like what you start hearing about the future directions Microsoft is taking it.</p>
<p>But that&#8217;s enough of that. We&#8217;ll be back with your regularly scheduled BizTalk bashing right after this break&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/12/19/biztalk-blogs-and-udidahancom-strange-bedfellows/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>NServiceBus Distributed Topology Q&amp;A</title>
		<link>http://www.udidahan.com/2007/08/25/nservicebus-distributed-topology-qa/</link>
		<comments>http://www.udidahan.com/2007/08/25/nservicebus-distributed-topology-qa/#comments</comments>
		<pubDate>Sat, 25 Aug 2007 08:37:26 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[Dependency Injection]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/08/25/nservicebus-distributed-topology-qa/</guid>
		<description><![CDATA[I&#8217;ve been receiving more and more questions about how NServiceBus fits in distributed systems and wanted to share them:

My question is about distributed topology.
The EAI-hub-and-spoke model is all about the central server.   It’s useful sometimes, but there are a lot of reasons why I’m not gung-ho on using a hub as the center [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been receiving more and more questions about how NServiceBus fits in distributed systems and wanted to share them:</p>
<blockquote><p>
My question is about distributed topology.</p>
<p>The EAI-hub-and-spoke model is all about the central server.   It’s useful sometimes, but there are a lot of reasons why I’m not gung-ho on using a hub as the center of the integration universe.  </p>
<p>The ESB distributed model puts code on the endpoints.  That code solves some of the messaging problems that apps face, so that apps don’t have to face them. It also solves some of the messaging problems that enterprises face, so that enterprises don’t have to face them.  (I need both).</p>
<p>Those problems include simple coding and deployment model, pub-sub routing, reliable transport, simple transformation, and orchestration.  I wonder which of these you can do in your tool, and which you are planning to do.  </p>
<p>I’m also interested in management.  How do you insure that the endpoints are correctly configured?  Do you have a central configuration store?  How do you propagate changes from the center to the messaging endpoints?
</p></blockquote>
<p>And here&#8217;s my response:</p>
<p>The important parts of NServiceBus that are independent of the distributed topology are the API and the connection to long-running workflow. This code is indeed on the endpoint. However, if you wanted to you could easily connect to something like BizTalk and do whatever you wanted there. This general idea though is to support the ESB distributed model since <a href="udidahan.weblogs.us/2007/06/30/no-such-thing-as-a-centralized-esb/">there&#8217;s no such things as a centralized ESB</a>.</p>
<p>In terms of the capabilities you’ve mentioned, I’ve seen developers pick up the coding model in a day or two. The deployment model is just a bunch of DLLs you deploy with each endpoint. Dependency Injection is supported by www.SpringFramework.net but you can replace that with something else easily as another implementation of the ObjectBuilder interfaces. </p>
<p>Currently pub/sub routing is supported over regular point-to-point transports in a transport agnostic way. You also have the ability to have subscriptions be persisted so that even if a server restarts (and clients don’t, and can’t know about that) all the subscriptions will be remembered. </p>
<p>The reliable transport that is currently supported is MSMQ, with the option of defining per-message type if you want durable messaging (using the [Recoverable] attribute). </p>
<p>In terms of orchestration you get a nice model for long-running workflow that gets kicked off by messages decorated with the [StartsWorkflow] attribute, and messages that implement the IWorkflowMessage interface get automatically routed to the persistent workflow instance. You have the ability to change the storage of workflow instances easily as well. Workflows are simple classes which are easily unit-testable in that they expose a “void Handle(T message);” method for every message type (T) that is involved in the workflow.</p>
<p>I haven’t done anything in terms of simple transformation yet but am currently looking for the right place in the message processing pipeline to put it. I also haven’t done anything yet in terms of management. </p>
<p>What is currently being done management-wise on the projects that use it are the commercial options for managing configuration files in distributed environments coupled with the regular ability to restart windows services and IIS applications. I haven’t seen anything lacking in that solution yet.</p>
<hr size="1" />
<p>If you have any questions, please don&#8217;t hesitate to send them my way &#8211; <a href="mailto:NServiceBus@UdiDahan.com">NServiceBus@UdiDahan.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/08/25/nservicebus-distributed-topology-qa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</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>
		<item>
		<title>BizTalk and Performance</title>
		<link>http://www.udidahan.com/2007/05/02/biztalk-and-performance/</link>
		<comments>http://www.udidahan.com/2007/05/02/biztalk-and-performance/#comments</comments>
		<pubDate>Wed, 02 May 2007 08:04:20 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Scalability]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/05/02/biztalk-and-performance/</guid>
		<description><![CDATA[I know I bad-talk BizTalk a lot, but I do it somewhat tongue-in-cheek and to get a rise out of people. BizTalk is a tool, something of a swiss army knife, you know, those huge, honking ones that have everything but the kitchen sink in them. One of the main areas where BizTalk gets a [...]]]></description>
			<content:encoded><![CDATA[<p>I know I bad-talk BizTalk a lot, but I do it somewhat tongue-in-cheek and to get a rise out of people. BizTalk is a tool, something of a swiss army knife, you know, those huge, honking ones that have everything but the kitchen sink in them. One of the main areas where BizTalk gets a bad rap is in performance and <a href="http://udidahan.weblogs.us/category/scalability/">scalability</a>. On the other hand, the number of systems that I come in to assist with performance issues, that don&#8217;t use BizTalk, is still quite large. A systematic approach is needed in all cases.</p>
<p>I ran into another <a href="http://blogs.msdn.com/ewanf/archive/2007/05/01/biztalk-performance-useful-technique-to-baseline-your-infrastructure.aspx">BizTalk optimization story online</a> that once again points out that disk IO is a good first place to look, as I wrote about in my <a href="http://udidahan.weblogs.us/2007/04/30/database-performance-optimization/">Database performance optimization article</a>.</p>
<p>In closing, you need to be aware of the full environment. For instance, in BizTalk, it&#8217;s not just about messages per second. Session contention (multiple parties hitting the same session) can just lock things up tighter than, well, a tight thing. Designing for these things &#8220;up front&#8221; <gasp/> can save you <i>very</i> costly rewrites later.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/05/02/biztalk-and-performance/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Request/Service state affinity – don’t.</title>
		<link>http://www.udidahan.com/2007/02/18/requestservice-state-affinity-%e2%80%93-don%e2%80%99t/</link>
		<comments>http://www.udidahan.com/2007/02/18/requestservice-state-affinity-%e2%80%93-don%e2%80%99t/#comments</comments>
		<pubDate>Mon, 19 Feb 2007 04:49:56 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Simplicity]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/380</guid>
		<description><![CDATA[I saw this question today on the one of the blogs I follow, and seeing that it’s a question that variations of it pop up all the time, I thought that I’d chip in with my 2 cents.
How do I store some state about the current request so that I can use it later during [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin: 0cm 0cm 10pt"><font face="Calibri" size="3">I saw this question today on the one of the blogs I follow, and seeing that it’s a question that variations of it pop up all the time, I thought that I’d chip in with my 2 cents.</font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 10pt"><em><font face="Calibri" size="3">How do I store some state about the current request so that I can use it later during the same service operation?</font></em></p>
<p class="MsoNormal" style="margin: 0cm 0cm 10pt"><a href="http://blogs.msdn.com/drnick/archive/2007/02/15/stashing-data-in-extensible-objects.aspx"><font face="Calibri" size="3">One analysis I read</font></a><font face="Calibri" size="3"> came at it from a technological angle – how to do this with WCF. I want to take a look at two other angles here.</font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 10pt"><font face="Calibri" size="3">The first has to do with one interpretation of the question – in the course of handling that request, there are numerous objects involved. How can we make it so that all of them have access to the request data? From a technological perspective, the answer is simple – make it thread-static (in .net this is done by applying the ThreadStaticAttribute to it), or store it in some thread-local-storage. From a design perspective, though, things aren’t all that clear. Which property of which class contains the request data, so that we can mark it with such an attribute, or under what key is the data stored in the thread-local-storage?</font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 10pt"><font face="Calibri" size="3">What I usually do is use my “IBus” interface, which exposes a “MessageBeingHandled” thread-static property. Any object that needs state about the current request makes sure to get an instance of “IBus” injected. The classic example of objects that need this data include message handlers (implementing the “IMessageHandler” interface). For more information about this design, take a look at </font><a href="http://udidahan.weblogs.us/2006/06/02/can-indigo-be-my-bus/"><font face="Calibri" size="3">this</font></a><font face="Calibri" size="3">.</font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 10pt"><font face="Calibri" size="3">The second interpretation looks at having that request data available to the service on subsequent invocations. Personally, I don’t like the idea of having this data in-memory on the object that serviced the original request. One reason I don’t like it is that it creates an affinity between the client and the specific server handling its requests. Those of you who know me already are expecting this…</font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 10pt"><font face="Calibri" size="3">What if the server restarts?</font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 10pt"><font face="Calibri" size="3">Will that client’s state be lost? Well, not if we persisted it somewhere durable instead of just in memory. Will we stop servicing requests from that client until the original server becomes available again? Well, if the data was durably persisted, then any server could pick it up. And this is exactly what BizTalk does. You don’t want to implement BizTalk again, do you?</font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 10pt"><font face="Calibri" size="3">I can tell that some of you are surprised to hear me say this. Such a small requirement, and already we need BizTalk? Did Udi really say that?</font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 10pt"><font face="Calibri" size="3">Well, there is another, simpler way. If what you have is some kind of back-and-forth between the client and the service, you could use the Message History pattern and pack up the previous request data into the messages being sent. Although we’re increasing the message size, we’ve made it so that any server can handle any request and have access to all the previous data without creating some sort of durable contention area within the service like a database. Another option is to look at long-running workflow to model these interactions.</font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 10pt"><font face="Calibri" size="3">Finally, when it comes to ultra-scalable systems, I strongly suggest keeping the network dumb and pushing the smarts out to the edges – the clients. If you don’t need to have one client pick up where another client left off, this could be the ultimate solution. It combines with the Message History pattern and ends up sending only the data necessary on subsequent requests, thus keeping message size to a minimum. Also, your service doesn’t have to handle the state any more making it capable of handling more concurrent clients.</font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 10pt"><font face="Calibri" size="3">State management is the heart of any distributed systems development effort. Unfortunately, there aren’t any easy answers to it, but it’s important not to gloss over it if you want to have any hope of scalability in the future. Patterns help, but eventually we have to make the tradeoffs ourselves. Just don’t go running to one product or another in the hopes that it will make everything magically better.</font></p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/02/18/requestservice-state-affinity-%e2%80%93-don%e2%80%99t/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>.Net 2.0 no big deal?</title>
		<link>http://www.udidahan.com/2006/10/05/net-20-no-big-deal/</link>
		<comments>http://www.udidahan.com/2006/10/05/net-20-no-big-deal/#comments</comments>
		<pubDate>Thu, 05 Oct 2006 11:36:36 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[OO]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://wp_630.weblogs.us/archives/327</guid>
		<description><![CDATA[Jesse seems to be swallowing the Microsoft party line without missing a drop in his latest post <a href="http://weblogs.asp.net/jezell/archive/2006/10/05/Screw-2.0_2C00_-I_2700_m-Going-Straight-to-3.0.aspx">Screw 2.0, I'm Going Straight to 3.0</a>. 
<br/><br/>
From his post:
<br/><br/>
<em>
"The 2.0 framework doesn't really give you a massive amount of really new really cool features. There is one-click, which we probably wouldn't use anyway, generics (which are useful as a time saver, but don't really do much that you can't do without them), and some other little features... but the best part about the 2.0 framework is probably the IDE/dev experience, not what customers get out of it."
</em>
<br/><br/>
Granted, One-Click is nothing to write home about, but the runtime level additions, they just totally changed the way I write code. I'm talking about generics, anonymous methods, delegate inference, and the rest. The rest of 2.0, like the enhancements of the provider model in ASP.Net, well you would have developed the same kind of framework yourself if you were doing serious web development.
<br/><br/>
The whole 3.0 story, I've got to tell you, I'm pretty underwhelmed. Everybody seems to be jumping up and down about WPF, and yes, it's new and shiny, but there still the clunkety Windows message pump in the background. No real changes in how you're going to write multi-threaded UIs, which seem to be the real future given the rise in multi-core processing. The visual aspects of client side code in the systems I write run at around 5% of the overall effort. So the UI will look better, I dunno, 4D buttons and stuff, sorry for not falling over with enthusiasm.
<br/><br/>
And then there's WCF. Ah, wait, no publish/subscribe. Bummer, most of my systems being asynchronous in nature are built on the pub/sub model. An OO interface for interprocess communication? Who wants it - I need a message-based interface.
<br/><br/>
Don't forget WF - what was that for again? The main place where WF can fit my needs is for handling long-running workflows between systems, since I don't use Biztalk. But the performance of WF doesn't seem to fit this environment, it seems to be more suited for human workflow times. 
<br/><br/>
If anything, I'd have to say that .Net 2.0 was a relatively big deal. 3.0 will probably be just as important with the runtime level enhancements like lambda expressions, extension methods, anonymous types, and implicitly typed variables. All the rest of the hyped up stuff in 3.0, I don't really expect it to change anything in how I work today.]]></description>
			<content:encoded><![CDATA[<p>Jesse seems to be swallowing the Microsoft party line without missing a drop in his latest post <a href="http://weblogs.asp.net/jezell/archive/2006/10/05/Screw-2.0_2C00_-I_2700_m-Going-Straight-to-3.0.aspx">Screw 2.0, I&#8217;m Going Straight to 3.0</a>. </p>
<p>From his post:</p>
<p><em><br />
&#8220;The 2.0 framework doesn&#8217;t really give you a massive amount of really new really cool features. There is one-click, which we probably wouldn&#8217;t use anyway, generics (which are useful as a time saver, but don&#8217;t really do much that you can&#8217;t do without them), and some other little features&#8230; but the best part about the 2.0 framework is probably the IDE/dev experience, not what customers get out of it.&#8221;<br />
</em></p>
<p>Granted, One-Click is nothing to write home about, but the runtime level additions, they just totally changed the way I write code. I&#8217;m talking about generics, anonymous methods, delegate inference, and the rest. The rest of 2.0, like the enhancements of the provider model in ASP.Net, well you would have developed the same kind of framework yourself if you were doing serious web development.</p>
<p>The whole 3.0 story, I&#8217;ve got to tell you, I&#8217;m pretty underwhelmed. Everybody seems to be jumping up and down about WPF, and yes, it&#8217;s new and shiny, but there still the clunkety Windows message pump in the background. No real changes in how you&#8217;re going to write multi-threaded UIs, which seem to be the real future given the rise in multi-core processing. The visual aspects of client side code in the systems I write run at around 5% of the overall effort. So the UI will look better, I dunno, 4D buttons and stuff, sorry for not falling over with enthusiasm.</p>
<p>And then there&#8217;s WCF. Ah, wait, no publish/subscribe. Bummer, most of my systems being asynchronous in nature are built on the pub/sub model. An OO interface for interprocess communication? Who wants it &#8211; I need a message-based interface.</p>
<p>Don&#8217;t forget WF &#8211; what was that for again? The main place where WF can fit my needs is for handling long-running workflows between systems, since I don&#8217;t use Biztalk. But the performance of WF doesn&#8217;t seem to fit this environment, it seems to be more suited for human workflow times. </p>
<p>If anything, I&#8217;d have to say that .Net 2.0 was a relatively big deal. 3.0 will probably be just as important with the runtime level enhancements like lambda expressions, extension methods, anonymous types, and implicitly typed variables. All the rest of the hyped up stuff in 3.0, I don&#8217;t really expect it to change anything in how I work today.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2006/10/05/net-20-no-big-deal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A broker ain&#8217;t a bus &#8211; it just ain&#8217;t</title>
		<link>http://www.udidahan.com/2005/09/23/a-broker-aint-a-bus-it-just-aint/</link>
		<comments>http://www.udidahan.com/2005/09/23/a-broker-aint-a-bus-it-just-aint/#comments</comments>
		<pubDate>Sat, 24 Sep 2005 05:27:00 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[ESB]]></category>

		<guid isPermaLink="false">http://wp_630.weblogs.us/archives/222</guid>
		<description><![CDATA[I&#8217;ve been perusing the PDC material and ran into one of the presentations on BizTalk 2006 where the issue of communication between several services was raised. Obviously the N-square problem was shown, and then BizTalk was introduced in the middle with all communication going to and from it. So far, so good. But then, instead [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been perusing the PDC material and ran into one of the presentations on BizTalk 2006 where the issue of communication between several services was raised. Obviously the N-square problem was shown, and then BizTalk was introduced in the middle with all communication going to and from it. So far, so good. But then, instead of calling the rose by its name, BizTalk was called a bus.</p>
<p>This is a call to the architecture folks at Microsoft: If something is in the middle of all communication, it is a broker. It cannot be a bus, by definition. And don&#8217;t even get me started on the single point of failure issue.</p>
<p>I don&#8217;t have a problem with people marketing BizTalk as the replacement of 42, however, when the technical guys start talking, well, I expect them to tell the truth.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2005/09/23/a-broker-aint-a-bus-it-just-aint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What I want out of Biztalk</title>
		<link>http://www.udidahan.com/2005/05/27/what-i-want-out-of-biztalk/</link>
		<comments>http://www.udidahan.com/2005/05/27/what-i-want-out-of-biztalk/#comments</comments>
		<pubDate>Sat, 28 May 2005 05:09:54 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://wp_630.weblogs.us/archives/194</guid>
		<description><![CDATA[Give me as many of the patterns out of <a href="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&#038;camp=1789&#038;tag=thesoftwaresi-20&#038;creative=9325&#038;path=tg/detail/-/0321200683/qid=1117231639/sr=8-1/ref=pd_csp_1?v=glance%26s=books%26n=507846">the EIP book</a><img src="http://www.assoc-amazon.com/e/ir?t=thesoftwaresi-20&#038;l=ur2&#038;o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> as you can and make it run fast. Is that too much to ask?]]></description>
			<content:encoded><![CDATA[<p>Give me as many of the patterns out of <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">the EIP book</a><img src="http://www.assoc-amazon.com/e/ir?t=thesoftwaresi-20&amp;l=ur2&amp;o=1" width="1" height="1" border="0" alt="" /> as you can and make it run fast. Is that too much to ask?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2005/05/27/what-i-want-out-of-biztalk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BizTalk&#8217;s as fast as they come (or is that go?)</title>
		<link>http://www.udidahan.com/2005/05/05/biztalks-as-fast-as-they-come-or-is-that-go/</link>
		<comments>http://www.udidahan.com/2005/05/05/biztalks-as-fast-as-they-come-or-is-that-go/#comments</comments>
		<pubDate>Thu, 05 May 2005 22:19:18 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Scalability]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://wp_630.weblogs.us/archives/191</guid>
		<description><![CDATA[Aaron Skonnard is blogging quite a bit about BizTalk these days. <a href="http://pluralsight.com/blogs/aaron/archive/2005/04/25/7717.aspx">An earlier post </a>that caught my eye quoted Mike Woods, the Sr. Technical Product Manager on the BizTalk team:

"... Finally on performance; if you're truly seeing 1 transaction per second then something isn't right. The SOAP adapter and heavy use of orchestration will knock your transaction rates down. Depending on what you're doing you should be able to get that up over a hundred Tx/sec. on a well tuned BizTalk server farm."

Isn't one of the major selling points of BizTalk the whole webservices thing (SOAP) and the ability to express complex workflow (orchestration)? If it can't do these things at a high transaction rate, then why do I need it? If the logic is simple, why don't I just hand code it? I could probably get over 100 Tx/s on a single server, let alone "a well tuned ... server farm".]]></description>
			<content:encoded><![CDATA[<p>Aaron Skonnard is blogging quite a bit about BizTalk these days. <a href="http://pluralsight.com/blogs/aaron/archive/2005/04/25/7717.aspx">An earlier post </a>that caught my eye quoted Mike Woods, the Sr. Technical Product Manager on the BizTalk team:</p>
<p>&#8220;&#8230; Finally on performance; if you&#8217;re truly seeing 1 transaction per second then something isn&#8217;t right. The SOAP adapter and heavy use of orchestration will knock your transaction rates down. Depending on what you&#8217;re doing you should be able to get that up over a hundred Tx/sec. on a well tuned BizTalk server farm.&#8221;</p>
<p>Isn&#8217;t one of the major selling points of BizTalk the whole webservices thing (SOAP) and the ability to express complex workflow (orchestration)? If it can&#8217;t do these things at a high transaction rate, then why do I need it? If the logic is simple, why don&#8217;t I just hand code it? I could probably get over 100 Tx/s on a single server, let alone &#8220;a well tuned &#8230; server farm&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2005/05/05/biztalks-as-fast-as-they-come-or-is-that-go/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

