<?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; NServiceBus</title>
	<atom:link href="http://www.udidahan.com/category/nservicebus/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.udidahan.com</link>
	<description>Enterprise Development Expert &#38; SOA Specialist</description>
	<lastBuildDate>Mon, 08 Mar 2010 14:34:24 +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>NServiceBus 2.0 RTM</title>
		<link>http://www.udidahan.com/2010/03/01/nservicebus-2-0-rtm/</link>
		<comments>http://www.udidahan.com/2010/03/01/nservicebus-2-0-rtm/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 00:06:36 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[NServiceBus]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=1187</guid>
		<description><![CDATA[Well, it&#8217;s been a long time coming.
NServiceBus 2.0 RTM is now generally available.
There were some small tweaks after the RC2 but I&#8217;m happy to say that, all in all, this was a very quiet stabilization period. Key customers have reported very high levels of satisfaction with the NServiceBus stability, scalability, and simplicity.
For example
Conduit.com has very [...]]]></description>
			<content:encoded><![CDATA[<p>Well, it&#8217;s been a long time coming.</p>
<p>NServiceBus 2.0 RTM is now generally available.</p>
<p>There were some small tweaks after the RC2 but I&#8217;m happy to say that, all in all, this was a very quiet stabilization period. Key customers have reported very high levels of satisfaction with the NServiceBus stability, scalability, and simplicity.</p>
<h3>For example</h3>
<p><a href="http://www.Conduit.com">Conduit.com</a> has very happily doubled their user base with NServiceBus to 100 million.</p>
<p>#1 on American Banker&#8217;s 100 top financial tech companies, <a href="http://www.fiserv.com/">Fiserv</a> has been quietly employing NServiceBus across many of their core services.</p>
<p>The Irish SaaS company <a href="http://www.candidatemanager.net/">Candidate Manager</a> have been running the automated HR processes of geographically distributed giants like Hilton International on NServiceBus without missing a beat.</p>
<h3>Community</h3>
<p>Now with an <a href="http://tech.groups.yahoo.com/group/nservicebus/">active community</a> of over 600 members, new users are quickly brought up to speed by the veterans and the much improved <a href="http://www.nservicebus.com/Documentation.aspx">documentation</a> on the site make adopting NServiceBus simpler than ever.</p>
<p>Training on NServiceBus has also ramped up nicely with the April course in Philadelphia now sold out. The next course will be in London in May <a href="http://skillsmatter.com/course/open-source-dot-net/advanced-distributed-systems-design-with-soa/ps-314">via Skills Matter</a>.</p>
<p>More courses are being planned in:</p>
<ul>
<li><a href="http://udidahan-toronto.eventbee.com/">Toronto, Canada</a> Aug 9-13</li>
<li><a href="http://udidahan-calgary.eventbee.com/">Calgary, Canada</a> in September</li>
<li><a href="mailto:Johannesburg@UdiDahan.com">Johannesburg, South Africa</a> in October</li>
<li><a href="mailto:Sydney@UdiDahan.com">Sydney, Australia</a> in November</li>
<li><a href="mailto:Seattle@UdiDahan.com">Seattle WA, USA</a> in December</li>
</ul>
<h3>Give it a try</h3>
<p>You&#8217;ll have publish/subscribe messaging working in under 5 minutes with a simple F5 on the PubSub sample.</p>
<p><a href="http://www.NServiceBus.com">Get it here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2010/03/01/nservicebus-2-0-rtm/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>NServiceBus 2.0 Release Candidate 2 Available</title>
		<link>http://www.udidahan.com/2010/02/01/nservicebus-2-0-release-candidate-2-available/</link>
		<comments>http://www.udidahan.com/2010/02/01/nservicebus-2-0-release-candidate-2-available/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 13:13:21 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=1173</guid>
		<description><![CDATA[So it&#8217;s been about 6 months since my last NServiceBus post and since then about 1000 new people have subscribed to this blog so they might not know anything about it. For a bit of history, see the post (from almost exactly a year ago) describing the 1.9 release of NServiceBus here.
What&#8217;s New
The quickly approaching [...]]]></description>
			<content:encoded><![CDATA[<p>So it&#8217;s been about 6 months since my last NServiceBus post and since then about 1000 new people have subscribed to this blog so they might not know anything about it. For a bit of history, see the post (from almost exactly a year ago) describing the 1.9 release of NServiceBus <a href="http://www.udidahan.com/2009/02/07/nservicebus-19/">here</a>.</p>
<h2>What&#8217;s New</h2>
<p>The quickly approaching next release of NServiceBus will be version 2.0 and is a big step from 1.9. After 2 betas and 2 release candidates, this version has had a longer stabilization period than any of the versions so far (1.4-1.9). Many of my clients are already using it in production and are very pleased with it. I&#8217;ve heard similar reports from others in the community (now with over 500 members in the discussion group). There have been almost 10,000 downloads since the version 1.9 release and in every country I visit I meet people using NServiceBus in new and interesting applications.</p>
<p>With my appearance on <a href="http://www.hanselminutes.com/default.aspx?showID=194">Hanselminutes</a>, many in the mainstream .NET industry have started taking a look at NServiceBus. That, and the fact that Microsoft&#8217;s Oslo technology has now taken a very data-driven turn (rather than its original service-oriented direction).</p>
<p>Interestingly enough, I&#8217;ve been hearing more and more reports about people using NServiceBus as a developer-friendly API on top of other technologies. This includes BizTalk and even Neuron. I never thought that people would take the pluggability of NServiceBus that far.</p>
<h2>So, what is NServiceBus?</h2>
<p>Well, it&#8217;s a service bus, y&#8217;know, like an ESB &#8211; just an open-source one.</p>
<p>All kidding aside, in a nutshell, it gives you an easy way to integrate transactional messaging into your applications.</p>
<p>One of the reasons why you might want to do that is so that you don&#8217;t lose messages containing valuable data when IIS recycles your AppDomain, every 15-20 minutes (as I wrote about in <a href="http://msdn.microsoft.com/en-us/magazine/cc663023.aspx">this MSDN magazine article</a>).</p>
<p>There are many other nice things in there, like the ability to unit test your service layers and long-running processes but you can read more about that here&#8230;</p>
<h2>Documentation</h2>
<p>One of the biggest differences to NServiceBus in this release is <b>documentation</b>.</p>
<p>A lot of work has gone into the <a href="http://www.NServiceBus.com">NServiceBus.com</a> site to help developers hit the ground running with NServiceBus, including the more advanced aspects of <a href="http://www.nservicebus.com/Distributor.aspx">transparent scale-out with the distributor</a> and <a href="http://www.nservicebus.com/Gateway.aspx">multi-site communications</a>.</p>
<p>There is still work to be done in this area but feedback so far has been extremely positive (except for some grumblings from certain old-timers saying that if they could figure it out by themselves, well, you know the rest).</p>
<h2>In Closing</h2>
<p>If you&#8217;re building a distributed enterprise .NET system, take 5 minutes, download it, and see transactional publish/subscribe messaging working on your machine without any big heavy-weight middleware.</p>
<p><a href="http://www.NServiceBus.com">www.NServiceBus.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2010/02/01/nservicebus-2-0-release-candidate-2-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hanselminutes on NServiceBus</title>
		<link>http://www.udidahan.com/2009/08/21/hanselminutes-on-nservicebus/</link>
		<comments>http://www.udidahan.com/2009/08/21/hanselminutes-on-nservicebus/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 19:53:11 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Community]]></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>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=1087</guid>
		<description><![CDATA[
Yesterday me and Scott virtually sat down to have a chat about NServiceBus and service buses in general. While we didn&#8217;t get in to many of the more advanced parts, you may find it an interesting introduction to the topic as well as saving yourself the costly mistake of implementing a broker instead of a [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.hanselman.com/blog/images/author.jpg" style="float:right; margin-left:10px; margin-bottom:10px;" /><br />
Yesterday me and Scott virtually sat down to have a chat about NServiceBus and service buses in general. While we didn&#8217;t get in to many of the more advanced parts, you may find it an interesting introduction to the topic as well as saving yourself the costly mistake of implementing a broker instead of a bus (yes &#8211; they&#8217;re actually two different things).</p>
<p><a href="http://www.hanselminutes.com/default.aspx?showID=194">Take a listen.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2009/08/21/hanselminutes-on-nservicebus/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Convention over Configuration &#8211; The Next Generation?</title>
		<link>http://www.udidahan.com/2009/08/15/convention-over-configuration-the-next-generation/</link>
		<comments>http://www.udidahan.com/2009/08/15/convention-over-configuration-the-next-generation/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 18:13:24 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=1081</guid>
		<description><![CDATA[
Convention over configuration describes a style of development made popular by Ruby on Rails which has gained a great deal of traction in the .net ecosystem. After using frameworks designed in this way, I can say that the popularity is justified &#8211; it is much more pleasurable developing this way. 
The thing is, when looking [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.udidahan.com/wp-content/uploads/PicardKirk.jpg" alt="PicardKirk" title="PicardKirk" width="160" height="103" style="float:right; margin-left:10px; margin-bottom:10px; " /><br />
Convention over configuration describes a style of development made popular by Ruby on Rails which has gained a great deal of traction in the .net ecosystem. After using frameworks designed in this way, I can say that the popularity is justified &#8211; it is much more pleasurable developing this way. </p>
<p>The thing is, when looking at this in light of the full software development lifecycle, there are signs that the waters run deeper than we might have originally thought.</p>
<p>Let&#8217;s take things one step at a time though&#8230;</p>
<h3>What is it?</h3>
<p><a href="http://en.wikipedia.org/wiki/Convention_over_configuration">Wikipedia tells us</a>:</p>
<blockquote><p>&#8220;Convention over Configuration (aka Coding by convention) is a software design paradigm which seeks to decrease the number of decisions that developers need to make, gaining simplicity, but not necessarily losing flexibility. The phrase essentially means a developer only needs to specify unconventional aspects of the application.&#8221;</p></blockquote>
<p>What this means is that frameworks built in this way have default implementations that can be swapped out if needed. So far so good.</p>
<h3>For example&#8230;</h3>
<p>In <a href="http://www.NServiceBus.com">NServiceBus</a>, there is an abstraction for how subscription data is stored and multiple implementations &#8211; one in-memory, another using a durable MSMQ queue, and a third which uses a database. The convention for that part of the system is that the MSMQ implementation will be used, unless something else is specified. </p>
<p>Developers wishing to specify a different implementation can specify the desired implementation in the container &#8211; either one that comes out of the box, or their own implementation of ISubscriptionStorage.</p>
<p>Things get more interesting when we consider the full lifecycle.</p>
<h3>Lifecycle effects</h3>
<p>When developers are in the early phases of writing a new service, they want to focus primarily on what the service does &#8211; its logic. They don&#8217;t want to muck around with MSMQ queues for storing subscriptions and would much rather use the in-memory storage. </p>
<p>As the service takes shape and the developers want to run the full service on their machine, possibly testing basic fault-tolerance behaviors &#8211; kill one service, see that the others get a timeout, bring the service back up, wanting it to maintain all the previous subscriptions.</p>
<p>Moving on from there, our developers want to take the same system they just tested on their machine and move it into a staging environment. There, they don&#8217;t want to use the MSMQ implementation for subscription storage, but rather the database implementation &#8211; as will be used in the production environment. </p>
<p>While it may not sound like a big deal &#8211; changing the code which specifies which implementation to use when moving from one environment to another, consider that on top of just subscription storage, there is logging (output to console, file, db?), saga persistence (in-memory, file-based DB, relational DB), and more.</p>
<p>It&#8217;s actually quite likely that something will get missed as we move the system between environments. Can there be a better way?</p>
<h3>What if&#8230;</h3>
<p>What if there was some way for the developer to express their intent to the system, and the system could change its conventions, without the developer having to change any code or configuration files?</p>
<p>You might compare this (in concept) to debug builds and release builds. Same code, same config, but the runtime behaves different between the two.</p>
<p>As I mulled over how we could capture that intent without any code or config changes, the solution that I kept coming to seemed too trivial at first, so I dismissed it. Yet, it was the simplest one that would work for console and WinForms applications, as well as windows services &#8211; command line arguments. The only thing is that I don&#8217;t think those are available for web applications.</p>
<p>But since we&#8217;re still in &#8220;what if&#8221; land, and I&#8217;m more thinking out loud here than providing workable solutions for tomorrow morning, let&#8217;s &#8220;what if&#8221; command line arguments worked for web apps too.</p>
<h3>Command-Line Intent</h3>
<p>Going back to our original scenario, when developers are working on the logic of the service, they run it using the generic NServiceBus host process, passing it the command line parameter /lite (or whatever). The host then automatically configures all the in-memory implementations. </p>
<p>As the system progresses, when the developer wants to run everything on their machine, they run the processes with /integration. The host then configures the appropriate implementations (MSMQ for subscription storage, SQLite for saga persistence, etc. </p>
<p>When the developers want to run the system in production, they could specify /production (or maybe that could be the default?), and the database backed implementations would be configured.</p>
<h3>Imagine&#8230;</h3>
<p>Imagine being able to move that fluidly from one environment to another. Not needing to pore over configuration files or startup script code which configures a zillion implementation details. Not needing to worry that as you moved the system to staging something would break.</p>
<p>Imagine short, frictionless iterations even for large scale systems.</p>
<p>Imagine &#8211; lifecycle-aware frameworks making all this imagination a reality.</p>
<h3>In Closing</h3>
<p>We&#8217;re not there yet &#8211; but we&#8217;re not that far either. The generic host we&#8217;re providing with NServiceBus 2.0 is now being extended to support exactly these scenarios. </p>
<p>It&#8217;s my hope that as more of us think about this challenge, we&#8217;ll come up with better solutions and more intelligent frameworks. Just as convention came to our rescue before, breaking us out of the pain of endless XML configuration, I hope this new family of lifecycle-aware frameworks will make the friction of moving a system through dev, test, staging, and production a thing of the past.</p>
<p>A worthy problem for us all to solve, don&#8217;t you think?</p>
<p>Any ideas on how to make it a reality?<br />
Send them in &#8211; leave a comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2009/08/15/convention-over-configuration-the-next-generation/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>A Queue Isn&#8217;t An Implementation Detail</title>
		<link>http://www.udidahan.com/2009/05/25/a-queue-isnt-an-implementation-detail/</link>
		<comments>http://www.udidahan.com/2009/05/25/a-queue-isnt-an-implementation-detail/#comments</comments>
		<pubDate>Mon, 25 May 2009 18:15:01 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=1015</guid>
		<description><![CDATA[It&#8217;s hard to believe that this continues to pop up even as WCF is reaching its fourth version (emphasis mine):
&#8220;A common complaint is that the first call on a client object takes some disproportionately large amount of time, usually ten seconds or more, while successive calls are instantaneous. There are many reasons why this might [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s hard to believe that this continues to pop up even as WCF is reaching its fourth version (emphasis mine):</p>
<blockquote><p>&#8220;A common complaint is that the first call on a client object takes some disproportionately large amount of time, <b>usually ten seconds or more</b>, while successive calls are instantaneous. There are many reasons why this might happen so <b>there&#8217;s no generic resolution for this problem</b>.&#8221; &#8212; <a href="http://blogs.msdn.com/drnick/archive/2009/05/22/tripping-over-missing-servers.aspx">Nicholas Allen</a></p></blockquote>
<p>The thing is that there <b>IS</b> a generic solution to this problem.</p>
<p>It&#8217;s queued messaging.</p>
<p>The only thing is that you have to give up talking to your services as if they were regular objects &#8211; calling methods on them and expecting a response. In other words, designing a distributed systems isn&#8217;t like designing a regular OO system just with some WCF sprinkled on top.</p>
<p>Even when trying to do fire and forget messaging on top of WCF (void method calls with the OneWay attribute), the underlying channel can still block your thread, as Nick mentioned. </p>
<p>A queue isn&#8217;t an implementation detail.<br />
It&#8217;s the primary architectural abstraction of a distributed system.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2009/05/25/a-queue-isnt-an-implementation-detail/feed/</wfw:commentRss>
		<slash:comments>5</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>NServiceBus 1.9 RTM</title>
		<link>http://www.udidahan.com/2009/04/15/nservicebus-19-rtm/</link>
		<comments>http://www.udidahan.com/2009/04/15/nservicebus-19-rtm/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 10:07:46 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[NServiceBus]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=990</guid>
		<description><![CDATA[After an additional 3 months of stability seen on the release candidate, I&#8217;m happy to say that nServiceBus has now reached a full version 1.9 release. 
Very little has changed, so the version 1.9 story described here is still accurate.
Just last week one of my clients went live with a rollout to one of the [...]]]></description>
			<content:encoded><![CDATA[<p>After an additional 3 months of stability seen on the release candidate, I&#8217;m happy to say that nServiceBus has now reached a full version 1.9 release. </p>
<p>Very little has changed, so the version 1.9 story described <a href="http://www.udidahan.com/2009/02/07/nservicebus-19/">here</a> is still accurate.</p>
<p>Just last week one of my clients went live with a rollout to one of the world&#8217;s biggest names in the hospitality industry and things are looking good. Since stability is such a big deal to them (and many of my other clients), they&#8217;ve rolled out on nServiceBus 1.8 but now are ready to make the move to 1.9. Hopefully we&#8217;ll be able to get a case study out of them <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>For more information, go to the <a href="http://www.NServiceBus.com">NServiceBus site</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2009/04/15/nservicebus-19-rtm/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>NServiceBus 1.9</title>
		<link>http://www.udidahan.com/2009/02/07/nservicebus-19/</link>
		<comments>http://www.udidahan.com/2009/02/07/nservicebus-19/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 20:13:28 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[NServiceBus]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/2009/02/07/nservicebus-19/</guid>
		<description><![CDATA[It&#8217;s been about 6 months since my last post on nServiceBus. In that time about 1000 people have subscribed to this blog and many of them don&#8217;t know anything about it. Also, version 1.9 of nServiceBus appears to be solid enough to drop its &#8220;release candidate&#8221; qualification so this seems like a good time for [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been about 6 months since my last post on nServiceBus. In that time about 1000 people have subscribed to this blog and many of them don&#8217;t know anything about it. Also, version 1.9 of nServiceBus appears to be solid enough to drop its &#8220;release candidate&#8221; qualification so this seems like a good time for this kind of post.<a title="NServiceBus" href="http://www.nservicebus.com"><img style="border-right: 0px; border-top: 0px; margin: 0px 5px 10px 10px; border-left: 0px; border-bottom: 0px" height="73" alt="nServiceBus_banner_2" src="http://www.udidahan.com/wp-content/uploads/nservicebus-banner-2.png" width="244" align="right" border="0"></a> </p>
<h3>What is it?</h3>
<p>From the <a href="http://www.nservicebus.com/">NServiceBus.com</a> site:</p>
<blockquote><p>&#8220;NServiceBus is a powerful, yet lightweight, open source messaging framework <br />for designing distributed .NET enterprise systems. Entirely pluggable yet simple to use, NServiceBus gives programmers a head-start on developing robust, scalable, <br />and maintainable service-layers and long-running business processes.&#8221;</p>
</blockquote>
<p>One of the developers who downloaded nServiceBus, Jürgen, sent me this in an email:</p>
<blockquote><p>&#8220;I took the samples, swapped in my own code, and had a machines subscribing, publishing, messaging, in like 15 minutes. </p>
<p>I&#8217;ve got to tell you &#8211; from reading the architecture stuff on your blog I always thought this stuff was going to be hard. I know you always say its supposed to be simple but I never really believed it. I mean, seriously, if I had to do this stuff with web services or WCF &#8211; well, I wouldn&#8217;t know where to begin.&#8221;</p>
</blockquote>
<p>(His English totally surprised me &#8211; not what you&#8217;d expect from someone called Jürgen. Born in Sweden but grew up in the US.)</p>
<p>BTW, <a href="http://samgentile.com/Web/neuron-esb/enterprise-service-buses-esbs-drive-soa-adoption-part-4/">Sam&#8217;s showed where to begin with WCF:</a> basic pub/sub without durability is 480 LOC. </p>
<h3>What&#8217;s different &#8211; Containers</h3>
<p>People who looked at earlier versions of nServiceBus will see many incremental improvements that smooth over previously rough parts of the framework.</p>
<p>Chris Patterson, co-founder of MassTransit mentioned one such area in his <a href="http://www.lostechies.com/blogs/chris_patterson/archive/2008/12/26/masstransit-turns-one-year-old-celebrations-held-around-the-world.aspx">blog post</a>:</p>
<blockquote><p>&#8220;Both Dru and I needed a framework for asynchronous messaging to address some work-related application requirements. While MSMQ is provided out of the box [on Windows], it doesn&#8217;t directly encourage some good distributed application practices such a loose coupling. Our goal was to abstract the messaging aspects so the services could be built to deal with plain old objects (POCOs) instead of lower level transport messages.</p>
<p>Originally, we both looked at <a href="http://www.nservicebus.com/">NServiceBus</a> as a way to make this happen. I&#8217;ve followed Udi&#8217;s blog for a while and have really gained a lot of knowledge from his posts and presentations. However, our lack of experience in Spring.NET, along with a general lack of understanding of all the complexity of such a framework led us down the path of building our own framework.&#8221;</p>
</blockquote>
<p>Version 1.9 takes a totally different approach (than v1.6/1.7 at which I believe Chris was looking back then) to dependency injection frameworks (like Spring.NET) and decreases their footprint. Developers don&#8217;t need to know anything about Spring, Castle, or any other container to get started, but always have the ability to configure it however they want and even swap in their container of choice.</p>
<h3>What&#8217;s different &#8211; DLL Footprint</h3>
<p>Another difference is the number of assemblies that come with nServiceBus. Nathan Stults had <a href="http://www.thefreakparade.com/2008/06/simple-service-bus-on-codeplex-a-fork-of-nservicebus/">this to say</a> about version 1.8:<br />
<blockquote>
<p>&#8220;NServiceBus (for valid architectural reasons) is split up into eleven thousand, two hundred and nine different DLL’s. That may be an exaggeration, but many of the dll’s have only one or two code files in them, with only a few lines of code each.&#8221;</p>
</blockquote>
<p>NServiceBus has always supported swapping out various technological implementations and will continue do so. For that reason, the development environment is organized into 79 projects whose dependencies are managed very strictly. As of version 1.9, most of these assemblies including many supporting libraries like Spring and Castle have been merged into NServiceBus.dll. There&#8217;s also NServiceBus.Testing.dll which supports fluent-unit-testing entire business processes.
<p>There is one non-optional external dependency which hasn&#8217;t been merged and that is log4net &#8211; although if you configure in a Common.Logging provider to your own logging infrastructure, you can do without it as well. With log4net, the minimum deployment footprint is 2 assemblies. The other dependency which <em>is</em> optional is NHibernate. The reason for leaving these out is that many teams depend on specific versions of those assemblies.
<p>In short &#8211; you reference ONE assembly. Just one.<br />
<h3>&nbsp;</h3>
<h3>What else?</h3>
<p>There is quite a lot in there. Ayende&#8217;s put out several posts describing those features and similarities to the bus he&#8217;s working on:</p>
<ul>
<li><a href="http://ayende.com/Blog/archive/2009/01/14/rhino-service-bus-managing-timeouts.aspx">Managing Timeouts</a></li>
<li><a href="http://ayende.com/Blog/archive/2009/01/16/rhino-service-bus-saga-and-state.aspx">Long-running processes</a></li>
<li><a href="http://ayende.com/Blog/archive/2008/03/24/NServiceBus-Distributor-Review.aspx">Load Balancing</a></li>
</ul>
<p>Ayende&#8217;s description of the NServiceBus load-balancing capability was:</p>
<blockquote><p>&#8220;The distributor section of NServiceBus is a thing of beauty.&#8221;</p>
</blockquote>
<h3>Performance</h3>
<p>You may be surprised by the kind of performance we&#8217;re able to wring out of &#8220;basic&#8221; MSMQ. Keep in mind, though, that you can swap in your own transport &#8211; there are already some others out there on the <a href="http://code.google.com/p/nservicebus-contrib/">Contrib site</a> including ActiveMQ and shared memory.</p>
<p>The most thorough performance numbers I&#8217;ve seen on nServiceBus have been written up <a href="http://www.udidahan.com/2008/05/21/nservicebus-performance/">here</a>:</p>
<blockquote><p>&#8220;total throughput over 1 billion messages an hour. That was about 100 million per hour durable, 900 million per hour non-durable&#8221;</p>
</blockquote>
<p>This was on an 3 blade centers (48 blades), 30 pizza boxes (1U), and 20 clusters, version 1.8.</p>
<p>On <a href="http://gojko.net/2008/12/02/asynchronous-net-applications-with-nservicebus/">Gojko&#8217;s blog</a> there is a video of talk on nServiceBus where Dave de Florinier mentioned throughputs of 600,000 messages per hour (no mention of supporting hardware) and I think it was version 1.7 or 1.8 of nServiceBus.</p>
<p>Recently, Raymond Lewallen posted his numbers for 1.9 to the <a href="http://tech.groups.yahoo.com/group/nservicebus/message/1791">discussion group</a>:</p>
<blockquote><p>&#8220;We load tested our full duplex and pub/sub scenarios the other day at about 500 messages per second with no hiccups at all.&#8221; (save yourself the math, its 1.8M/hr)</p>
</blockquote>
<p>The really interesting numbers are coming in from one of my clients (on 1.9) where the focus is on business process (saga) throughput where they&#8217;re seeing millions completing each day on top of IO intensive technical processes. I&#8217;m excited.</p>
<h3>Looking forward</h3>
<p>After working with clients using nServiceBus over 4 years now (even before it was open source or had a real name), it just keeps getting better. It&#8217;s also really great to see more open source projects coming on the scene &#8211; MassTransit (<a href="http://www.lostechies.com/blogs/chris_patterson/archive/2008/12/26/masstransit-turns-one-year-old-celebrations-held-around-the-world.aspx">now a year old</a>), and <a href="http://ayende.com/Blog/archive/2008/12/17/rhino-service-bus.aspx">Rhino Service Bus</a> (young, but in production with NH-Prof). </p>
<p>The mutual <strike>stealing</strike> cross-pollination is increasing the pace all around.</p>
<p>I intend to take up <a href="http://code.google.com/p/topshelf/">TopShelf</a> (which came out of MassTransit) as the generic service host. That combined with the robust distributor hosting model will make &#8220;grid-friendly&#8221; nServiceBus endpoints much easier. Ayende&#8217;s posts about automatically creating queues and other &#8220;first-time-developer&#8221; features have really worked to decrease the nServiceBus learning curve &#8211; and it shows.</p>
<p>Documentation is a notorious problem in open-source projects and nServiceBus hasn&#8217;t escaped it. API and internal documentation is only now getting close to 100% and the samples now give developers a good start on using it. Those developers looking at swapping out certain bits of functionality have a harder time, but that&#8217;s slowly improving as well. The <a href="http://tech.groups.yahoo.com/group/nservicebus/">discussion group</a> is the best place to get those hard-to-find answers now with a community over 200 strong.</p>
<p>The difficulty developers have in adopting nServiceBus is giving up &#8220;request/response&#8221; thinking. This requires an adjustment to a system&#8217;s architecture and is what most of this blog has been about. Conversely, if you have been following this blog and this thinking resonates with you, you&#8217;ll find it very simple and straight-forward. The <a href="http://www.nservicebus.com/Overview.aspx">overview page</a> on NServiceBus.com also gives a good description of messaging basics &#8211; stuff that I&#8217;ve kind of glossed over on this blog so far.</p>
<p>Go on then. <strong><a href="http://www.nservicebus.com">Take it for a spin</a></strong>. Write a review. Sam Gentile had <a href="http://samgentile.com/blogs/samgentile/archive/2008/06/24/looking-at-nservicebus-added-to-tonight-s-presentation.aspx">this to say</a> about v1.8:</p>
<blockquote><p>&#8220;The bottom line is: I like what I see. Although it&#8217;s a framework, not an ESB product like Neuron, it&#8217;s a powerful framework that takes the right approach on SOA and enforces a paradigm of reliable one-way, *non-blocking* calls.&#8221;</p>
</blockquote>
<p>Can&#8217;t wait to hear the response to 1.9.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2009/02/07/nservicebus-19/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Command Query Separation and SOA</title>
		<link>http://www.udidahan.com/2008/08/11/command-query-separation-and-soa/</link>
		<comments>http://www.udidahan.com/2008/08/11/command-query-separation-and-soa/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 13:18:40 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Smart Client]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/2008/08/11/command-query-separation-and-soa/</guid>
		<description><![CDATA[One of the common questions I receive from people starting to use nServiceBus is how one-way messaging fits with showing the user a grid (or list) of data. Thinking about publish/subscribe usually just gets them even more confused. Trying to resolve all this with Service Oriented Architecture leaves them wondering &#8211; why bother?

In regular client-server [...]]]></description>
			<content:encoded><![CDATA[<p>One of the common questions I receive from people starting to use nServiceBus is how one-way messaging fits with showing the user a grid (or list) of data. Thinking about publish/subscribe usually just gets them even more confused. Trying to resolve all this with Service Oriented Architecture leaves them wondering &#8211; why bother?</p>
<p><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="267" alt="client server" src="http://www.udidahan.com/wp-content/uploads/image38.png" width="477" border="0" /></p>
<p>In regular client-server development, the server is responsible for providing the client with all CRUD (create, read, update, and delete) capabilities. However, when users look at data they do not often require it to be up to date to the second (given that they often look at the same screen for several seconds to minutes at a time). As such, retrieving data from the same table as that being used for highly consistent transaction processing creates contention resulting in poor performance for all CRUD actions under higher load.</p>
<h4>A Scalable Solution </h4>
<p>One of the common answers to this question is for the server/service to publish a message when data changes (say, as the result of processing a message) and for clients to subscribe to these messages. When such a notification arrives at a client, the client would cache the data it needs. Then, when the user wants to see a grid of data, that data is already on the client. Of course, this solution doesn&#8217;t work so well for older client machines (like some point of service devices) or if there are millions of rows of data.</p>
<p>The thing is that this solution is one implementation of a more general pattern &#8211; command query separation (CQS).</p>
<h4>Command Query Separation</h4>
<p>Wikipedia <a href="http://en.wikipedia.org/wiki/Command-query_separation">describes</a> CQS as a pattern where &quot;&#8230; every method should either be a <i>command</i> that performs an action, or a <i>query</i> that returns data to the caller, but not both. More formally, methods should return a value only if they are referentially transparent and hence possess no side effects.&quot;</p>
<p>Martin Fowler is less strict about the use of CQS <a href="http://martinfowler.com/bliki/CommandQuerySeparation.html">allowing for exceptions</a>: &quot;Popping a stack is a good example of a modifier that modifies state. Meyer correctly says that you can avoid having this method, but it is a useful idiom. So I prefer to follow this principle when I can, but I&#8217;m prepared to break it to get my pop.&quot;</p>
<p>So, how does separating commands from queries and SOA help at all in getting data to and from a UI? The answer is based on Pat Helland&#8217;s thinking as described in his article <a href="http://msdn.microsoft.com/en-us/library/ms954587.aspx">Data on the Inside vs. Data on the Outside</a>.</p>
<h4>Services Cross Boxes </h4>
<p>The biggest lie around SOA is that services run.</p>
<p>Let that sink in a second.</p>
<p>Sure services have runnable components, but that&#8217;s not why they&#8217;re important. </p>
<p>I&#8217;ll skip the <a href="http://www.udidahan.com/first-time-here/#soa">books of background</a> and cut to the chase:</p>
<blockquote><p>Services communicate with each other using publish/subscribe and one-way messaging. Services have components inside them. Inside a service, these components can communicate with each using synchronous RPC, or any other mechanism. Also, <em>these components can reside on different machines</em>.</p>
</blockquote>
<p>This is broader than just scaling out a service. There can be service components running on the client as well as the server.</p>
<h4>SOA &amp; CQS</h4>
<p>Combining these two concepts together, here&#8217;s what comes out:</p>
<p><img src="http://www.nservicebus.com/img/CQS.png" /> </p>
<p>In this solution there are two services that span both client and server &#8211; one in charge of commands (create, update, delete), the other in charge of queries (read). These services communicate only via messages &#8211; one cannot access the database of the other. </p>
<p>The command service publishes messages about changes to data, to which the query service subscribes. When the query service receives such notifications, it saves the data in its own data store which may well have a different schema (optimized for queries like a star schema).</p>
<p>The client component which is in charge of showing grids of data to the user behaves the same as it would in a regular layered/tiered architecture, using synchronous blocking request/response to get its data &#8211; SOA doesn&#8217;t change that.</p>
<h4>Composite Applications </h4>
<p>Although the client side components of both the command and query services are hosted in the same process, they are very much independent of each other. That being said, from an interoperability perspective (the one that most people attribute to SOA), all of the client-side components will likely be developed using the same technology &#8211; although there are already ways to <a href="http://www.udidahan.com/2007/05/28/netjava-interop-is-not-a-reason-for-soa/">host Java code in .NET</a> and vice-versa. </p>
<p>Of course, once we talk about web UI&#8217;s things are a bit different &#8211; but still similar. While web-server-side there may be a level of independence, for browser side inter-component communications we&#8217;re still likely to target javascript. There, I&#8217;ve managed to say something technical supporting mashups and SOA without lying through my teeth.</p>
<p>On the Microsoft side with the recent release of the Composite Application Guidance &amp; Library (pronounced &quot;<a href="http://www.codeplex.com/CompositeWPF">prism</a>&quot;) I hope that more of these principles will be reaching the &quot;smart client&quot;. The command pattern is especially critical in maintaining the separation while enabling communication to still occur so I&#8217;m glad that, as one of the Prism advisors, I was able to simplify that part (<a href="http://codebetter.com/blogs/glenn.block/">Glenn</a> still has nightmares about that rooftop conversation).</p>
<h4>Publish / Subscribe</h4>
<p>In the &quot;scalable solution&quot; section up top I mentioned how publish/subscribe to the smart client is really just one implementation of CQS and SOA. So, how different is it really?</p>
<p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="241" alt="smart client pub/sub" src="http://www.udidahan.com/wp-content/uploads/image39.png" width="554" border="0" /> </p>
<p>Well, there will probably be a different technology mapping. Instead of a star-schema OLAP product, we might simply store the published data in memory on the client. That is, if you designed your components to be technology agnostic.</p>
<p>In terms of the use of nServiceBus, the same component is going to be subscribing to the same type of message &#8211; all that&#8217;s different is that now every client will be having data pushed to them rather than this occurring server-side only. </p>
<p>You could have the same code deployed differently in the same system &#8211; stronger clients subscribing themselves, weaker ones using a remote server. Web servers would probably be considered stronger clients. This kind of flexible deployment has proven to be extremely valuable for my larger clients. The added benefit of enabling users to work (view data) even while offline (somewhere there&#8217;s no WIFI) is just icing on the cake.</p>
<h4>A Word of Warning</h4>
<p>Once the client starts receiving notifications, and handling those on a background thread (as it should) the code becomes susceptible to deadlocks and data races. Juval does a good job of outlining <a href="http://www.udidahan.com/2008/04/11/wcf-smart-clients-and-deadlocks/">some of those</a> with respect to the use of WCF. Prism <a href="http://www.udidahan.com/2008/06/09/prism-occasionally-connected/">doesn&#8217;t provide any assurances</a> in this area either.</p>
<h4>Summary</h4>
<p>NServiceBus is not designed to be used for any and all types of communication in a given architecture. In the examples above, nServiceBus handles the publish/subscribe but leaves the synchronous RPC to existing solutions like WCF. Not only that, but synchronous RPC does have its place in architecture, just not across service boundaries. In all cases, data is served to users from a store different from that which transaction processing logic uses.</p>
<p>Command Query Separation is not only a good idea at the method/class level but has advantages at the SOA/System level as well &#8211; yet another good idea from 20 years ago that services build upon. Making use of CQS requires understanding your data and its uses &#8211; SOA builds on that by looking into data volatility and the freshness business requirements around it.</p>
<p>Finally, designing the components of your services in such a way that their dependency on technology is limited buys a lot of flexibility in terms of deployment and, consequently, significant performance and scalability gains.</p>
<p>Simple, it is. Easy, it is not.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/08/11/command-query-separation-and-soa/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Make WCF and WF as Scalable and Robust as NServiceBus</title>
		<link>http://www.udidahan.com/2008/06/30/make-wcf-and-wf-as-scalable-and-robust-as-nservicebus/</link>
		<comments>http://www.udidahan.com/2008/06/30/make-wcf-and-wf-as-scalable-and-robust-as-nservicebus/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 14:47:08 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Reliability]]></category>
		<category><![CDATA[Scalability]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/06/30/make-wcf-and-wf-as-scalable-and-robust-as-nservicebus/</guid>
		<description><![CDATA[This topic is getting more play as more people are using WCF and WF in real-world scenarios, so I thought I&#8217;d pull the things that I&#8217;ve been watching in this space together:
Reliability 
Locking in SqlWorkflowPersistenceService (via Ron Jacobs) where, if you want predictable persistence (MS: &#8216;none of our customers asked for this to be easy&#8217;), [...]]]></description>
			<content:encoded><![CDATA[<p>This topic is getting more play as more people are using WCF and WF in real-world scenarios, so I thought I&#8217;d pull the things that I&#8217;ve been watching in this space together:</p>
<h3>Reliability<a href="http://udidahan.weblogs.us/wp-content/uploads/doctor1.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-thumb1.png" width="225" align="right" border="0"></a> </h3>
<p><a href="http://blogs.msdn.com/rjacobs/archive/2008/06/27/locking-in-sqlworkflowpersistenceservice.aspx">Locking in SqlWorkflowPersistenceService</a> (via Ron Jacobs) where, if you want predictable persistence (MS: &#8216;none of our customers asked for this to be easy&#8217;), you need to use a custom activity (which Ron was kind enough to supply).</p>
<blockquote><p>&#8220;Given what I learned today I&#8217;d have to say that I&#8217;d be very careful about using workflows with an optimistic locking.&nbsp; Detecting these types of situations is not that simple.&#8221;</p>
</blockquote>
<p>Let&#8217;s think about that. If we&#8217;re doing pessimistic locking, we get into the problem of, if a host restarts (as the result of a critical windows patch or some other unexpected occurrence), that the workflow won&#8217;t be able to be handled by any other host in the meantime (you didn&#8217;t care so much about your SLA, did you?).</p>
<p>Luckily, someone&#8217;s come up with a hack that works around this robustness problem in <a href="http://www.topxml.com/rbnews/Orchestration---Workflow/re-78382_Scaleable-Workflow-Persistence-and-Ownership.aspx">Scalable Workflow Persistence and Ownership</a>.</p>
<blockquote><p>&#8220;So this code will attempt to load workflow instances with expired locks every second. Is it a hack? Yes. But without one of two things in the SqlWorkflowPersistenceService its the sort of code you have to write to pick up unlocked workflow instances robustly.&#8221;</p>
</blockquote>
<p>This will seriously churn the table used to store your workflows, decreasing performance of workflows that haven&#8217;t timed out. Oh well.</p>
<h3>Testability</h3>
<p><a href="http://blogs.msdn.com/ploeh/archive/2008/06/26/implementing-wcf-services-without-referencing-wcf.aspx">Implementing WCF Services without Referencing WCF</a> (via Mark Seemann): </p>
<blockquote><p>&#8220;More than a year ago, I wrote my first post on <a href="http://blogs.msdn.com/ploeh/archive/2006/12/03/UnitTestingWCFServices.aspx">unit testing WCF services</a>. One of my points back then was that you have to be careful that the service implementation doesn&#8217;t use any of the services provided by the WCF runtime environment (if you want to keep the service testable). As soon as you invoke something like <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.operationcontext.current.aspx">OperationContext.Current</a>, your code is not going to work in a unit testing scenario, but only when hosted by WCF.&#8221;</p>
</blockquote>
<p>After pointing out some of the more basic difficulties in testability a straightforward WCF implementation brings, Mark turns the heat up in his follow-up post, <a href="http://blogs.msdn.com/ploeh/archive/2008/06/27/modifying-behavior-of-wcf-free-service-implementations.aspx">Modifying Behavior of WCF-Free Service Implementations</a>:</p>
<blockquote><p>&#8220;Perhaps you need to control the service&#8217;s <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.servicebehaviorattribute.concurrencymode.aspx">ConcurrencyMode</a>, or perhaps you need to set <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.servicebehaviorattribute.usesynchronizationcontext.aspx">UseSynchronizationContext</a>. These options are typically controlled by the <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.servicebehaviorattribute.aspx">ServiceBehaviorAttribute</a>. You may also want to provide an <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.iinstanceprovider.aspx">IInstanceProvider</a> via a custom attribute that implements <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.description.icontractbehavior.aspx">IContractBehavior</a>. However, you can&#8217;t set these attributes on the service implementation itself, since it mustn&#8217;t have a reference to System.ServiceModel.&#8221;</p>
</blockquote>
<p>Wow &#8211; all the things required to make a WCF service scalable and thread-safe make it difficult to test. In the end, we&#8217;re beginning to see how many hoops we have to go through in order to get separation of concerns, but until we can take all this and get it out of our application code, it&#8217;s an untenable solution. I hope Mark will continue with this series, if only so I can take the framework that might grow out of it and use it as a generic WCF transport for NServiceBus.</p>
<h3>Comparison<a href="http://udidahan.weblogs.us/wp-content/uploads/apples-and-oranges.jpg"><img style="border-right: 0px; border-top: 0px; margin: 0px 0px 10px 10px; border-left: 0px; border-bottom: 0px" height="244" alt="apples and oranges" src="http://udidahan.weblogs.us/wp-content/uploads/apples-and-oranges-thumb.jpg" width="184" align="right" border="0"></a> </h3>
<p>After the <a href="http://samgentile.com/blogs/samgentile/archive/2008/05/21/response-to-nservicebus-performance.aspx">Neuron-NServiceBus comparison</a> that Sam and I had, we talked some more. After going through some of the rational and thinking, Sam even <a href="http://samgentile.com/blogs/samgentile/archive/2008/06/24/looking-at-nservicebus-added-to-tonight-s-presentation.aspx">put nServiceBus into his WCF-Neuron comparison talk</a>. Sam had this to say about nServiceBus:</p>
<blockquote><p>&#8220;The bottom line is: I like what I see. Although it&#8217;s a framework, not an ESB product like Neuron, it&#8217;s a powerful framework that takes the right approach on SOA and enforces a paradigm of reliable one-way, *non-blocking* calls. That is the point of the talk tonight overall; we need to get away from the stack world of synchronous RPC calls to true asynchronous non-blocking message based SOA systems.&#8221;</p>
</blockquote>
<p>The main concern I have with a WCF+WF based solution is that developers need to know a lot in order to make it testable, scalable, and robust. In nServiceBus, that&#8217;s baked into the design. It would be extremely difficult for a developer writing application logic to interfere with when persistence needs to happen, or the concurrency strategy of long-running workflows. The fact that message handlers in the service layer don&#8217;t need concurrency modes, instance providers, or any of that junk make them testable by default.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/06/30/make-wcf-and-wf-as-scalable-and-robust-as-nservicebus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sagas Solve Stupid Transaction Timeouts</title>
		<link>http://www.udidahan.com/2008/06/23/sagas-solve-stupid-transaction-timeouts/</link>
		<comments>http://www.udidahan.com/2008/06/23/sagas-solve-stupid-transaction-timeouts/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 07:09:31 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Scalability]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/06/23/sagas-solve-stupid-transaction-timeouts/</guid>
		<description><![CDATA[It turns out that there was a subtle, yet dangerous problem in the use of System.Transactions &#8211; a transaction could timeout, rollback, and the connection bound to that transaction could still change data in the database.  
Think about that a second.
Scary, isn&#8217;t it?
At TechEd Israel I had a discussion with Manu on this very [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://weblogs.asp.net/ryangaraygay/archive/2008/04/14/issue-with-system-transactions-sqlconnection-and-timeout.aspx">It turns out</a> that there was a subtle, yet dangerous problem in the use of System.Transactions &#8211; a transaction could timeout, rollback, and the connection bound to that transaction could still change data in the database. <a href="http://udidahan.weblogs.us/wp-content/uploads/image25.png"><img style="border-right: 0px; border-top: 0px; margin: 0px 0px 10px 10px; border-left: 0px; border-bottom: 0px" height="117" alt="image" src="http://udidahan.weblogs.us/wp-content/uploads/image-thumb21.png" width="84" align="right" border="0"></a> </p>
<p>Think about that a second.</p>
<p>Scary, isn&#8217;t it?</p>
<p>At TechEd Israel I had a discussion with <a href="http://blogs.microsoft.co.il/blogs/applisec/">Manu</a> on this very issue, just under a different hat: </p>
<blockquote><p>What&#8217;s the difference between a short-running workflow and a long-running one?</p>
</blockquote>
<p>Manu suggested that we look at the actual time that things ran to differentiate between them. I asserted that if any external communication was involved in some part of state-management logic, that logic should automatically be treated as long-running.</p>
<p>Manu&#8217;s reasoning was that the complexity involved in writing long-running workflows was not justified for things that ran quickly, even if there was communication involved. Many developers don&#8217;t think twice about synchronously calling some web services in the middle of their database transaction logic. In the many Microsoft presentations I&#8217;ve been at on WF, not once has it been mentioned that state machines should be used when external communication is involved.</p>
<p>The problem that I have with this guidance is how do you know how quickly a remote call will return?</p>
<p>Do you just run it all locally on your machine, measure, and if it doesn&#8217;t take more than a second or so, then you&#8217;re OK?</p>
<p>The fact of the matter is that we can never know what the response time of a remote call will be. Maybe the remote machine is down. Maybe the remote process is down. Maybe someone changed the firewall settings and now we&#8217;re doing 10KB/s instead of 10MB/s. Maybe the local service is down and we&#8217;re communicating with the backup on the other side of the Pacific Ocean.</p>
<p>But the thing is, Manu&#8217;s right.</p>
<p>Writing long-running workflows (with WF) is more complex than is justified. My guess is that since WF wasn&#8217;t specifically designed for long-running workflows <em>only</em>, that this complexity crept in.<a href="http://www.nServiceBus.com"><img style="border-right: 0px; border-top: 0px; margin: 0px 0px 10px 10px; border-left: 0px; border-bottom: 0px" height="43" alt="nservicebus_logo_small" src="http://udidahan.weblogs.us/wp-content/uploads/nservicebus-logo-small.png" width="153" align="right" border="0"></a></p>
<p>Sagas in <a href="http://www.nServiceBus.com">nServiceBus</a> <em>were</em> specifically designed for long-running workflows only. </p>
<p>Maybe that&#8217;s what kept them simple.</p>
<p>Since all external communication is done via one-way, non-blocking messaging only, each step of a saga runs as quick as if no communication were done at all. This keeps the time the transaction in charge of handling a message is open as short as possible. That, in turn, leads to the database being able to support more concurrent users. </p>
<p>In short, sagas are both more scalable and more robust.</p>
<p>No need to worry about garbaging-up your database.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/06/23/sagas-solve-stupid-transaction-timeouts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Architecture &amp; Design World 2008</title>
		<link>http://www.udidahan.com/2008/05/31/architecture-design-world-2008/</link>
		<comments>http://www.udidahan.com/2008/05/31/architecture-design-world-2008/#comments</comments>
		<pubDate>Sat, 31 May 2008 11:23:48 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Presentations]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/05/31/architecture-design-world-2008/</guid>
		<description><![CDATA[In the vein of my previous post, I&#8217;ll be coming back to the States a month after TechEd for Dr. Dobb&#8217;s Architecture &#38; Design World 2008.
I&#8217;ll be giving my Avoid a Failed SOA talk (again). Apparently, I&#8217;m not the only one who&#8217;s been seeing one SOA project fail after another. Luckily, I&#8217;ve lived through enough [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://drdobbsarchworld.com/index.php?option=com_content&amp;task=view&amp;id=5&amp;Itemid=42"><img style="margin: 0px 5px 10px 10px" src="http://drdobbsarchworld.com/images/stories/seemead08.gif" align="right" border="0"></a>In the vein of my previous post, I&#8217;ll be coming back to the States a month after TechEd for Dr. Dobb&#8217;s Architecture &amp; Design World 2008.</p>
<p>I&#8217;ll be giving my Avoid a Failed SOA talk (again). Apparently, I&#8217;m not the only one who&#8217;s been seeing one SOA project fail after another. Luckily, I&#8217;ve lived through enough of them to figure out what sort of things empirically have lead to failure, and now I&#8217;m telling the tale. One of the big reasons, by the way, is calling everything in the system a service (and no, adding a prefix doesn&#8217;t change anything &#8211; entity services, process services, etc).</p>
<p>I&#8217;m also going to be speaking about core design principles in my Intentions &amp; Interfaces talk (which was quite a hit at QCon London). The interesting thing I&#8217;ve discovered over the years about design is that generics and dependency injection, when used together, can be used to create extensible systems with very little complexity. Not only that, but that this pattern is useful for all parts of a system, from communication, through data access, all the way to custom validation. As such, it can keep the complexity of the various technology stacks out of your core business logic, giving it a longer lease on life.</p>
<p>Finally, there&#8217;s also going to be a half-day tutorial on nServiceBus. I don&#8217;t want to go on-and-on about it here, but I can say that people who have attended this tutorial have come to me later telling me how they feel that they&#8217;ve had their eyes opened. I try to give just enough theory so that attendees can understand why nServiceBus exists, because after that using nServiceBus is pretty straight forward. This will be the first time I&#8217;m doing this in half-day format, so you&#8217;ll be getting the bottom-line, distilled version of this regularly full-day tutorial.</p>
<p>You can find the list of all my talks <a href="https://www.cmpevents.com/SDUM8/a.asp?option=G&amp;V=3&amp;id=536365">here</a>, and for being the loyal reader you are, you get $100 bucks off the VIP price when you <a href="http://drdobbsarchworld.com/index.php?option=com_content&amp;task=view&amp;id=5&amp;Itemid=42">register</a> using the code 8ASPK.</p>
<p>Hope to see you there. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/05/31/architecture-design-world-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NServiceBus Performance</title>
		<link>http://www.udidahan.com/2008/05/21/nservicebus-performance/</link>
		<comments>http://www.udidahan.com/2008/05/21/nservicebus-performance/#comments</comments>
		<pubDate>Wed, 21 May 2008 07:08:05 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Scalability]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/05/21/nservicebus-performance/</guid>
		<description><![CDATA[I&#8217;ve gotten this question several times already but now companies are beginning to look for performance comparisons in making decisions around the use of nServiceBus. It&#8217;s often compared to straight WCF, BizTalk, and now Neuron ESB. In Sam&#8217;s recent post he posts to a case study of Neuron doing 28 million messages an hour. That&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve gotten this question several times already but now companies are beginning to look for performance comparisons in making decisions around the use of nServiceBus. It&#8217;s often compared to straight WCF, BizTalk, and now Neuron ESB. In Sam&#8217;s <a href="http://samgentile.com/blogs/samgentile/archive/2008/05/19/new-and-notable-243.aspx">recent post</a> he posts to a case study of Neuron doing 28 million messages an hour. That&#8217;s far more than I&#8217;ve ever heard quoted for BizTalk.</p>
<h3>Disclaimer</h3>
<p>Before giving some numbers, please keep in mind that high performance of system infrastructure does not necessarily by itself mean that the system above it is running that fast. For instance, you may have server heartbeats running really quickly but the time it takes to save a purchase order borders on a minute. So, please, take all benchmarks with a grain of salt, or two, or a whole shaker-full.</p>
<p>While I&#8217;m not at liberty to say on which specific domain/company these numbers were measured, I can say that we had the full gamut of &#8220;stateless services&#8221;, statefull services (sagas), number crunching, large data sets, many users, complex visualization, etc. Also, this wasn&#8217;t the largest installation of nServiceBus that I&#8217;m aware of, but its the one I have the most specific numbers for.</p>
<h3>Setup</h3>
<p>OK, so using the default nServiceBus distribution using MSMQ, on servers where the queue files themselves were on separate SCSI RAID disks, we were pumping around 1000 durable, transactionally processed messages per second, per server. That means that similar to the Neuron case, no messages would be lost in the case of a single fault per server per window (time to replace a failed disk set at 3 hours from failure, through detection, to replacement per site &#8211; but that&#8217;s more an operational staffing concern, not the technology itself). </p>
<p>So, that&#8217;s 3.6 million messages per hour per server, at full load. We had a total of 98 servers doing these kinds of processing, not including web servers, databases, etc. Keep in mind that web servers would be communicating with other servers using nServiceBus, but that would maybe be an unfair comparison to the Neuron numbers.</p>
<h3>Server Breakdown</h3>
<p>Anyway, the 48 number crunching servers (blade centers) we had were at full load, so we were pumping more than 170 million messages there. Keep in mind that those servers had a really fast backbone so weren&#8217;t held up by IO. Your environment may be different.</p>
<p>Another 30 (regular pizza boxes) were doing our sagas. Saga state was stored in a distributed in-memory &#8220;cache&#8221;, so once again IO wasn&#8217;t an issue for processing those messages. We were at about 70% utilization there, coming to just over 100 million messages an hour.</p>
<p>The last 20 were clustered boxes (fairly expensive) that handled the various nServiceBus distributor and timeout manager processes were at full load since they handled control messages for all the servers as well as dynamically routing the load. However, on those boxes we used much higher performance disks for the messages, since they had to feed everything else, capable of doing, on average, around 5000 messages a second. That adds up to 360 million messages an hour.</p>
<h3>Unnecessary Durability</h3>
<p>Later, we moved a bunch of messages that didn&#8217;t need all that durability and transactionality off the disks, pushing the total throughput over 1 billion messages an hour. That was about 100 million per hour durable, 900 million per hour non-durable. You can guess that we were left with plenty of IO to spare at that point while we weren&#8217;t yet pushing the limit of our memory.</p>
<p>One thing that&#8217;s important to understand is the size of the messages that didn&#8217;t require durability was less than 1MB, with most weighing in under 10KB. Also, since most of those messages were published, less state management was required around them, enabling us to further improve performance.</p>
<h3>Summary</h3>
<p>NServiceBus didn&#8217;t give us all that by itself. It was the result of skilled architects, developers, and operations staff working together for many iterations, deploying, monitoring, re-designing, etc. You need to understand your technology, your hardware, and your specific performance, availability, and fault-tolerance requirements if you want to get anywhere.</p>
<p>There&#8217;s no magic.</p>
<p>I didn&#8217;t see the number or kinds of servers involved in the Neuron case study so this wasn&#8217;t ever really a comparison. Nor or we talking about the same system here. </p>
<p>So, please, don&#8217;t base your decisions on arbitrary numbers. Spend some time setting up a scaled down version of your target architecture with all the relevant technologies and <em>measure</em>. Be aware that you want high performance end to end, not just of the messaging part. At times, it makes sense to actively throw away messages (of the non-durable, published kind) to help a server come online faster especially after a restart.</p>
<p>Thus ends the tale of another &#8220;benchmark&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/05/21/nservicebus-performance/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>WCF, Smart Clients, and Deadlocks</title>
		<link>http://www.udidahan.com/2008/04/11/wcf-smart-clients-and-deadlocks/</link>
		<comments>http://www.udidahan.com/2008/04/11/wcf-smart-clients-and-deadlocks/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 09:15:38 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Simplicity]]></category>
		<category><![CDATA[Smart Client]]></category>
		<category><![CDATA[Threading]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/04/11/wcf-smart-clients-and-deadlocks/</guid>
		<description><![CDATA[There&#8217;s a new article up on MSDN describing how to write Smart Clients using WCF. The author is none other than WCF-Master Lowy and he goes over the multitude of ways you can deadlock yourself.
Here&#8217;s a taste:
UI Thread and Concurrency Management
Whenever you use hosting on the UI thread, deadlocks are possible. For example, the following [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a new article up on MSDN describing how to write Smart Clients using WCF. The author is none other than <a href="http://www.idesign.net/">WCF-Master Lowy</a> and he goes over the multitude of ways you can deadlock yourself.</p>
<p>Here&#8217;s a taste:</p>
<blockquote><h3>UI Thread and Concurrency Management</h3>
<p>Whenever you use hosting on the UI thread, deadlocks are possible. For example, the following setup is guaranteed to result with a deadlock: A Windows Forms application is hosting a service with <b>UseSynchronizationContext</b> set to <b>true</b>, and UI thread affinity is established. The Windows Forms application then calls the service over one of its endpoints. The call to the service blocks the UI thread, while WCF posts a message to the UI thread to invoke the service. That message is never processed, because of the blocking UI thread—hence, the deadlock.
<p>Another possible case for a deadlock occurs when a Windows Forms application is hosting a service with <b>UseSynchronizationContext</b> set to <b>true</b> and UI thread affinity is established. The service receives a call from a remote client. That call is marshaled to the UI thread and is eventually executed on that thread. If the service is allowed to call out to another service, that can result in a deadlock if the callout causality tries somehow to update the UI or call back to the service’s endpoint, because all of the service instances that are associated with any endpoint (regardless of the service-instancing mode) share the same UI thread.
<p>Similarly, you risk a deadlock if the service is configured for reentrancy and it calls back to its client. You risk a deadlock if the callback causality tries to update the UI or enter the service, because that reentrance must be marshaled to the blocked UI thread.</p>
</blockquote>
<p>Actually, I have difficulty believing that Juval would go so far as to suggest that even the forms should be services, but he does:<br />
<blockquote>
<h3>Form as a Service</h3>
<p>The main motivation for hosting a WCF service on the UI thread is if the service must update the UI or the form. The problem is always: How does the service reach out and obtain a reference to the form? While the techniques and ideas that appear thus far in the listings certainly work, <font color="#800000" size="4"><strong><em>it would be simpler yet if the form were the service</em></strong></font> and hosted itself. For this to work, the form (or any window) must be a singleton service. The reason is that singleton is the only instancing mode that enables you to provide WCF with a live instance to host. In addition, you would not want a per-call form that exists only during a client call (which is usually very brief), nor would you want a per-session form that only a single client can establish a session with and update.
<p>When a form is also a service, <font color="#800000" size="4"><strong><em>having that form as a singleton service is the best instancing mode all around</em></strong></font>.</p>
</blockquote>
<p>I think that this article serves as a great treatise leading to only one conclusion &#8211; you&#8217;d have to be crazy to try to do this without some higher level framework, preferably with a different low-level framework too <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  . Sucks Microsoft didn&#8217;t put one out &#8211; nor is there a pending beta, CTP, or even word about some project with a codename handling this. From what I know about <a href="http://www.codeplex.com/prism">Prism</a>, it doesn&#8217;t intend to handle this issue either.
<p>One thing that isn&#8217;t covered in the article is that if you do choose not to tie the client-side service to the UI thread, you open yourself up to race conditions. Reasons you&#8217;d want to handle messages on a different thread center around UI responsiveness. I&#8217;ve written about these things before:
<ul>
<li>
<h4><a href="http://udidahan.weblogs.us/2007/12/06/object-builder-the-place-to-fix-system-wide-threading-bugs/">Object Builder &#8211; the place to fix system-wide threading bugs</a></h4>
</li>
<li>
<h4><a href="http://udidahan.weblogs.us/2007/12/07/eureka-aop-is-the-final-piece-of-the-multi-threaded-smart-client-puzzle/">Eureka! AOP is the final piece of the multi-threaded smart client puzzle</a></h4>
</li>
<li>
<h4><a href="http://udidahan.weblogs.us/2007/12/26/what-makes-smart-clients-safe/">What Makes Smart Clients Safe?</a></h4>
</li>
</ul>
<p>The more I read things like this, the more I feel that I have to get going with my nServiceBus based solution. I&#8217;m fairly swamped as it is, so if anyone is interested in helping get this project off the ground, I&#8217;d be most grateful &#8211; as I think anyone else that had to build a smart client would. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/04/11/wcf-smart-clients-and-deadlocks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>NServiceBus Explanations</title>
		<link>http://www.udidahan.com/2008/03/30/nservicebus-explanations-3/</link>
		<comments>http://www.udidahan.com/2008/03/30/nservicebus-explanations-3/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 11:36:48 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[NServiceBus]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Ayende&#8217;s been going over nServiceBus, seeing how it&#8217;s built, and raising various questions and concerns. I&#8217;ll begin by taking them from the outside, in &#8211; that is, first API questions, and then internal structure issues.
SendLocal
First of all, the effect of calling SendLocal on IBus takes all the logical messages passed in (params IMessage[] messages), wraps [...]]]></description>
			<content:encoded><![CDATA[<p>Ayende&#8217;s been <a href="http://ayende.com/Blog/archive/2008/03/24/NServiceBus-Review.aspx">going over</a> nServiceBus, seeing how it&#8217;s built, and raising various questions and concerns. I&#8217;ll begin by taking them from the outside, in &#8211; that is, first API questions, and then internal structure issues.</p>
<h3>SendLocal</h3>
<p>First of all, the effect of calling SendLocal on IBus takes all the logical messages passed in (params IMessage[] messages), wraps them in a single TransportMessage, and puts that physical message at the end of the local queue. This call is equivalent to calling &#8220;Send(TransportMessage m, string destination);&#8221; on ITransport when passing in transport.Address as the parameter of destination.</p>
<p>There are numerous advantages to having this method, but one is the most important.</p>
<p>When client send a service a set of messages using &#8220;void Send(params IMessage[] messages);&#8221;, the client is <em>requesting</em> that the server treat this batch of messages as a unit of work. Under certain conditions, the service may choose to ignore the clients wishes &#8211; not least of which because the client has sent a ton of messages and the service doesn&#8217;t want ACID transactions to last a long time as they hurt throughput. In this case the server would use an intercepting message handler to go over those messages and call SendLocal for each. In other words, the server can set up units of work as it sees fit &#8211; taking into account client preference as well.</p>
<p>Other advantages include the ability to break apart complex or long-running logic into an &#8220;internal pipeline&#8221;. The Timeout Manager also makes use of this facility for &#8220;holding onto&#8221; messages until some condition occurs.</p>
<h3>Return(errorCode)</h3>
<p>The reason that integers are used as error codes is just so that you can push enums through them. This is the simplest way to get errors back to the client. More importantly, we take into account who on the client would be interested in this data.</p>
<p>Clients are often built using MVC with an additional Service Agent layer. Service Agents deal with translating the intent of Controllers into messages. Controllers don&#8217;t know about messaging, nor should they. However, they need to know when something fails with calls they initiated. As such, they are the final consumer of these error-code-enums, and integers are used to express them; that way Controllers don&#8217;t need to take a dependency on nServiceBus.</p>
<h3>DoNotContinueDispatchingCurrentMessageToHandlers</h3>
<p>This method on bus is used by intercepting message handlers in order to instruct the bus not to pass the current message on to subsequent handlers in the pipeline. This is often used by authentication and authorization handlers when those checks fail. This is what makes the message handling pipeline possible.</p>
<h3>BuildAndDispatch</h3>
<p>This method is defined on IBuilder and is used by the bus when dispatching messages to handlers. The reason that this exists instead of just having the bus ask the builder to create the handler and dispatch the call itself has to do with client-side threading. You can find the full explanation here &#8211; <a href="http://udidahan.weblogs.us/2007/12/06/object-builder-the-place-to-fix-system-wide-threading-bugs/">Object Builder, the place to fix system-wide threading bugs</a>.</p>
<h3>Summary</h3>
<p>NServiceBus has grown over the years in environments where I&#8217;ve had the luxury of deciding most, if not all of the design of the systems involved. As such, it has taken on just the responsibilities needed from infrastructure in order to develop robust, flexible, and scalable systems. Check out the <a href="http://www.nservicebus.com">nServiceBus site</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/03/30/nservicebus-explanations-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I Hate WSDL</title>
		<link>http://www.udidahan.com/2008/03/28/i-hate-wsdl/</link>
		<comments>http://www.udidahan.com/2008/03/28/i-hate-wsdl/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 16:44:28 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/03/28/i-hate-wsdl/</guid>
		<description><![CDATA[Ted says it really well, and let me add a big +1.
Note to those who didn&#8217;t attend the session: you didn&#8217;t hear me say it, so I&#8217;ll repeat it: I hate WSDL almost as much as I hate Las Vegas. Ask me why sometime, or if I get enough of a critical mass of questions, [...]]]></description>
			<content:encoded><![CDATA[<p>Ted <a href="http://blogs.tedneward.com/2008/03/28/Hangin+In+Vegas.aspx">says it really well</a>, and let me add a big +1.</p>
<blockquote><p><em>Note to those who didn&#8217;t attend the session: you didn&#8217;t hear me say it, so I&#8217;ll repeat it: I hate WSDL almost as much as I hate Las Vegas. Ask me why sometime, or if I get enough of a critical mass of questions, I&#8217;ll blog it. If you&#8217;ve seen me do talks on Web Services, though, you&#8217;ve probably heard the rant: WSDL creates tightly-coupled endpoints precisely where loose coupling is necessary, WSDL encourages schema definitions that are inflexible and unevolvable, and WSDL intrinsically assumes a synchronous client-server invocation model that doesn&#8217;t really meet the scalability or feature needs of the modern enterprise. And that&#8217;s just for starters.</em>
<p><em>I hate WSDL.</em>
<p><em>I still hate Vegas more, though.</em></p>
</blockquote>
<p><a href="http://udidahan.weblogs.us/wp-content/uploads/image11.png"><img style="border-right: 0px; border-top: 0px; margin: 0px 0px 0px 20px; border-left: 0px; border-bottom: 0px" height="156" alt="image" src="http://udidahan.weblogs.us/wp-content/uploads/image-thumb8.png" width="152" align="right" border="0"></a> Web Services, and WSDL by connection have taken hold of the industry like cancer &#8211; inhibiting the minds of otherwise intelligent developers and architects. Whenever I get the &#8220;Web Services Question&#8221; (Does X support Web Services &#8211; where X is some design pattern, tool, and sometimes nServiceBus), I have to suppress an urge to groan &#8211; I&#8217;ve got the question <em>that</em> many times. The other day I was at a client and Sam, their head architect asked me that question. I gave my stock response:</p>
<blockquote><p>&#8220;When you say &#8216;Web Services&#8217;, are you referring to SOAP or WSDL, and is HTTP a necessary component too?&#8221;</p>
</blockquote>
<p>See how good I got at the suppressing thing?</p>
<p>Sam conceded that Web Services over TCP is OK too, so I pressed on with:</p>
<blockquote><p>&#8220;What about UDP? FTP? MSMQ? Is it still &#8216;Web Services&#8217; then? Is the rule then that &#8216;Web Services&#8217; == SOAP?&#8221;</p>
</blockquote>
<p>At that point, Sam was beginning to get a little flustered. </p>
<blockquote><p>&#8220;And what&#8217;s so great about SOAP? Is it the interoperability? Because that&#8217;s just because it&#8217;s based on XSD.&#8221;</p>
</blockquote>
<p>He didn&#8217;t know how to reply. Instead, he walked away from the whiteboard and sat down. I didn&#8217;t let up:</p>
<blockquote><p>&#8220;And what if we want to do something other than Request/Response? How about one request with many responses? How about many requests and one response? And why does this decision need to be rigid? Shouldn&#8217;t we just be able to decide programmatically how many responses we want to return? Wouldn&#8217;t that flexibility be better than creating huge response structures for web methods to return?&#8221;</p>
</blockquote>
<p><a href="http://udidahan.weblogs.us/wp-content/uploads/image13.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="132" alt="image" src="http://udidahan.weblogs.us/wp-content/uploads/image-thumb9.png" width="189" align="right" border="0"></a> Sam made his last stand:</p>
<blockquote><p>&#8220;Look, we can&#8217;t go and do something different from the rest of the industry. Everybody else is doing Web Services. It&#8217;s not like the technology doesn&#8217;t work.&#8221;</p>
</blockquote>
<p>I gave way, a little:</p>
<blockquote><p>&#8220;If you want, we can offer two interfaces. One, the flexible, robust, scalable XSD over messaging based solution. The second, an icky, synchronous Web Services facade which calls into our first interface. </p>
<p>I&#8217;m not saying that the technology doesn&#8217;t work &#8211; but both of us know that every problem has multiple solutions, some are fragile and error prone like WS, others are more elegant and have decades of knowledge behind them like messaging.</p>
<p>But we can do both if you like. How&#8217;s that?&#8221;</p>
</blockquote>
<p><a href="http://udidahan.weblogs.us/wp-content/uploads/image14.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="166" alt="image" src="http://udidahan.weblogs.us/wp-content/uploads/image-thumb11.png" width="244" align="right" border="0"></a> And it was agreed. The entire system would be built on one-way messaging patterns using XSD in cases where interoperability was required. And WS would be layered on, like a tiny little pig on top of a gigantic lipstick &#8230; thing &#8211; hmm, that metaphor isn&#8217;t really working &#8211; well, you get the idea.</p>
<p>I hate WSDL. Never been to Vegas, though.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/03/28/i-hate-wsdl/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SOA Training Videos and Pricing</title>
		<link>http://www.udidahan.com/2008/03/24/soa-training-videos-and-pricing/</link>
		<comments>http://www.udidahan.com/2008/03/24/soa-training-videos-and-pricing/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 10:15:40 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Training]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/03/24/soa-training-videos-and-pricing/</guid>
		<description><![CDATA[It looks like the SOA training videos will start coming in the next week or so. 
So, I&#8217;ve started thinking what else should be included so that you get the most out of them.
Here&#8217;s what I&#8217;ve currently got in mind:

All the powerpoint presentations
Full source and samples of nServiceBus so you can run the code as [...]]]></description>
			<content:encoded><![CDATA[<p>It looks like the <a href="http://udidahan.weblogs.us/2008/02/08/interested-in-soa-training-videos/">SOA training videos</a> will start coming in the next week or so. </p>
<p>So, I&#8217;ve started thinking what else should be included so that you get the most out of them.</p>
<p>Here&#8217;s what I&#8217;ve currently got in mind:</p>
<ul>
<li>All the powerpoint presentations</li>
<li>Full source and samples of nServiceBus so you can run the code as I talk about it</li>
<li>4 hours of <a href="http://udidahan.weblogs.us/2008/02/25/would-you-spend-a-buck-to-save-a-hundred/">online consultation</a> so you can get up to speed quickly in applying these principles and practices to your project</li>
</ul>
<p>If you have anything else in mind that you think will help, please drop me a comment below.</p>
<p>So far, 32 people have expressed interest in getting this and it looks like I should be able to handle up to about 40 in a timely manner with my current setup. I hadn&#8217;t originally thought about corporate licensing, but since there have been some requests (so that all employees can use the information freely, get copies of the DVD&#8217;s, etc), I&#8217;ll be doing that too. If you&#8217;ve already left a comment about your interest in the DVD&#8217;s, I&#8217;ll assume you want the personal option. If you want to change that to the corporate option, please leave a comment either here or on the <a href="http://udidahan.weblogs.us/2008/02/08/interested-in-soa-training-videos/">previous post</a>.</p>
<h3>Pricing</h3>
<p>Ayende mentioned that the guys from Dot Net Rocks are selling Sharepoint training for about $700 per developer for a day of training. I really don&#8217;t know how much to charge for this &#8211; the guys in Australia paid quite a bit and I wouldn&#8217;t want them to feel &#8211; well, like you feel when you find out that the guy sitting next to you on the plane paid half what you did for his ticket; especially given that they&#8217;ve done so much of the production work on the DVD&#8217;s (Simon, Brad &#8211; you guys are my heroes. I really couldn&#8217;t do this without you).</p>
<p>So, I figure that I&#8217;ll hear what <strong>you</strong> guys think that the package is worth first. Leave me comment, or send me an <a href="mailto:DvdPricing@UdiDahan.com">email</a> if you&#8217;d like more anonymity.</p>
<p>I&#8217;d also be interested in hearing what kind of domain you&#8217;re thinking about applying this stuff to &#8211; I might be able to put you in touch with people already applying SOA and nServiceBus in those areas so you can learn from each other as well.</p>
<p>Looking forward to hearing from you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/03/24/soa-training-videos-and-pricing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>QCon London 2008 Recap</title>
		<link>http://www.udidahan.com/2008/03/20/qcon-london-2008-recap/</link>
		<comments>http://www.udidahan.com/2008/03/20/qcon-london-2008-recap/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 09:07:06 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[OO]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/03/20/qcon-london-2008-recap/</guid>
		<description><![CDATA[Well QCon was a blast.
NServiceBus Tutorial
I gave a full day tutorial on nServiceBus and we had a full house! The tutorial was about 90% how to think about distributed systems, and 10% mapping those concepts onto nServiceBus. I made an effort to cram about 3 days of a 5 day training course I give clients [...]]]></description>
			<content:encoded><![CDATA[<p>Well QCon was a blast.</p>
<h3>NServiceBus Tutorial</h3>
<p>I gave a full day tutorial on <a href="http://www.nservicebus.com">nServiceBus</a> and we had a full house! The tutorial was about 90% how to think about distributed systems, and 10% mapping those concepts onto nServiceBus. I made an effort to cram about 3 days of a 5 day training course I give clients into one day, but I think I was only about 85% successful. People didn&#8217;t have the time needed to let things really sink in and ask questions, but the <a href="http://tech.groups.yahoo.com/group/nservicebus/">lively forums</a> and <a href="http://udidahan.weblogs.us/2008/02/25/would-you-spend-a-buck-to-save-a-hundred/">skype conversations</a> available will probably do the trick.</p>
<p><a href="http://jim.webber.name/">Jim Webber</a> after looking at the unit testing features of nServiceBus had this to say:</p>
<blockquote><p>&#8220;Oh my God &#8211; you&#8217;ve created testable middleware! It&#8217;ll never catch on. The vendors won&#8217;t have it.&#8221;</p>
</blockquote>
<p>To which I replied that several vendors were already coming on board with their own implementations of transports and saga persistence. I have absolutely no intention, desire, or (quite frankly) the ability to write an enterprise-class middleware runtime. All I hope to do with nServiceBus is to make it so that developers use what&#8217;s out there in one, middleware-product-agnostic way that will make their code more robust and flexible.</p>
<h3>MEST &amp; Mark &#8211; REST &amp; Stefan</h3>
<p>It was also great finally meeting the head MESTian, <a href="http://markclittle.blogspot.com/">Mark Little</a>, who also happens to work for Redhat as SOA Technical Development Manager and Director of Standards in the JBoss division. It was interesting to see the difference between how I went about messaging in nServiceBus (full peer-to-peer including pub/sub) whereas most of the Java world has the messaging infrastructure handled by something database-like in a deployment/networking kind of perspective. If that&#8217;s the way things are done, then I can definitely appreciate the advantages of <a href="http://udidahan.weblogs.us/2007/06/20/space-based-architecture-%e2%80%93-scalable-but-not-much-to-do-with-soa/">Space-Based Architectures</a>.</p>
<p>And I even got to steal <a href="http://www.innoq.com/blog/st/">Stefan Tilkov</a>&#8217;s RESTful ear for an hour or so before I had to jet back home. It looks like we MESTians and RESTians can be one big happy family. I&#8217;m guessing that our despise of WS connects us all at a deeper level <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Core Design Principles</h3>
<p>I also gave a talk about core design principles, &#8220;Intentions &amp; Interfaces &#8211; making patterns concrete&#8221;, and it went over very well especially considering that that was the first time that I gave that talk. You can find the slides <a href="http://www.eos1.dk/qcon-london-2008/slides/UdiDahan_IntentionsAndInterfaces.pdf">here</a>. From the feedback I heard after the talk, I think many people were surprised how many different parts of a system can be designed this way, and how flexible it is without making the code any more complex. The message was this:</p>
<blockquote><p>Make Roles Explicit</p>
</blockquote>
<p>Despite its simplicity, that leads to IEntity, IValidator&lt;T&gt; where T : IEntity, (which I wrote about a year ago &#8211; <a href="http://udidahan.weblogs.us/2007/04/30/generic-validation/">generic validation</a>) and with a bit of Service Locator capabilities, you can add a line of code to your infrastructure that will validate all entities before they&#8217;re sent from the client to the server. </p>
<p>It leads to IFetchingStrategy&lt;T&gt; for improved database loading performance (also a year old &#8211; <a href="http://udidahan.weblogs.us/2007/03/06/better-domain-driven-design-implementation/">better DDD implementation</a> and the <a href="http://udidahan.weblogs.us/2007/09/16/fetching-strategy-nhibernate-implementation-available/">NHibernate implementation</a>). </p>
<p>It&#8217;s also how nServiceBus does message handling &#8211; IMessage, IMessageHandler&lt;T&gt; where T: IMessage, ISaga&lt;T&gt; where T : IMessage.</p>
<h3>San Francisco?</h3>
<p>Just a quick shout to my readers in the San Francisco area, if you&#8217;d be interested in hearing these talks/tutorials, give the organizers of QCon a <a href="mailto:qcon@infoq.com">shout</a> and they&#8217;ll bring me out. That&#8217;s actually what got me to London &#8211; one of the attendees of a talk I gave at Oredev in Sweden last November missed my tutorial there so he put in a request and that did it. (Thanks Jan, I appreciate it!)</p>
<p>If you&#8217;re in a different part of the world and you&#8217;d like to have me give one of these talks, or other ones (I have a fair amount of material on Domain Models/DDD and Occasionally Connected Smart Clients), I&#8217;d be happy to make the trip and see you there as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/03/20/qcon-london-2008-recap/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>NServiceBus.com information</title>
		<link>http://www.udidahan.com/2008/02/22/nservicebuscom-information/</link>
		<comments>http://www.udidahan.com/2008/02/22/nservicebuscom-information/#comments</comments>
		<pubDate>Fri, 22 Feb 2008 22:44:08 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[NServiceBus]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/02/22/nservicebuscom-information/</guid>
		<description><![CDATA[www.NServiceBus.com is online.
It&#8217;s not &#8220;done&#8221; yet, but I&#8217;m pretty sure it&#8217;s past time that nServiceBus had its own site separate from this blog. I&#8217;m still working out the DNS and other domain forwarding and hosting stuff, but we&#8217;re live.
There is some information on the &#8220;overview&#8221; page about one-way messaging, store-and-forard, and why those patterns were chosen [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nservicebus.com/">www.NServiceBus.com</a> is online.</p>
<p>It&#8217;s not &#8220;done&#8221; yet, but I&#8217;m pretty sure it&#8217;s past time that nServiceBus had its own site separate from this blog. I&#8217;m still working out the DNS and other domain forwarding and hosting stuff, but we&#8217;re live.</p>
<p>There is some information on the &#8220;overview&#8221; page about one-way messaging, store-and-forard, and why those patterns were chosen for nServiceBus.</p>
<p><a href="http://www.nServiceBus.com">Check it out</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/02/22/nservicebuscom-information/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>NServiceBus on Virtual TechEd</title>
		<link>http://www.udidahan.com/2008/02/21/nservicebus-on-virtual-teched/</link>
		<comments>http://www.udidahan.com/2008/02/21/nservicebus-on-virtual-teched/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 22:33:58 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/02/21/nservicebus-on-virtual-teched/</guid>
		<description><![CDATA[Well, I had almost forgot about that interview.
When I was at TechEd Barcelona last November (07), the morning after I flew in I experienced &#8220;the fish bowl&#8221; and Virtual TechEd for the first time. Anyway, after a short chat &#8211; and quite to my surprise, my interviewer, Paul Foster, decided that we should talk about [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I had almost forgot about that interview.</p>
<p>When I was at TechEd Barcelona last November (07), the morning after I flew in I experienced &#8220;the fish bowl&#8221; and <a href="http://www.virtualteched.com">Virtual TechEd</a> for the first time. Anyway, after a short chat &#8211; and quite to my surprise, my interviewer, Paul Foster, decided that we should talk about nServiceBus.</p>
<p>So here it is. The Microsoft/Marketing friendly description of what nServiceBus is and how nicely it plays with things like WCF and WF. Always be a gracious guest. Don&#8217;t bite the hand that feeds you. But a nibble here and there &#8211; well, that you can get away with <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h3>Download:</h3>
<div class="VerboseSpecial">
<p style="font-size: 11px; line-height: 30px"><a style="font-size: 11px; color: #003399; text-decoration: none" href="http://www.virtualteched.com/Videos/EU_1_udahan_pfoster_FB_100.wmv ">Zune</a>&nbsp;<a style="font-size: 11px; color: #003399; text-decoration: none" href="http://www.virtualteched.com/Videos/EU_1_udahan_pfoster_FB_500.mp4"> iPod</a>&nbsp; WMV&nbsp; <a style="font-size: 11px; color: #003399; text-decoration: none" href="http://www.virtualteched.com/Videos/EU_1_udahan_pfoster_FB_100.wmv ">LOW</a> | <a style="font-size: 11px; color: #003399; text-decoration: none" href="http://www.virtualteched.com/Videos/EU_1_udahan_pfoster_FB_300.wmv ">MED</a> | <a style="font-size: 11px; color: #003399; text-decoration: none" href="http://www.virtualteched.com/Videos/EU_1_udahan_pfoster_FB_500.wmv ">HIGH</a><br />They have a Silverlight version available <a href="http://www.virtualteched.com/pages/videos.aspx">here</a> as well &#8211; at the bottom of the page.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/02/21/nservicebus-on-virtual-teched/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.virtualteched.com/Videos/EU_1_udahan_pfoster_FB_100.wmv" length="9233811" type="video/x-ms-wmv" />
<enclosure url="http://www.virtualteched.com/Videos/EU_1_udahan_pfoster_FB_300.wmv" length="28710717" type="video/x-ms-wmv" />
<enclosure url="http://www.virtualteched.com/Videos/EU_1_udahan_pfoster_FB_500.wmv" length="47015165" type="video/x-ms-wmv" />
		</item>
		<item>
		<title>Advanced Messaging with a dash of DDD</title>
		<link>http://www.udidahan.com/2008/02/18/advanced-messaging-with-a-dash-of-ddd/</link>
		<comments>http://www.udidahan.com/2008/02/18/advanced-messaging-with-a-dash-of-ddd/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 11:07:48 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Availability]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Reliability]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/02/18/advanced-messaging-with-a-dash-of-ddd/</guid>
		<description><![CDATA[Following my last post (From CRUD to Domain-Driven Fluency) a bunch of questions have started popping up. One that I received via email from a client up in Ireland particularly caught my eye, so here it is:
Hi Udi, I think&#160; I see the point about the domain-driven approach but I&#8217;m wondering what my messages will [...]]]></description>
			<content:encoded><![CDATA[<p>Following my last post (<a href="http://udidahan.weblogs.us/2008/02/15/from-crud-to-domain-driven-fluency/">From CRUD to Domain-Driven Fluency</a>) a bunch of questions have started popping up. One that I received via email from a client up in Ireland particularly caught my eye, so here it is:</p>
<blockquote><p>Hi Udi, I think&nbsp; I see the point about the domain-driven approach but I&#8217;m wondering what my messages will look like. If it&#8217;s this:
<p><font face="Consolas" size="2">IAppointment InsertInterview(Guid recruiterId, Guid applicantId, Guid appointmentId); </font>OR
<p><font face="Consolas" size="2">IRecuiter UpdateRecuiter(IRecuiter recruiter); </font>(passing in an operation flag attached to the IRecuiter object) OR
<p><font face="Consolas" size="2">IRecuiter UpdateRecuiter(IRecuiter recruiter); </font>(setting a state flag on the relevant object and have the business object check the flag and behave according the state change)
<p>Hope I’m not way off
<p>Sean</p>
</blockquote>
<p>Well, Sean, first of all &#8211; messages don&#8217;t look like functions. They&#8217;re a lot more like structures &#8211; data transfer objects. In this case, you&#8217;d probably be looking at a ScheduleInterviewMessage that had the relevant fields. It would look something like this:
<p>&nbsp;<!-- 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;*/
}</p>
<p>.csharpcode pre { margin: 0em; }</p>
<p>.csharpcode .rem { color: #008000; }</p>
<p>.csharpcode .kwrd { color: #0000ff; }</p>
<p>.csharpcode .str { color: #006080; }</p>
<p>.csharpcode .op { color: #0000c0; }</p>
<p>.csharpcode .preproc { color: #cc6633; }</p>
<p>.csharpcode .asp { background-color: #ffff00; }</p>
<p>.csharpcode .html { color: #800000; }</p>
<p>.csharpcode .attr { color: #ff0000; }</p>
<p>.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}</p>
<p>.csharpcode .lnum { color: #606060; }
</style>
<div class="csharpcode">
<pre class="alt"><span class="lnum">   1:  </span><span class="kwrd">using</span> System;</pre>
<pre><span class="lnum">   2:  </span><span class="kwrd">using</span> NServiceBus;</pre>
<pre class="alt"><span class="lnum">   3:  </span><span class="kwrd">using</span> System.Xml.Serialization;</pre>
<pre><span class="lnum">   4:  </span>&nbsp;</pre>
<pre class="alt"><span class="lnum">   5:  </span><span class="kwrd">namespace</span> Messages</pre>
<pre><span class="lnum">   6:  </span>{</pre>
<pre class="alt"><span class="lnum">   7:  </span>    [Serializable]</pre>
<pre><span class="lnum">   8:  </span>    [Recoverable]</pre>
<pre class="alt"><span class="lnum">   9:  </span>    [TimeToBeReceived(<span class="str">"0:01:00.000"</span>)]</pre>
<pre><span class="lnum">  10:  </span>    <span class="kwrd">public</span> <span class="kwrd">class</span> ScheduleInterviewMessage : IMessage</pre>
<pre class="alt"><span class="lnum">  11:  </span>    {</pre>
<pre><span class="lnum">  12:  </span>        <span class="kwrd">public</span> Guid InterviewerId;</pre>
<pre class="alt"><span class="lnum">  13:  </span>        <span class="kwrd">public</span> Guid CandidateId;</pre>
<pre><span class="lnum">  14:  </span>        <span class="kwrd">public</span> DateTime RequestedTime;</pre>
<pre class="alt"><span class="lnum">  15:  </span>&nbsp;</pre>
<pre><span class="lnum">  16:  </span>        [XmlAnyElement]</pre>
<pre class="alt"><span class="lnum">  17:  </span>        <span class="kwrd">public</span> <span class="kwrd">object</span> extra;</pre>
<pre><span class="lnum">  18:  </span>    }</pre>
<pre class="alt"><span class="lnum">  19:  </span>}</pre>
</div>
<p>Before we go on, I want to explain what we see. The &#8220;recoverable&#8221; attribute is the way we indicate to the infrastructure that these messages should not be lost in case a server fails, there are network problems, etc. In essence, it does durable, store-and-forward messaging. This will create an environment in which, in the case of network problems, these messages will be written to disk. That&#8217;s a good thing, since once connectivity comes back or the server boots back up, the messages will still be around and can be sent.</p>
<p>Now these messages are fairly small, so even at a relatively high load, we shouldn&#8217;t be chewing through too much of our expensive, small, high performance local disks. However, if these messages were bigger, we may fill up our disks before connectivity comes back, and we all know what happens to Windows boxes when there&#8217;s no room on the file system left:</p>
<p><img style="margin: 0px 0px 0px 20px" src="http://www.ferzkopp.net/joomla/images/stories/bsod.gif"></p>
<p>In order to prevent our system from <strong>Denial-of-Servicing</strong> itself we need to make those messages clean themselves up. That&#8217;s what the &#8220;TimeToBeReceived&#8221; attribute is for. The amount of time that if a message had not yet been received by the other side that it will be deleted. This could be that the message even made it to the other machine, but the process handling those messages was down. You wouldn&#8217;t want to be filling the other side&#8217;s disk either causing them to crash, would you? This protects both parties.</p>
<p>The way to figure out how long to set is by looking at the smallest amount of durable storage you have available at your nodes, divide that by the size of the average message, and then again by the rate you need to process messages &#8211; and leave yourself at least 100% spare.</p>
<h2>In other words, to build a robust system you not only will need to deal with lost messages, but you will be actively throwing messages away.</h2>
<p>Finally, that last &#8220;XmlAnyElement&#8221; attribute is there for versioning. As we version our system and schema, we&#8217;ll be adding fields to the message. However, an old client may be talking to a new server, or vice versa. Since we wouldn&#8217;t want data to get lost just because of serialization. In a future post, I&#8217;ll show how to set up a message handler pipeline exactly for these issues.</p>
<p>Now that we&#8217;ve covered all the intricacies around messaging, we can see how the code that handles that above message looks:</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<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;*/
}</p>
<p>.csharpcode pre { margin: 0em; }</p>
<p>.csharpcode .rem { color: #008000; }</p>
<p>.csharpcode .kwrd { color: #0000ff; }</p>
<p>.csharpcode .str { color: #006080; }</p>
<p>.csharpcode .op { color: #0000c0; }</p>
<p>.csharpcode .preproc { color: #cc6633; }</p>
<p>.csharpcode .asp { background-color: #ffff00; }</p>
<p>.csharpcode .html { color: #800000; }</p>
<p>.csharpcode .attr { color: #ff0000; }</p>
<p>.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}</p>
<p>.csharpcode .lnum { color: #606060; }
</style>
<div class="csharpcode">
<pre class="alt"><span class="lnum">   1:  </span><span class="kwrd">using</span> System;</pre>
<pre><span class="lnum">   2:  </span><span class="kwrd">using</span> Messages;</pre>
<pre class="alt"><span class="lnum">   3:  </span><span class="kwrd">using</span> NServiceBus;</pre>
<pre><span class="lnum">   4:  </span><span class="kwrd">using</span> NHibernate;</pre>
<pre class="alt"><span class="lnum">   5:  </span>&nbsp;</pre>
<pre><span class="lnum">   6:  </span><span class="kwrd">namespace</span> Server</pre>
<pre class="alt"><span class="lnum">   7:  </span>{</pre>
<pre><span class="lnum">   8:  </span>    <span class="kwrd">public</span> <span class="kwrd">class</span> ScheduleInterviewMessageHandler :</pre>
<pre class="alt"><span class="lnum">   9:  </span>                 BaseMessageHandler&lt;ScheduleInterviewMessage&gt;</pre>
<pre><span class="lnum">  10:  </span>    {</pre>
<pre class="alt"><span class="lnum">  11:  </span>        <span class="kwrd">public</span> <span class="kwrd">override</span> <span class="kwrd">void</span> Handle(ScheduleInterviewMessage message)</pre>
<pre><span class="lnum">  12:  </span>        {</pre>
<pre class="alt"><span class="lnum">  13:  </span>            <span class="kwrd">using</span> (ISession session = SessionFactory.OpenSession())</pre>
<pre><span class="lnum">  14:  </span>            <span class="kwrd">using</span> (ITransaction tx = session.BeginTransaction())</pre>
<pre class="alt"><span class="lnum">  15:  </span>            {</pre>
<pre><span class="lnum">  16:  </span>                ICandidateInterviewer interviewer = session.Get&lt;ICandidateInterviewer&gt;(</pre>
<pre class="alt"><span class="lnum">  17:  </span>                        message.InterviewerId);</pre>
<pre><span class="lnum">  18:  </span>                ICandidate candidate = session.Get&lt;ICandidate&gt;(</pre>
<pre class="alt"><span class="lnum">  19:  </span>                        message.CandidateId);</pre>
<pre><span class="lnum">  20:  </span>&nbsp;</pre>
<pre class="alt"><span class="lnum">  21:  </span>                interviewer.ScheduleInterviewWith(candidate)</pre>
<pre><span class="lnum">  22:  </span>                        .At(message.RequestedTime);</pre>
<pre class="alt"><span class="lnum">  23:  </span>&nbsp;</pre>
<pre><span class="lnum">  24:  </span>                tx.Commit();</pre>
<pre class="alt"><span class="lnum">  25:  </span>            }</pre>
<pre><span class="lnum">  26:  </span>&nbsp;</pre>
<pre class="alt"><span class="lnum">  27:  </span>            <span class="rem">// publish new appointment data</span></pre>
<pre><span class="lnum">  28:  </span>        }</pre>
<pre class="alt"><span class="lnum">  29:  </span>    }</pre>
<pre><span class="lnum">  30:  </span>}</pre>
</div>
<p>If you&#8217;ve read this far and have more questions, please feel free to <a href="mailto:questions@UdiDahan.com">send them my way</a>. If you&#8217;re at a more time-critical part of your project and need an answer quickly, we can <a href="mailto:OnlineConsultation@UdiDahan.com">set up a skype call</a>. This has been working quite well for many of my overseas clients (shout out to the guys in Ireland and Florida).</p>
<p>Until next time <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/02/18/advanced-messaging-with-a-dash-of-ddd/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>NServiceBus Version 1.7 Available</title>
		<link>http://www.udidahan.com/2008/02/11/nservicebus-version-17-available/</link>
		<comments>http://www.udidahan.com/2008/02/11/nservicebus-version-17-available/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 08:30:00 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[NServiceBus]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/02/11/nservicebus-version-17-available/</guid>
		<description><![CDATA[Get it here.
Some important features:


TimeoutMessages now handled by separate endpoint

allows for scaling out timeout handling &#8211; can use a distributor behind that endpoint
improves performance of other endpoints &#8211; less messages to handle


When sagas complete, TimeoutMessages for those sagas get cleared as well

improves throughput when sagas that can take a long time complete quickly
this is done [...]]]></description>
			<content:encoded><![CDATA[<p>Get it <a href="http://sourceforge.net/project/showfiles.php?group_id=209277&amp;package_id=251027&amp;release_id=575480">here</a>.</p>
<p>Some important features:</p>
<blockquote>
<ul>
<li>TimeoutMessages now handled by separate endpoint
<ul>
<li>allows for scaling out timeout handling &#8211; can use a distributor behind that endpoint</li>
<li>improves performance of other endpoints &#8211; less messages to handle</li>
</ul>
</li>
<li>When sagas complete, TimeoutMessages for those sagas get cleared as well
<ul>
<li>improves throughput when sagas that can take a long time complete quickly</li>
<li>this is done by sending a TimeoutMessage with a Clear flag</li>
</ul>
</li>
<li>Testing environment for sagas (<a href="http://udidahan.weblogs.us/2008/02/04/sagas-and-unit-testing-business-process-verification-made-easy/">example available</a>)
<ul>
<li>Reminder class removed to make testing more explicit</li>
<li>Timeout Manager address now configured like all other messages</li>
</ul>
</li>
<li>Change number of worker threads for an endpoint dynamically
<ul>
<li>After finding a bottleneck (most messages in queue), can increase the number of resources allocated to that endpoint by sending a message</li>
<li>Enables writing scripts which monitor all endpoints and use rules to allocate resources at runtime &#8211; like a grid</li>
<li>Simple UI available for monitoring queues and allocating threads</li>
</ul>
</li>
</ul>
</blockquote>
<blockquote>
<ul>
<li>Configure queues by using transport independent format:  queueName@MachineName</li>
<li>SagaMessageHandler designed to be inherited from and overridden for simpler business process handling &#8211; see saga sample message handlers</li>
<li>One Message Handler class can now handle more than one type of message without needing to handle IMessage</li>
<li>Even when configured incorrectly, messages don&#8217;t get lost &#8211; they&#8217;re forwarded to an error queue, which is how admins will know to fix the config, and then can replay those messages again.</li>
</ul>
</blockquote>
<p>You might enjoy reading <a href="http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,c090e1b0-ffbc-4116-9575-c277939f2651.aspx">this</a> as a comparison for how WF tries to support multiple hosts running the same process.</p>
<p>Here&#8217;s the download link again &#8211; <a href="http://sourceforge.net/project/showfiles.php?group_id=209277&amp;package_id=251027&amp;release_id=575480">download here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/02/11/nservicebus-version-17-available/feed/</wfw:commentRss>
		<slash:comments>2</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>Java MSMQ Interop on Windows</title>
		<link>http://www.udidahan.com/2008/02/08/java-msmq-interop-on-windows/</link>
		<comments>http://www.udidahan.com/2008/02/08/java-msmq-interop-on-windows/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 14:09:41 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Interoperability]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[NServiceBus]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/02/08/java-msmq-interop-on-windows/</guid>
		<description><![CDATA[An interesting development.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.msdn.com/dotnetinterop/archive/2008/02/06/java-native-interface-library-for-msmq-opensource-on-codeplex.aspx">An interesting development.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/02/08/java-msmq-interop-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
