<?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; MSMQ</title>
	<atom:link href="http://www.udidahan.com/category/msmq/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 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>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>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>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>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>
		<item>
		<title>Distributed Architecture on ARCast.TV Rapid Response</title>
		<link>http://www.udidahan.com/2008/01/14/distributed-architecture-on-arcasttv-rapid-response/</link>
		<comments>http://www.udidahan.com/2008/01/14/distributed-architecture-on-arcasttv-rapid-response/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 23:45:34 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[Podcast]]></category>
		<category><![CDATA[Scalability]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/01/14/distributed-architecture-on-arcasttv-rapid-response/</guid>
		<description><![CDATA[A while ago, me and Ron Jacobs (virtually) got together and did a couple &#8220;rapid responses&#8221; to questions on the MSDN architecture forums, and I just noticed that they&#8217;re online. The really great thing is that there are transcripts! For your convenience, I&#8217;ve included them here.
By the way, if you&#8217;re looking for more Q&#38;A style [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago, me and Ron Jacobs (virtually) got together and did a couple &#8220;rapid responses&#8221; to questions on the MSDN architecture forums, and I just noticed that they&#8217;re <a href="http://channel9.msdn.com/ShowPost.aspx?PostID=348243#348243">online</a>. The really great thing is that there are transcripts! For your convenience, I&#8217;ve included them here.</p>
<p>By the way, if you&#8217;re looking for more Q&amp;A style info, check out the <a href="/category/ask-udi-podcast/">Ask Udi podcast</a>. If you have a pressing question and need a shorter turn around time than the month or so it usually takes me for the podcast, send me an email to <a href="mailto:OnlineConsultation@UdiDahan.com">OnlineConsultation@UdiDahan.com.</a></p>
<h3>Number 1</h3>
<blockquote class="speaker_3_text"><p><cite class="speaker_3"><strong>Ron:</strong></cite> Hey, welcome back to ARCast Rapid  Response. This is your host Ron Jacobs and today I&#8217;m looking at the MSDN  architecture forum where I see this message from &#8220;theking2.&#8221; Yeah? OK, so  &#8220;king,&#8221; he says, he&#8217;s building a distributed architecture that has a number of  external systems. These external systems interface through a telnet connection  and so they accept commands and return results as ACKS or  NACKS.</p>
<p>Typically these systems have limited resources for the number of  simultaneous sessions you can open, so, five to fifty depending on the system.  What he did to get around this, was, he created some Enterprise Services objects  and some pooled objects that set up these connections and then he has some Web  services. The Web services are going to receive an incoming message. They&#8217;re  going to call these pooled COM+ objects and they&#8217;re going to make the telnet  calls to the external systems. Sounds interesting.</p>
<p>He says, after a year  of production it has become apparent that some of the external systems are not  performing very well. He says the bulk of the requests, but not all, to the  external systems can be done asynchronously. So, he&#8217;s opting for a message  queue-based solution using pseudosynchronous calls whenever a direct response is  needed.</p>
<p>So, the question is, at what layer would message queuing make  most sense?</p>
<p>So, should the clients, this Web service that receives the  message &#8212; should it do a queue? Put a message in the queue and then the COM+  objects would pop off or they have some central Web services that would pop it.  So, the central Web services or these Enterprise Service objects? Or maybe just  a communication at the top of the telnet. He says this is the first time when  he&#8217;s using message queuing.</p>
<p>On the line with me I have Udi Dahan, the  Software Simplist from Israel.</p>
<p>Udi, this is a very interesting  application and my first gut reaction is, does it really matter where you put  the queuing?</p></blockquote>
<blockquote class="speaker_4_text"><p><cite class="speaker_4"><strong>Udi  Dahan:</strong></cite> Well, actually I took a look at it as well and I&#8217;d have  to say that it does because the problem that he&#8217;s trying to solve isn&#8217;t that  clear. We know that there is some sort of performance problem but we&#8217;re not  quite sure where it is. We know that there are long and varying latencies in the  responses but we&#8217;re not really quite sure why.</p>
<p>While we know that their  external system is a bit slow but our choice of where to put the queue will  probably have an impact, obviously on the development model of the clients and  the Web services as well as how those external systems would work. So, I&#8217;d have  to say that choosing the correct place to put the queue is important.</p></blockquote>
<blockquote class="speaker_3_text"><p><cite class="speaker_3"><strong>Ron:</strong></cite> Well, let me interject something  here because what you said just made me think. Now, if the problem is that these  external systems are slow and limited number of connections, the first question  we ought to ask is, does queuing help this situation at all?</p></blockquote>
<blockquote class="speaker_5_text"><p><cite class="speaker_5"><strong>Udi:</strong></cite> Well, that&#8217;s probably a good first  step. I mean every single time someone comes with a solution and then says, &#8220;OK,  what&#8217;s the problem,&#8221; it&#8217;s always a good thing to check that solution  first.</p>
<p>It looks like the problem that he has here has to deal with or the  reason that he wants to use a queue is to do some kind of load leveling. He&#8217;s  getting too many requests or at too high a rate from his clients and external  Web services and external web applications more than his back end systems can  use. So, using a queue as a load leveling mechanism is definitely the right way  to go. So, from that perspective I think that putting a queue somewhere in there  is a good idea.</p></blockquote>
<blockquote class="speaker_3_text"><p><cite class="speaker_3"><strong>Ron:</strong></cite> OK. So then if you put a queue, it  seems to me that it&#8217;s not going to make that much difference which layer you put  the queue, would it?</p></blockquote>
<blockquote class="speaker_5_text"><p><cite class="speaker_5"><strong>Udi:</strong></cite> Well, it might for the main reason  that you really have to look at where his bottleneck is and that&#8217;s his back end  systems. The bottleneck also has to do with the number of connections that can  be opened and the number of sessions that can be opened. The place that I&#8217;d be  looking at doing that is probably between those pooled COM+ objects and his  central Web services for the main reason that that really gives a nice  encapsulation in terms of the Web services towards both his organization&#8217;s  internal services if they are other Web services, web applications or clients  and everybody else that&#8217;s going on out there while keeping that abstraction out  of the way.</p>
<p>So, the choice of using pooled COM objects is one of the ways  he does the load leveling now. One of the problems he has is that it doesn&#8217;t  seem to be doing that much for him because the switches and knobs that are  available in COM+ in order to do that load leveling aren&#8217;t that great. What I&#8217;d  be looking at in his situation is to put a queue in there but on the back side  of that queue, not talking directly to the external system but doing something  with WCF.</p>
<p>WCF has an incredible amount of switches and knobs in order to  do the load throttling and the number of threads that are open. He could also do  that on a large number of URIs in order to sort of split up the load from that  perspective allowing him to cache results quite a bit better. So, that&#8217;s where  I&#8217;d be looking at too. Just throw away those COM+ objects, put WCF in there, use  the MSMQ binding and start configuring things from there.</p></blockquote>
<blockquote class="speaker_3_text"><p><cite class="speaker_3"><strong>Ron:</strong></cite> There&#8217;s a lot of stuff in the  message, but I think his core concern is performance. He mentions  pseudosynchronous calls. I think by that he means, a message comes in to the web  service, he&#8217;s going to drop something on the queue and then hold that message  response until he gets a response back from a queue. So, it&#8217;s sort of  synchronous but sort of not synchronous. So, in effect he&#8217;s kind of waiting on a  queue instead of waiting on the pooled object to make this outbound telnet  call.</p>
<p>I could agree if you said, &#8220;Well, look, our big problem is that we  keep getting time outs because when we go to get a COM+ object from the pool,  COM+ waits for a while and then it says, &#8220;Hey, there&#8217;s no object available&#8217; and  it returns an error,&#8221; then the queue is definitely going to help that problem.  But in terms of the sheer through put or performance of the system, this is not  going to help at all. It&#8217;s going to still be the same performance.</p>
<p>Now if  you said, &#8220;Oh look, we can do some of this work kind of at a later point in  time, &#8221; well queuing doesn&#8217;t allow you to time shift the work. Right? So, if you  said, &#8220;Look we can rethink this solution.&#8221; So you get a message in, we stuff  something in a queue that we&#8217;ll deal with later, and then very quickly return a  response like some kind of a number like, hey &#8220;your transaction number blah,  blah, blah, will be processed later, it&#8217;s queued for processing, &#8221;  whatever.</p>
<p>I mean that introduces a lot of complexity in the system but it  clearly would provide better response at the Web service layer. What do you  think?</p></blockquote>
<blockquote class="speaker_5_text"><p><cite class="speaker_5"><strong>Udi:</strong></cite> Well I think that at the most basic  level, his throughput is dictated by his back end systems. From what he seems to  be describing, every single request that is going through there, has to hit that  back end system. If he has a limited number of back end systems that are  supporting a limited number of connections, that&#8217;s going to limit his throughput  no matter what technology he puts in front of that. So that&#8217;s at the core level.  You just can&#8217;t get away from that.</p>
<p>The one thing that I would agree with  you in your description there is the choice of using those COM+ objects. I mean  COM+ was a great technology when it came out. The problem occurs, of course,  when we start getting into larger and larger delays around the response time and  we start getting all sorts of time out exceptions and things like that. So in  that respect, I definitely say you know, take a step back from there.</p>
<p>But  in terms of everything that he has around there, the queue isn&#8217;t going to make  the back end system run any faster. What it will do is definitely complicate his  system because he&#8217;s taking something that used to be synchronous and making it  asynchronous. Writing Web services in order to handle that, I mean just adding a  bunch of threads in order to listen to queues is not going to make things any  simpler.</p>
<p>However, what it might do is to improve the resource usage of  those Web services, OK? So instead of having those Web services have a bunch of  threads open, waiting for the response coming back from those COM+ pooled  objects, those threads could be relinquished and really just be triggered back  up when a response comes back from the queue.</p>
<p>So I don&#8217;t see an  improvement in the kind of solution that MSMQ or queuing would put in there in  terms of the latency &#8212; how long it would take for a response to get back.  However, I do see an improvement in terms of the resource usage of all the other  players in the system.</p></blockquote>
<blockquote class="speaker_3_text"><p><cite class="speaker_3"><strong>Ron:</strong></cite> I would agree with that. I would  just say though that if you make the Web server that is hosting these Web  services more resource efficient, maybe all you&#8217;re going to do is enable it to  get more requests in queue the more quickly. Ultimately, this solution I think  is going to solve a lot of problems related to time outs and server busy errors  and that sort of thing, thread contentions, but not likely to increase overall  performance.</p>
<p>But I definitely agree though. I would move this solution  forward to WCF. I used to be on the COM+ team. COM+ was rolled into WCF so that  it would have similar capabilities for pooling, instancing behavior,  transactional support, those sorts of things. I would definitely move that  forward into WCF.</p>
<p>OK! So great answer, Udi. Thank you so much for being  on this ARCast Rapid Response.</p></blockquote>
<h3>Number 2</h3>
<blockquote class="speaker_3_text"><p><cite class="speaker_3"><strong>Ron:</strong></cite> Hey this is Ron Jacobs back with  another ARCast.TV Rapid Response. Today I&#8217;m joined by Udi Dahan, the Software  Simplist from Israel.</p>
<p>Udi, I&#8217;m looking at the MSDN Architecture Forum and  here&#8217;s a question from &#8220;blast.&#8221; Blast says he&#8217;s looking for where to put  business rules. He&#8217;s developing a WinForm application. He uses data sets as the  data layer, he says. He&#8217;s thinking about business rules and where to put  them.</p>
<p>He says obviously, the more organized and centralized business  rules are, the better. He&#8217;s tempted to put the business rules in the UI layer  especially with the type data set. It makes a lot of sense there but not all  rules belong on the client. He says some rules belong on the server, perhaps in  a trigger.</p>
<p>So he&#8217;s asking where do you put your rules? How do you think  about this problem, Udi?</p></blockquote>
<blockquote class="speaker_5_text"><p><cite class="speaker_5"><strong>Udi:</strong></cite> Well, it looks like what he&#8217;s doing  here is developing a two-tier client that is using WinForms and using datasets  and speaking directly to the database. That in essence is part of his problem in  that in terms of performance, he&#8217;d like to run more rules in the UI layer so  that the user won&#8217;t be sending garbage to the database.</p>
<p>He also  understands that because he&#8217;s building a multi-user system, there is a limited  capability, in terms of concurrency, of actually having all the rules run  correctly in order to make sure that everything is correct. So, his choice of an  architecture, working two-tier is the main problem of why he has to fragment his  business rules.</p>
<p>If he were to move towards a three-tier solution, that is  put an application server between his smart client and the database, it would be  a lot easier to put those business rules there. Now, once the business rules are  out of the database, because again, we don&#8217;t have to deal with the concurrency  issues once we have an application server and we&#8217;re using transactions there and  we don&#8217;t have any disconnected problems, then what we can do is use those same  DLLs, that same CLR code that runs the business rules, and deploy it client-side  and use it there.</p>
<p>So, in terms of deployment, what we&#8217;d have is we&#8217;d have  the same rules, both running client-side and server-side, whereas from a  development perspective, we&#8217;d have them organized and centralized. That&#8217;s the  way that I&#8217;d go about it.</p></blockquote>
<blockquote class="speaker_3_text"><p><cite class="speaker_3"><strong>Ron:</strong></cite> Yeah, you know, I think  conceptually I agree with you that a multi-tier solution would be a very good  idea here. What I would probably think about conceptually, is breaking down  rules into things that really ought to happen on the client-side. In particular,  rules related to validation of data, so you know that you&#8217;ve got good and  complete data before you ship it off to the server-side. Oftentimes you have to  do that anyway because you have a button that shouldn&#8217;t be enabled until the  data is valid, or something like that.</p></blockquote>
<blockquote class="speaker_5_text"><p><cite class="speaker_5"><strong>Udi:</strong></cite> Absolutely.</p></blockquote>
<blockquote class="speaker_3_text"><p><cite class="speaker_3"><strong>Ron:</strong></cite> Of course, we all know that if you  have middle-tier web services, you must do validation both on the client-side  and the server-side, because you must ensure that the valid data is received on  the web server. So I agree with you that creating an assembly that you deploy on  both sides is a good idea.</p>
<p>I would just expand on what you said a little  bit and think about maybe on the server-side using a workflow foundation and  business rules and workflow as a way to handle a lot of the heavier lifting,  server-side validations and business rules that might require maybe sifting  through more data or whatever kind of things, but server-side business rules  that are more oriented towards business logic, and even if you have very, very  data-intensive roles, then maybe some of those might even happen in the  database. Don&#8217;t you agree?</p></blockquote>
<blockquote class="speaker_5_text"><p><cite class="speaker_5"><strong>Udi:</strong></cite> Oh, absolutely. Absolutely. That&#8217;s  something that I think often gets swept under the rug too much. Things like  unique constraints and things like that are kinds of business rules. They  protect the referential integrity and if we look at the alternatives, sometimes  getting 10 million rows out of the database, in order to do some sort of unique  email validation upon them, that&#8217;s just going to kill your  performance.</p>
<p>There are certain things that it just makes sense to do them  in the database, it&#8217;s just the best way to do it. The hard part, from a  development perspective, is maintaining the coherence of your business rules.  When you say, &#8220;OK, I want a single perspective, what are all the rules in my  system?&#8221;</p>
<p>Even though we might try to keep it all CLR based, some of the  things like unique constraints, like referential integrity, will be in the  database. So, what I sometimes suggest to do is to have a separate solution, in  terms of your development team, where you put all your business  rules.</p>
<p>This includes both the SQL statements for defining your unique  constraints and your referential integrity. Also put in that validation logic,  your workflow that you&#8217;re going to be running server-side. If it&#8217;s AJAX controls  and regular expressions that you&#8217;re going to be doing client-side in order to  validate that data, absolutely make sure you have, from a development  perspective, one place where you can go where you can see everything, because if  you don&#8217;t do that [inaudible] can be running, and when things stop working, you  won&#8217;t know how to debug it.</p></blockquote>
<blockquote class="speaker_3_text"><p><cite class="speaker_3"><strong>Ron:</strong></cite> All right. Well, excellent answer.  Udi, thank you so much.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/01/14/distributed-architecture-on-arcasttv-rapid-response/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Durable Messaging Is Not Enough</title>
		<link>http://www.udidahan.com/2008/01/09/durable-messaging-is-not-enough/</link>
		<comments>http://www.udidahan.com/2008/01/09/durable-messaging-is-not-enough/#comments</comments>
		<pubDate>Wed, 09 Jan 2008 23:17:27 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Availability]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Scalability]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/01/09/durable-messaging-is-not-enough/</guid>
		<description><![CDATA[I&#8217;ve been sitting on this post for a while, waiting, before outlining all the kinds of problems durable messaging doesn&#8217;t solve, I wanted to have a solution handy. Harry Pierson begins to outline the goodness that durable messaging brings to SOA, and in a later post on idempotence describes in general terms how it ties [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been sitting on this post for a while, waiting, before outlining all the kinds of problems durable messaging doesn&#8217;t solve, I wanted to have a solution handy. Harry Pierson begins to outline the goodness that <a href="http://devhawk.net/2007/05/30/The+Case+For+Durable+Messaging+In+Service+Orientation.aspx">durable messaging brings to SOA</a>, and in a <a href="http://devhawk.net/2007/11/09/The+Importance+Of+Idempotence.aspx">later post on idempotence</a> describes in general terms how it ties back into durable messaging and transaction &#8211; in essence describing a <a href="http://udidahan.weblogs.us/2007/12/17/no-more-workflow-for-nservicebus-please-welcome-the-saga/">saga</a>. Let&#8217;s do this in story form.</p>
<p>Since you&#8217;re concerned that maybe your shipping company&#8217;s servers may be down for some kind of planned (or unplanned) maintenance just as you&#8217;re trying to fulfill orders, you use a durable messaging solution there. What happens is that messages get written to disk on your end, and later the messaging tries to transfer the messages until it succeeds. So what&#8217;s wrong with that?</p>
<p>Well, let&#8217;s say that the shipping company&#8217;s servers went up in smoke (true story &#8211; broken down air conditioners + poor ventilation, you get the picture). Those servers aren&#8217;t going to be coming back online any second now. So, you have all these order messages buffering on your disk. Taking into account all the data, meta-data, XML, SOAP, encryption and everything, we may get up to 1MB per message.</p>
<p>And now&#8217;s holiday season and your company&#8217;s selling hand over fist, hundreds of orders per second from all over the world. So that means we&#8217;re eating up 100MB of disk per second, that&#8217;s 6GB a minute, and in under an hour of our shipping company&#8217;s servers going down &#8211; so do ours.</p>
<p>Durable messaging &#8211; yay? We don&#8217;t want to lose those orders, right? In short, durable messaging is an important part of the solution, but it&#8217;s not the whole solution.</p>
<p>[Continued next time...]</p>
<p>If you&#8217;re impatient and just want the solution, yes, <a href="http://www.nServiceBus.com">nServiceBus</a> give you all the tools you need.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/01/09/durable-messaging-is-not-enough/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>[Podcast] Message Ordering: Is it Cost Effective?</title>
		<link>http://www.udidahan.com/2008/01/01/podcast-message-ordering-is-it-cost-effective/</link>
		<comments>http://www.udidahan.com/2008/01/01/podcast-message-ordering-is-it-cost-effective/#comments</comments>
		<pubDate>Tue, 01 Jan 2008 23:01:16 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Ask Udi Podcast]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Threading]]></category>

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

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/12/12/scalability-you-wish-youre-gonna-need-it/</guid>
		<description><![CDATA[&#8220;Is it still valid to assume it is more expensive to design a scalable system?&#8221;
In Gavin Terrill&#8217;s news post on InfoQ, Big Architecture Up Front &#8211; A Case of Premature Scalaculation? he covers one of the questions so many of my clients deal with:
&#8220;How hard will it be to make it scale later?&#8221;
This is a [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;Is it still valid to assume it is more expensive to design a scalable system?&#8221;</p>
<p>In Gavin Terrill&#8217;s news post on InfoQ, <a href="http://www.infoq.com/news/2007/12/bauf">Big Architecture Up Front &#8211; A Case of Premature Scalaculation?</a> he covers one of the questions so many of my clients deal with:</p>
<p>&#8220;How hard will it be to make it scale later?&#8221;</p>
<p>This is a valid question, especially for companies/products just beginning their lifecycle. When the product/web site isn&#8217;t bringing in any revenue yet, how much money should we spend on getting it ready for that future success?</p>
<p>The answer to that question lies in treating capacity and scalability differently (<a href="http://www.pervasivecode.com/blog/2007/11/13/capacity-vs-scalability/">source</a>).</p>
<p>What I mean by that is designing for scalability, yet separating out all technological aspects of the scaling from the core solution. That way, you can start with simple, low capacity technologies that won&#8217;t be too expensive. As you grow, upgrade that infrastructure and plug it in to your solution. Arnon&#8217;s recent post on <a href="http://www.rgoarchitects.com/nblog/2007/12/11/WhyArbitraryTiersplittingIsBad.aspx">Tier Splitting</a> touches on a project we worked on together where we designed it in a way that we could scale down to a single process on a single machine and scale out to a server farm, all without changing the core system.</p>
<p>Let me take the design of <a href="http://www.nServiceBus.com">nServiceBus</a> as an example:</p>
<p>One primary property of scalable systems is the explicit treatment of all IO/communication. This can be seen in the one-way messaging exposed by the Bus object. There is no immediately evident way to do synchronous RPC-style request/response. This design decision is taken up front. However, the way that messages are passed around is abstracted behind an ITransport interface. You can deploy the first version of your system on MSMQ, and as load increases, switch to a more performant solution like RV or MQ, just by changing configuration. WCF does this kind of abstraction as well.</p>
<p>Another important element of the scalability of a system is how workflow instances are persisted. This behaviour is also abstracted behind an interface &#8211; IWorkflowPersister. Start out persisting workflows to a database. As you grow, swap that out of a replicated in-memory cache. In any case, the interaction between workflow and messaging at the logical level is set up front. All the pieces of the design are there. Up front. Helping you design your core application in a way that won&#8217;t <strong>limit</strong> your scalability in the future.</p>
<p>This is plain Separation-of-Concerns; code that works with your specific ESB kept out of your business logic.</p>
<p>Design first, scale with technology later.</p>
<p>[Full disclosure: I'm an editor for InfoQ]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/12/12/scalability-you-wish-youre-gonna-need-it/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>In-Order Messaging a Myth?</title>
		<link>http://www.udidahan.com/2007/12/09/in-order-messaging-a-myth/</link>
		<comments>http://www.udidahan.com/2007/12/09/in-order-messaging-a-myth/#comments</comments>
		<pubDate>Sun, 09 Dec 2007 06:00:04 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Workflow]]></category>

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

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/09/07/infoq-interview-on-nservicebus/</guid>
		<description><![CDATA[The good folks from InfoQ interviewed me recently about NServiceBus. You can find the full interview here.
Here are some choice tidbits:
&#8220;For any developer who architects using SOA principles, on the basis for using NServiceBus over some other methodology or some other so-called enterprise service bus:&#8221;

NServiceBus makes it difficult to work in ways that will hurt [...]]]></description>
			<content:encoded><![CDATA[<p>The good folks from <a href="http://www.infoq.com">InfoQ</a> interviewed me recently about <a href="http://www.NServiceBus.com">NServiceBus</a>. You can find the full interview <a href="http://www.infoq.com/news/2007/09/nservicebus">here</a>.</p>
<p>Here are some choice tidbits:</p>
<p>&#8220;For any developer who architects using SOA principles, on the basis for using NServiceBus over some other methodology or some other so-called enterprise service bus:&#8221;</p>
<blockquote><p>
NServiceBus makes it difficult to work in ways that will hurt your scalability. Since the asynchronous messaging patterns are brought to the fore, developers will, by default, avoid the temporal coupling so prevalent in most Web Service implementations. Other methodologies make so many other options just as easy to use that developers can make mistakes that will hurt their scalability and availability and only find out about those mistakes in production . </p>
<p>Another thing NServiceBus does differently is to totally isolate all workflow code from all technologies. This makes it easy to unit-test workflow classes, making it possible to iterate quickly on the development of key business processes. These portable .NET POJOs give developers the flexibility to host their workflows in whatever runtime they want.
</p></blockquote>
<p>&#8220;Having noticed NServiceBus is built with MSMQ in mind or as an option, when asked why this choice of direction: &#8221;</p>
<blockquote><p>
The core of NServiceBus is not dependent on MSMQ. The extensibility points of NServiceBus allow you to plug in your own communication transport, subscription storage, and workflow persister. I&#8217;ve already implemented a transport over MSMQ, and another over WCF&#8217;s NetTCP binding. Developers can use those as-is or write their own. Many of the SOA products currently out there are much more tied to HTTP, so this is something of a break from the common practice. </p>
<p>I chose to use MSMQ since it is one of the two main Microsoft communications technologies that enables parties to communicate in a disconnected fashion (SQL Server Service Broker is the other). MSMQ has a much more accessible API in that it is directly available as a part of the .NET Framework whereas Service Broker currently isn&#8217;t. I consider disconnected communications a critical part of any SOA infrastructure since the Tenet of Service Autonomy does not allow us to assume that the service with which we wish to communicate is currently available.
</p></blockquote>
<p>Is there anything you&#8217;d like to know about NServiceBus? Drop me a comment below.</p>
<p>Thanks.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/09/07/infoq-interview-on-nservicebus/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Generic WCF Transport available for NServiceBus</title>
		<link>http://www.udidahan.com/2007/08/30/generic-wcf-transport-available-for-nservicebus/</link>
		<comments>http://www.udidahan.com/2007/08/30/generic-wcf-transport-available-for-nservicebus/#comments</comments>
		<pubDate>Thu, 30 Aug 2007 23:26:25 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/08/30/generic-wcf-transport-available-for-nservicebus/</guid>
		<description><![CDATA[After trying a bunch of different directions it appears like I&#8217;ve found one that works. I didn&#8217;t think that I could make use of the top ServiceModel stuff, but I was wrong. Many thanks to Tomas Restrepo for making me rethink my basic assumptions.
I&#8217;ve also put in a bit of effort in setting up a [...]]]></description>
			<content:encoded><![CDATA[<p>After trying a bunch of different directions it appears like I&#8217;ve found one that works. I didn&#8217;t think that I could make use of the top ServiceModel stuff, but I was wrong. Many thanks to <a href="http://www.winterdom.com/weblog/">Tomas Restrepo</a> for making me rethink my basic assumptions.</p>
<p>I&#8217;ve also put in a bit of effort in setting up a bunch of configuration files allowing you to try the various transports for the example code. Please go through the Readme as it contains the detailed instructions. There are currently config files setting up non-WCF MSMQ, NetTCP, Basic HTTP, and WS Dual.</p>
<p>If you do go the MSMQ route, the example will run the long-running workflow code. The reason the example code won&#8217;t do that for the WCF cases is that I haven&#8217;t figured out yet the best way for a service to send a message back to itself, especially for the connected bindings. Any thoughts on this would be most appreciated.</p>
<p>Also, I&#8217;m open to hearing what directions you think the next version should go in. I&#8217;m currently thinking about including message transformation. Either that are doing a Multicast bus over a UDP transport.</p>
<p>This is a non-backwards-compatible update. In order to propertly integrate with the WCF philosophy I had to change the ITransport interface for Unicast transports. The meaning of this change is that transports are now expected to do their own threading and transaction management, while the bus object now joins the context that comes from the transport.</p>
<p><a href='http://udidahan.weblogs.us/wp-content/uploads/nservicebus-v10.zip'>Download here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/08/30/generic-wcf-transport-available-for-nservicebus/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>NServiceBus Distributed Topology Q&amp;A</title>
		<link>http://www.udidahan.com/2007/08/25/nservicebus-distributed-topology-qa/</link>
		<comments>http://www.udidahan.com/2007/08/25/nservicebus-distributed-topology-qa/#comments</comments>
		<pubDate>Sat, 25 Aug 2007 08:37:26 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[Dependency Injection]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[Workflow]]></category>

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

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

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/08/25/why-i-wrote-nservicebus/</guid>
		<description><![CDATA[I&#8217;ve been asked if I have a document describing the architecture of NServiceBus, so since I don&#8217;t have one yet, this post will be the start.
First of all, there were two major forces that drove me to write NServiceBus. First of all I wanted to formalize the way Service Layer classes were written when using [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been asked if I have a document describing the architecture of NServiceBus, so since I don&#8217;t have one yet, this post will be the start.</p>
<p>First of all, there were two major forces that drove me to write NServiceBus. First of all I wanted to formalize the way Service Layer classes were written when using asynchronous messaging (regardless of Web Services). And second I wanted to formalize a communications API which supported pub/sub so that I could freely move between transports – whether they inherently supported pub/sub or not (the fact that Indigo did not falls under this).</p>
<p>From there it was filling in the details. Until finally I made the step to formalize the way long-running workflow connects to asynchronous messaging. That’s the third pillar as far as I’m concerned about ESBs. Using MSMQ I do enable Shared Subscriptions like Sonic does.</p>
<p>I try to stay away from the vendor side of ESB definitions and just deal with what capabilities such a library should provide. As such, it is inherently distributed – running on each server/client.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/08/25/why-i-wrote-nservicebus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NBus now supporting long running workflow</title>
		<link>http://www.udidahan.com/2007/07/12/nbus-now-supporting-long-running-workflow/</link>
		<comments>http://www.udidahan.com/2007/07/12/nbus-now-supporting-long-running-workflow/#comments</comments>
		<pubDate>Thu, 12 Jul 2007 23:05:10 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/07/12/nbus-now-supporting-long-running-workflow/</guid>
		<description><![CDATA[This is a backwards-compatible update to the last drop of my messaging infrastructure &#8211; NBus. For more information on what it&#8217;s about read what such an infrastructure should do.
This update includes support for long-running workflows and includes persistent timer functionality. Workflow persistence is abstracted behind an IWorkflowPersister. The current drop includes an in-memory persister, but [...]]]></description>
			<content:encoded><![CDATA[<p>This is a backwards-compatible update to <a href="http://udidahan.weblogs.us/2007/07/07/download-vnext-of-the-messaging-infrastructure/">the last drop of my messaging infrastructure &#8211; NBus</a>. For more information on what it&#8217;s about read <a href="http://udidahan.weblogs.us/2007/04/22/basic-messaging-infrastructure/">what such an infrastructure should do</a>.</p>
<p>This update includes support for long-running workflows and includes persistent timer functionality. Workflow persistence is abstracted behind an IWorkflowPersister. The current drop includes an in-memory persister, but you could easily implement it over a database, or a <a href="http://udidahan.weblogs.us/2007/05/05/using-spaces-with-web-services/">distributed in-memory datagrid / space</a>.</p>
<p>Other important details. To have a message kick off a workflow, just put the StartsWorkflow attribute on it. To define a message type as being involved in workflows, have it implement IWorkflowMessage instead of just IMessage. If you do these two things, the infrastructure will be able to generically dispatch messages to your workflow; you will not have to write any message handlers for your workflow, just the workflow class itself. This is done by implementing IWorkflow&lt;T&gt; for every message type received.</p>
<p>Persistent timers are activated from within your workflow like so:</p>
<p>this.reminder.ExpireIn(TimeSpan.FromSeconds(5), this, state);</p>
<p>As always, dependency injection is used &#8211; via my simple ObjectBuilder. The implementation provided delegates to Spring, but, once again, that can be easily substituted with whatever you want.</p>
<p><a href="http://udidahan.weblogs.us/wp-content/uploads/nbus_with_workflow.zip" title="nbus_with_workflow.zip">Download (509 KB)</a> (sometimes problematic with IE, try FireFox before emailing me).</p>
<p>Finally, I&#8217;m leaning towards changing the name to NServiceBus. Anyone against, please leave a comment. Questions and comments are more than welcome.</p>
<p>Next step: implementing a WCF transport.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/07/12/nbus-now-supporting-long-running-workflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Download vNext of the messaging infrastructure</title>
		<link>http://www.udidahan.com/2007/07/07/download-vnext-of-the-messaging-infrastructure/</link>
		<comments>http://www.udidahan.com/2007/07/07/download-vnext-of-the-messaging-infrastructure/#comments</comments>
		<pubDate>Sat, 07 Jul 2007 21:54:54 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/07/07/download-vnext-of-the-messaging-infrastructure/</guid>
		<description><![CDATA[This is an update of my basic messaging infrastructure library. Here are the big things that have changed:

You get all the source code. Everything.
Extensible enough to work entirely without MSMQ.

Download (sometimes problematic with IE, try FireFox before emailing me).
Next steps:

Creating a WCF transport implementation and host
Persistent timers to support long-running workflows
Turn into a full-blown open [...]]]></description>
			<content:encoded><![CDATA[<p>This is an update of my <a href="http://udidahan.weblogs.us/2007/04/22/basic-messaging-infrastructure/">basic messaging infrastructure library</a>. Here are the big things that have changed:</p>
<ul>
<li>You get all the source code. Everything.</li>
<li>Extensible enough to work entirely without MSMQ.</li>
</ul>
<p><a href="http://udidahan.weblogs.us/wp-content/uploads/nbus_download.zip">Download</a> (sometimes problematic with IE, try FireFox before emailing me).</p>
<p>Next steps:</p>
<ul>
<li>Creating a WCF transport implementation and host</li>
<li>Persistent timers to support long-running workflows</li>
<li>Turn into a full-blown open source project</li>
</ul>
<p>And to wrap it up, a question to those who plan to use it:</p>
<p>NBus.com is taken. I&#8217;m thinking of changing the project name to something that has an available domain. Vote for what you want in the comments. Feel free to suggest whatever you want, but here are some ideas:</p>
<ul>
<li>NMessageBus</li>
<li>NServiceBus</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/07/07/download-vnext-of-the-messaging-infrastructure/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Coming soon: MSMQ Bus without the MSMQ</title>
		<link>http://www.udidahan.com/2007/06/14/coming-soon-msmq-bus-without-the-msmq/</link>
		<comments>http://www.udidahan.com/2007/06/14/coming-soon-msmq-bus-without-the-msmq/#comments</comments>
		<pubDate>Thu, 14 Jun 2007 12:44:32 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/06/14/coming-soon-msmq-bus-without-the-msmq/</guid>
		<description><![CDATA[I&#8217;m getting close to finally disconnecting all the code from my ESB implementation from MSMQ specifics.
You get this simple yet rich API:

    public interface IBus : IDisposable
    {
        void Start();
        void Publish(IMessage message);
   [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m getting close to finally disconnecting all the code from <a href="http://udidahan.weblogs.us/2007/04/22/basic-messaging-infrastructure/">my ESB implementation</a> from <a href="/category/msmq/">MSMQ</a> specifics.</p>
<p>You get this simple yet rich API:</p>
<div style="border: solid black 1px; padding: 0em 1em; background-color:beige; font-family:courier; ">
    public interface IBus : IDisposable<br />
    {<br />
        void Start();</p>
<p>        void Publish(IMessage message);<br />
        void Publish(params IMessage[] messages);</p>
<p>        void Subscribe(Type messageType);<br />
        void Subscribe(Type messageType, Predicate<IMessage> condition);<br />
        void Unsubscribe(Type messageType);</p>
<p>        void Send(IMessage message);<br />
        void Send(params IMessage[] messages);<br />
        void Send(IMessage message, string destination);<br />
        void Send(IMessage[] messages, string destination);<br />
        void Send(IMessage message, CompletionCallback callback, object state);<br />
        void Send(IMessage[] messages, CompletionCallback callback, object state);<br />
        void Send(IMessage message, string destination, CompletionCallback callback, object state);<br />
        void Send(IMessage[] messages, string destination, CompletionCallback callback, object state);</p>
<p>        void Reply(IMessage message);<br />
        void Reply(params IMessage[] messages);</p>
<p>        void Return(int errorCode);</p>
<p>        string SourceOfMessageBeingHandled { get; }<br />
    }
</p></div>
<p>Currently, I have only MSMQ implementations for the transport of messages, the storage of subscription information, and for an error queue. This coming release will make it possible for you to customize each implementation. The release after that will be focusing on WCF implementations.</p>
<p>I&#8217;m also going to start releasing some more structured guidance on working with this infrastructure &#8211; getting started, configuration, etc. If I can this anywhere near what <a href="http://codebetter.com/blogs/jeremy.miller/">Jeremy</a> has done with StructureMap or his MVP series, that would be an enormous achievement.</p>
<p>Also, now would be a great time to start telling me about additional things you&#8217;d like to see in the API, or other transports you&#8217;d like to see supported.</p>
<p>This is going to be a huge effort so any support that you can offer would be more than welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/06/14/coming-soon-msmq-bus-without-the-msmq/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Basic Messaging Infrastructure</title>
		<link>http://www.udidahan.com/2007/04/22/basic-messaging-infrastructure/</link>
		<comments>http://www.udidahan.com/2007/04/22/basic-messaging-infrastructure/#comments</comments>
		<pubDate>Sun, 22 Apr 2007 21:39:01 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/04/22/basic-messaging-infrastructure/</guid>
		<description><![CDATA[Download here.
Check out the ongoing discussion around the bus as well.
This implementation makes use of MSMQ so make sure you read the &#8220;readme.txt&#8221; for information on how to install it and what queues you need to define.
In order to have the &#8220;client&#8221; process send the &#8220;server&#8221; process a message, just press &#8216;Enter&#8217; in its console.
Try [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://udidahan.weblogs.us/wp-content/uploads/basicmessaginginfrastructure.zip">Download here</a>.</p>
<p>Check out the <a href="http://udidahan.weblogs.us/2006/06/02/can-indigo-be-my-bus/">ongoing discussion around the bus</a> as well.</p>
<p>This implementation makes use of <a href="http://udidahan.weblogs.us/category/msmq/">MSMQ</a> so make sure you read the &#8220;readme.txt&#8221; for information on how to install it and what queues you need to define.</p>
<p>In order to have the &#8220;client&#8221; process send the &#8220;server&#8221; process a message, just press &#8216;Enter&#8217; in its console.</p>
<p>Try to ignore the use of callbacks and subscriptions at first so you can hone in on the basic messaging semantics.</p>
<p>Questions and comments are more than welcome. Please send them to:</p>
<p><a href="mailto:Messaging@UdiDahan.com">Messaging@UdiDahan.com</a>.</p>
<p>Also, if you&#8217;re in the giving spirit and feel like donating something back, please <a href="/donate/">do so</a>. It will make it that much easier for me to continue supporting your use of this code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/04/22/basic-messaging-infrastructure/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>It’s poison, I tell you. Poison!</title>
		<link>http://www.udidahan.com/2007/02/15/it%e2%80%99s-poison-i-tell-you-poison/</link>
		<comments>http://www.udidahan.com/2007/02/15/it%e2%80%99s-poison-i-tell-you-poison/#comments</comments>
		<pubDate>Thu, 15 Feb 2007 19:57:05 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[Simplicity]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/379</guid>
		<description><![CDATA[When developing systems that handle messages that arrive on queues or other asynchronous transport mechanisms, broader failure scenarios need can be handled than in RPC-style communications. One of these failure scenarios that’s been getting some recent play on the blogosphere is that of poison messages. Microsoft’s Nicholas Allen does a great job describing what defines [...]]]></description>
			<content:encoded><![CDATA[<p><span lang="EN-US"><font face="Calibri" size="3">When developing systems that handle messages that arrive on queues or other asynchronous transport mechanisms, broader failure scenarios need can be handled than in RPC-style communications. One of these failure scenarios that’s been getting some recent play on the blogosphere is that of poison messages. Microsoft’s Nicholas Allen does </font><a href="http://blogs.msdn.com/drnick/archive/2007/02/12/msmq-and-poison-messages.aspx"><font face="Calibri" size="3">a great job</font></a><font face="Calibri" size="3"> describing what defines a poison message and the common ways of handling it. Thomas Restrepo adds another facet to the whole issue of poison message handling that is a </font><a href="http://www.winterdom.com/weblog/2007/02/12/PoisonMessagesAndOrderedProcessing.aspx"><font face="Calibri" size="3">must-read</font></a><font size="3"><font face="Calibri">.</font></font></span></p>
<p><span lang="EN-US"><font size="3"><font face="Calibri">Let’s take a rather simple case, but definitely a common one when we start versioning our services – that of the receipt of a malformed message. It could be that we were unable to deserialize the data or something more complicated, but at the most basic level, there’s nothing the service can do with the message. This is often expressed in terms of some sort of exception that reaches all the way down to the messaging infrastructure. If we were using the queue in a transaction, we’d see a rollback and the message return to the queue, causing the service to loop endlessly on that message. This sort of failure case is best handled by having the messaging infrastructure just move the message to an error queue.</font></font></span></p>
<p><span lang="EN-US" /><span lang="EN-US"><font face="Calibri" size="3">Other kinds of failure conditions include having our DB transactions fail because they were chosen as the victim of a deadlock. Matts does </font><a href="http://www.matshelander.com/wordpress/?p=34"><font face="Calibri" size="3">a good job</font></a><font size="3"><font face="Calibri"> of describing why these things occur and how to handle and minimize their occurrence. The appropriate system level error handling is to just retry the transaction a bit later. Once again, if we were using our queues within the context of a transaction scope that included that of the database, the message would return to the queue when that deadlock exception bubbled through. This is exactly the behavior that we want in this case, although having the message go to the end of the queue instead of the front would also be just fine.</font></font></span></p>
<p><span lang="EN-US"><font size="3"><font face="Calibri">Other kinds of failure conditions we might run into include things like unique-constraint violations, attempting to perform actions on entities that no longer exist, and other activities where trying them over again probably won’t yield any different behavior. In these cases, if an exception were to cause the perpetrating message to return to the input queue we’d get exactly the wrong behavior. At the very least we would want to maybe log the exception information, but putting the message in the error queue doesn’t seem right. I mean, there was nothing wrong with the message, it’s just that the application state had moved on or that some other logic failed. One of the reasons for putting the message in the error queue is so that a person can manually fix what’s wrong with the message and send it back to the input queue for reprocessing. In these failure conditions, that hardly seems likely.</font></font></span></p>
<p><span lang="EN-US"><font size="3"><font face="Calibri">What I usually suggest for handling failures when messaging is involved goes something like this. First of all, <em>have</em> an error queue/topic – they’re exceedingly useful. Second, don’t automatically roll messages back. If the service wants to retry, they should do so after handling all the other messages already in the queue – unless (!) you’ve got message ordering issues like Thomas mentioned. This means having the service request the messaging infrastructure send the message back to itself. When it comes to exceptions around the logic handling the message, just write them to a log and be done with it. The service logic will probably log anything else that’s of particular interest to it. This leaves us with the malformed message scenario. In that case, the communications layer can know that the problem occurred before any service logic (like deserialization exceptions) and therefore can (rightly) pass the message along to the error queue.</font></font></span></p>
<p><span lang="EN-US"><font size="3"><font face="Calibri">Of course, for the above guidance to be valid, we need to educate service logic developers as to when it is appropriate for them to throw exceptions and when they actually have to send the message back themselves. It is often the case that by taking on certain constraints, we can greatly simplify the handling of scenarios which are difficult in the general case.<br />
</font></font></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/02/15/it%e2%80%99s-poison-i-tell-you-poison/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Queues, Scalability, &amp; Availability</title>
		<link>http://www.udidahan.com/2007/02/02/queues-scalability-availability/</link>
		<comments>http://www.udidahan.com/2007/02/02/queues-scalability-availability/#comments</comments>
		<pubDate>Sat, 03 Feb 2007 00:08:02 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Availability]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[Scalability]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/371</guid>
		<description><![CDATA[Dr. Nick has a great post up on scalability, queues, and WCF. For some reason, everybody&#8217;s always talking about scalability, but availability gets much less play. For many systems, availability is actually the more important *ility.
Anyway, when it comes to scaling out queues help a lot. Although not explicitly mentioned in the above post, having [...]]]></description>
			<content:encoded><![CDATA[<p>Dr. Nick has <a href="http://blogs.msdn.com/drnick/archive/2007/01/30/queue-scalability.aspx">a great post</a> up on scalability, queues, and WCF. For some reason, everybody&#8217;s always talking about scalability, but availability gets much less play. For many systems, availability is actually the more important *ility.</p>
<p>Anyway, when it comes to scaling out queues help a lot. Although not explicitly mentioned in the above post, having multiple machines feeding off of the same queue is the key to scalability and is known as the Competing Consumer pattern. The added benefit of such a design is that you get availability without any additional work, given that you have more than one consuming machine per queue.</p>
<p>One thing to keep in mind about the Microsoft platform today is that MSMQ does not currently support remote, transactional receives (<b>Update</b> MSMQ 4 released as a part of Vista / Server 2008 now supports this, yet people in the know have told me to avoid this feature). What this means is that, in the above design, you cannot make sure that if one of the servers fails while processing a message from the queue, that that message will return to the queue. For some kinds of messages this isn&#8217;t a big deal (like stock prices), but in other cases (like money transfers) this isn&#8217;t acceptable.</p>
<p>So, bottom line is that queues and other asynchronous transports (JMSs and topics) enable robust systems to be built using proven patterns, but be aware of any limitations of the technology and what ramifications they may have.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/02/02/queues-scalability-availability/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>[Podcast] ESB &amp; MSMQ, Services as the interface to business processes, and BPM &amp; OOA</title>
		<link>http://www.udidahan.com/2006/10/24/podcast-esb-msmq-services-as-the-interface-to-business-processes-and-bpm-ooa/</link>
		<comments>http://www.udidahan.com/2006/10/24/podcast-esb-msmq-services-as-the-interface-to-business-processes-and-bpm-ooa/#comments</comments>
		<pubDate>Wed, 25 Oct 2006 04:55:55 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Ask Udi Podcast]]></category>
		<category><![CDATA[BPM]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>

		<guid isPermaLink="false">http://wp_630.weblogs.us/archives/340</guid>
		<description><![CDATA[<a href="http://www.ddj.com/dept/architect/193303495">Get it here.</a>
<br/><br/>
Udi answers questions about implementing ESB capabilities on top of Microsoft's message queuing technology MSMQ, as well as dispels some myths around viewing services as the interface to business processes. Finally, he ties it all up with a critique on using object oriented analysis for BPM.
<br/><br/>
Resources 
<br/><br/>
1. Article on <a href="http://www.intelligententerprise.com/showArticle.jhtml?articleID=193104592">Microsoft's solution for ESBs</a><br/>
2. <a href="http://blogs.msdn.com/rjacobs/archive/2006/10/05/Patterns-and-Anti_2D00_Patterns-for-SOA.aspx">Patterns &#038; Anti-Patterns for SOA webcast</a><br/>
2. <a href="mailto:podcast@UdiDahan.com">Ask Udi a question on SOA</a><br/>
3. <a href="http://syndication.sdmediagroup.com/feeds/public/cmp_podcast_udi.xml">Subscribe to the Ask Udi podcast</a>
<br/><br/>
Enjoy.]]></description>
			<content:encoded><![CDATA[<p>Udi answers questions about implementing ESB capabilities on top of Microsoft&#8217;s message queuing technology MSMQ, as well as dispels some myths around viewing services as the interface to business processes. Finally, he ties it all up with a critique on using object oriented analysis for BPM.</p>
<p><u>Resources </u></p>
<p>1. Article on <a href="http://www.intelligententerprise.com/showArticle.jhtml?articleID=193104592">Microsoft&#8217;s solution for ESBs</a><br />
2. <a href="http://blogs.msdn.com/rjacobs/archive/2006/10/05/Patterns-and-Anti_2D00_Patterns-for-SOA.aspx">Patterns &amp; Anti-Patterns for SOA webcast</a><br />
2. <a href="mailto:podcast@UdiDahan.com">Ask Udi a question on SOA</a><br />
3. <a href="http://syndication.sdmediagroup.com/feeds/public/cmp_podcast_udi.xml">Subscribe to the Ask Udi podcast</a></p>
<p>Get it via the Dr. Dobb&#8217;s site <a href="http://www.ddj.com/dept/architect/193303495">here.</a></p>
<p>Or download directly <a href="http://www.dobbsprojects.com/media/newengine/dynamp.php/061017ud01.mp3?site=sdmg&#038;affiliate=ddj&#038;target=%2Fdept%2Fwebservices%2F&#038;title=ESB+and+MSMQ+Service&#038;artist=Ask+Udi+Podcast&#038;album=Dr.+Dobb%27s+Portal&#038;year=2006&#038;podcast=061017ud01.mp3">here</a>.</p>
<p>Want more? Go to the <a href="/ask-udi/">&#8220;Ask Udi&#8221; archives</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2006/10/24/podcast-esb-msmq-services-as-the-interface-to-business-processes-and-bpm-ooa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.dobbsprojects.com/media/newengine/dynamp.php/061017ud01.mp3?site=sdmg&amp;affiliate=ddj&amp;target=%2Fdept%2Fwebservices%2F&amp;title=ESB+and+MSMQ+Service&amp;artist=Ask+Udi+Podcast&amp;album=Dr.+Dobb%27s+Portal&amp;year=2006&amp;podcast=061017ud01.mp3" length="7403621" type="audio/mp3" />
		</item>
		<item>
		<title>MSMQ scale out question</title>
		<link>http://www.udidahan.com/2006/09/15/msmq-scale-out-question/</link>
		<comments>http://www.udidahan.com/2006/09/15/msmq-scale-out-question/#comments</comments>
		<pubDate>Sat, 16 Sep 2006 05:26:38 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[Scalability]]></category>

		<guid isPermaLink="false">http://wp_630.weblogs.us/archives/317</guid>
		<description><![CDATA[It appears that the questions are getting more concrete around my <a href="http://www.architecturejournal.net/2006/issue8/F3_Autonomous">Autonomous Services article</a>. This one comes from Eric who asks:
<br/><br/>
<em>"Udi,
 <br/><br/>
Your article caught my attention because we are currently trying to figure out the "infrastructure implementation" piece of the puzzle in an MSMQ cluster scenario.  I didn't understand the term "remote transactional reads"; can you describe it as it relates to this architecture?  
 <br/><br/>
The problem we've encountered is how do we make it easy for our ops team to just add/remove servers from the cluster, and have the load redistribute itself properly.  MSMQ tied to virtual IPs by itself doesn't seem smart enough.  We're toying with both HW load balancing, and/or some NLB/MOM/AppCenter interactions (with programming layers to make it work.)"</em>
<br/><br/>
Eric, the current version of MSMQ lacks the remote transactional receive capability - meaning that if your "application" is trying to perform a "Receive" operation on a queue that is located on a remote machine in a transactional context, it will not work. The next version of MSMQ is supposed to "fix" this.
<br/><br/>
Why would you want such a feature? Well, if you put a single queue on a clustered server (for availability) and had many other servers using that queue as their input queue, you'd have the ability to add servers at runtime to handle increases in load. However, since the handling of a message from a queue often requires a transaction, the current version of MSMQ won't support this out of the box.
<br/><br/>
What you could do is have some sort of dispatcher application that would send messages to the other servers. When a server would be ready to receive a message (not under heavy load), it could send the dispatcher a message saying just that. The dispatcher would store the return address (ResponseQueue) so that when a message would arrive, it could send that message to the server.
<br/><br/>
This scenario would have each server have its own input queue and be aware of the dispatcher. The dispatcher would not have to know about the other servers directly - it would just store the return addresses of the messages it receives. The result of this behavior would cause the messages to be sent transactionally to only one server, which would, in turn, transactionally receive the message from its local queue and process it.
<br/><br/>
I hope that answers your question Eric. If you'd like more information, feel free to follow up.]]></description>
			<content:encoded><![CDATA[<p>It appears that the questions are getting more concrete around my <a href="http://www.architecturejournal.net/2006/issue8/F3_Autonomous">Autonomous Services article</a>. This one comes from Eric who asks:</p>
<p><em>&#8220;Udi,</p>
<p>Your article caught my attention because we are currently trying to figure out the &#8220;infrastructure implementation&#8221; piece of the puzzle in an MSMQ cluster scenario.  I didn&#8217;t understand the term &#8220;remote transactional reads&#8221;; can you describe it as it relates to this architecture?  </p>
<p>The problem we&#8217;ve encountered is how do we make it easy for our ops team to just add/remove servers from the cluster, and have the load redistribute itself properly.  MSMQ tied to virtual IPs by itself doesn&#8217;t seem smart enough.  We&#8217;re toying with both HW load balancing, and/or some NLB/MOM/AppCenter interactions (with programming layers to make it work.)&#8221;</em></p>
<p>Eric, the current version of MSMQ lacks the remote transactional receive capability &#8211; meaning that if your &#8220;application&#8221; is trying to perform a &#8220;Receive&#8221; operation on a queue that is located on a remote machine in a transactional context, it will not work. The next version of MSMQ is supposed to &#8220;fix&#8221; this.</p>
<p>Why would you want such a feature? Well, if you put a single queue on a clustered server (for availability) and had many other servers using that queue as their input queue, you&#8217;d have the ability to add servers at runtime to handle increases in load. However, since the handling of a message from a queue often requires a transaction, the current version of MSMQ won&#8217;t support this out of the box.</p>
<p>What you could do is have some sort of dispatcher application that would send messages to the other servers. When a server would be ready to receive a message (not under heavy load), it could send the dispatcher a message saying just that. The dispatcher would store the return address (ResponseQueue) so that when a message would arrive, it could send that message to the server.</p>
<p>This scenario would have each server have its own input queue and be aware of the dispatcher. The dispatcher would not have to know about the other servers directly &#8211; it would just store the return addresses of the messages it receives. The result of this behavior would cause the messages to be sent transactionally to only one server, which would, in turn, transactionally receive the message from its local queue and process it.</p>
<p>I hope that answers your question Eric. If you&#8217;d like more information, feel free to follow up.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2006/09/15/msmq-scale-out-question/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Can Indigo be my bus?</title>
		<link>http://www.udidahan.com/2006/06/02/can-indigo-be-my-bus/</link>
		<comments>http://www.udidahan.com/2006/06/02/can-indigo-be-my-bus/#comments</comments>
		<pubDate>Fri, 02 Jun 2006 17:13:58 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Scalability]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://wp_630.weblogs.us/archives/288</guid>
		<description><![CDATA[You'd think that with Indigo/WCF/WinCom out now, people like me who develop distributed systems would be overjoyed. Finally, a single technology stack to deal with, right?
<br/><br/>
Well, maybe if the API wasn't so cumbersome. 
<br/><br/>
I know that Indigo tries to be almost everything to all people through its pervasive extensibility model, but I'd really like to have my (rather simple) needs handled well, without having to special case a lot of the low-level mechanisms.
<br/><br/>
The thing is, I've already found a much better API. The reason its turned out so simple is the result of accepting a certain way of working - the SOA way. Once you give up the desire to tightly couple, the fog clears. You start to see the following simple elements combining in well defined ways...
<br/><br/>
The only data that goes between services are messages. In other words, any class that implements the IMessage marker interface. If you want XML or SOAP serialization, that class should probably be serializable.
<br/><br/>
The thing you use to send message implements the IBus interface. IBus exposes the following methods:
<br/><br/>
void Send(IMessage message);<br/>
void Send(IMessage message, CompletionCallback callback, object cookie);<br/>
void Reply(IMessage message);<br/>
void Reply(IMessage message, int errorCode);<br/>
<br/>
void Start();<br/>
<br/>
void LoadTypesFromAssembly(Assembly a);<br/>
<br/>
** void CompletionCallback(int errorCode, object cookie);<br/>
<br/>
There is one more interface to mention, and that is IMessageHandler<T> where T : IMessage. It has a single method - void Handle(T message);
<br/><br/>
Before we get too mired down in the details, you'll probably notice that the "Send" methods don't take a destination parameter. That's because there's no way in hell that application code can/should know where a message should go. Here's the reasoning:
<br/><br/>
A message schema, a group of classes that implement IMessage, aren't just available. An autonomous service "published" that schema, in essence saying "this is how you speak to me". The corrollary of that statement is that an instance of one of those classes should always be sent to an endpoint of that autonomous service. The implementation of the bus, probably with a config file, will know which endpoints are for which message type.
<br/><br/>
Another thing you'll probably notice is that there's no "Receive" method. What happens is this:
<br/><br/>
Since the bus implementation will deal with the underlying technology, it will know when a message has arrived. It now needs to inform the application of this. While it could expose a MessageReceived event, what we'd really like it to do is to dispatch that message to the appropriate message handler. The bus could easily reflect on the generic type parameter of the message handler in order to build a map from message types to message handler types.
<br/><br/>
When we start to think about message handlers, they really are one shot deals. There's no reason to keep them in memory when they're not handling messages. So, the bus would do per-message instantiation. Since the communication is based on asynchronous messages, there really is no meaning to the term "session". Even more importantly, with multiple threads handling multiple messages, we definitely don't want to weigh down on MessageHandler developers by demanding them to write thread-safe code.
<br/><br/>
And about the messages - there really isn't any need to decorate their fields with attributes or anything, is there? All the data is passed, always.
<br/><br/>
The "Reply" method is there so that a message handler, as a part of its logic, can send a message back to the client that sent it the request. Alternatively, it could just "Send" one of its own messages (like CustomersUpdatedMessage) to all clients subscribed.
<br/><br/>
How would we know that a client subscribed? Simple - it has a message handler for a message defined as belonging to someone else (the autonomous service). The client bus could then send its own specific subscription messages to the bus running on the service, which would then save that subscription.
<br/><br/>
I could go on, but I think that you can see that Indigo wasn't designed to make this kind of scenario easy. Of course it's possible to implement this on top of, and inside of Indigo, but, to put it mildly, its a bitch. The hard part is getting rid of the need to use all those ugly attributes.
<br/><br/>
The real thing that gets under my skin is having to explain to technical business types why we aren't using Indigo either as an API or implementation. It's just too much complexity! Look at all the examples out there on the blogosphere, did you see how much techno-crap you have to write to get something working. And the resulting application level code is mired in technologically specific details. Yuck. I barely have enough time to develop the system itself without wasting any on debugging infrastructure code just to find out I forgot yet another attribute (YAA). How's that for a replacement for WCF?
<br/><br/>
Just to fill in the description of the API, the LoadTypesFromAssembly method scans a given assembly and loads and maps all the types that implement IMessage and IMessageHandler<T>. The Start method tells the bus to start listening for messages - in essence spawning the appropriate number of worker threads. For client side buses, you probably only need a single worker thread. Service buses will probably have more.
<br/><br/>
The Send method that accepts the callback and cookie is used so that when the bus receives a response message (possibly identified by a correlationId field, but that's an implementation detail), it would activate the callback passed before. The cookie is there so that the initiator can differentiate between different messages that it sent. For instance, if we had two CustomerDetailsForms open, and from each we initiated an update, when we get two responses back, we need to know which response goes with which form. If we were to pass the form object in as a cookie, which we'd get back in the callback, that would be just dandy. The errorCode passed in the reply would also be passed to the callback.
<br/><br/>
This asynchronous request/response pattern, combined with pub/sub - event-based communication is at the heart of loosely coupled systems. The API I described does a fine job of enabling it in a technology neutral fashion. Indigo does a much poorer job, in my opinion.
<br/><br/>
So, I'm afraid that I'll have to keep using my MSMQ implementation - it seems that Indigo never really wanted to be a bus anyway. Although it does a fine job of uniting the technology stacks that were previously out there, WCF/YAA appears to have a long way to go.
<br/><br/>
BTW, my <a href="http://www.ddj.com/188700967">podcast on ESBs </a>is up on Dr. Dobbs now.]]></description>
			<content:encoded><![CDATA[<p><b>Updates:</b><br/></p>
<p><a href="http://udidahan.weblogs.us/2007/04/22/basic-messaging-infrastructure/">Download the MSMQ implementation.</a></p>
<p><a href="http://udidahan.weblogs.us/2007/04/01/service-layer-separation-of-concerns/">Service-Layer Separation of Concerns</a> achieved by using Bus API.</p>
<p>How the Bus API handles <a href="http://udidahan.weblogs.us/2007/03/31/tasks-messages-transactions-%e2%80%93-the-holy-trinity/">the connection between messages and transactions</a></p>
<p><a href="http://udidahan.weblogs.us/2007/02/18/requestservice-state-affinity-%e2%80%93-don%e2%80%99t/">How information from one request can be used elsewhere</a></p>
<hr size="1">
<p>You&#8217;d think that with Indigo/WCF/WinCom out now, people like me who develop distributed systems would be overjoyed. Finally, a single technology stack to deal with, right?</p>
<p>Well, maybe if the API wasn&#8217;t so cumbersome. </p>
<p>I know that Indigo tries to be almost everything to all people through its pervasive extensibility model, but I&#8217;d really like to have my (rather simple) needs handled well, without having to special case a lot of the low-level mechanisms.</p>
<p>The thing is, I&#8217;ve already found a much better API. The reason its turned out so simple is the result of accepting a certain way of working &#8211; the SOA way. Once you give up the desire to tightly couple, the fog clears. You start to see the following simple elements combining in well defined ways&#8230;</p>
<p>The only data that goes between services are messages. In other words, any class that implements the IMessage marker interface. If you want XML or SOAP serialization, that class should probably be serializable.</p>
<p>The thing you use to send message implements the IBus interface. IBus exposes the following methods:</p>
<p>void Send(IMessage message);<br />
void Send(IMessage message, CompletionCallback callback, object cookie);<br />
void Reply(IMessage message);<br />
void Reply(IMessage message, int errorCode);</p>
<p>void Start();</p>
<p>void LoadTypesFromAssembly(Assembly a);</p>
<p>** void CompletionCallback(int errorCode, object cookie);</p>
<p>There is one more interface to mention, and that is IMessageHandler where T : IMessage. It has a single method &#8211; void Handle(T message);</p>
<p>Before we get too mired down in the details, you&#8217;ll probably notice that the &#8220;Send&#8221; methods don&#8217;t take a destination parameter. That&#8217;s because there&#8217;s no way in hell that application code can/should know where a message should go. Here&#8217;s the reasoning:</p>
<p>A message schema, a group of classes that implement IMessage, aren&#8217;t just available. An autonomous service &#8220;published&#8221; that schema, in essence saying &#8220;this is how you speak to me&#8221;. The corrollary of that statement is that an instance of one of those classes should always be sent to an endpoint of that autonomous service. The implementation of the bus, probably with a config file, will know which endpoints are for which message type.</p>
<p>Another thing you&#8217;ll probably notice is that there&#8217;s no &#8220;Receive&#8221; method. What happens is this:</p>
<p>Since the bus implementation will deal with the underlying technology, it will know when a message has arrived. It now needs to inform the application of this. While it could expose a MessageReceived event, what we&#8217;d really like it to do is to dispatch that message to the appropriate message handler. The bus could easily reflect on the generic type parameter of the message handler in order to build a map from message types to message handler types.</p>
<p>When we start to think about message handlers, they really are one shot deals. There&#8217;s no reason to keep them in memory when they&#8217;re not handling messages. So, the bus would do per-message instantiation. Since the communication is based one asynchronous messages, there really is no meaning to the term &#8220;session&#8221;.</p>
<p>And about the messages &#8211; there really isn&#8217;t any need to decorate their fields with attributes or anything, is there? All the data is passed, always.</p>
<p>The &#8220;Reply&#8221; method is there so that a message handler, as a part of its logic, can send a message back to the client that sent it the request. Alternatively, it could just &#8220;Send&#8221; one of its own messages (like CustomersUpdatedMessage) to all clients subscribed.</p>
<p>How would we know that a client subscribed? Simple &#8211; it has a message handler for a message defined as belonging to someone else (the autonomous service). The client bus could then send its own specific subscription messages to the bus running on the service, which would then save that subscription.</p>
<p>I could go on, but I think that you can see that Indigo wasn&#8217;t designed to make this kind of scenario easy. Of course it&#8217;s possible to implement this on top of, and inside of Indigo, but, to put it mildly, its a bitch. The hard part is getting rid of the need to use all those ugly attributes.</p>
<p>The real thing that gets under my skin is having to explain to technical business types why we aren&#8217;t using Indigo either as an API or implementation. It&#8217;s just too much complexity! Look at all the examples out there on the blogosphere, did you see how much techno-crap you have to write to get something working. And the resulting application level code is mired in technologically specific details. Yuck. I barely have enough time to develop the system itself without wasting any on debugging infrastructure code just to find out I forgot yet another attribute (YAA). How&#8217;s that for a replacement for WCF?</p>
<p>Just to fill in the description of the API, the LoadTypesFromAssembly method scans a given assembly and loads and maps all the types that implement IMessage and IMessageHandler. The Start method tells the bus to start listening for messages &#8211; in essence spawning the appropriate number of worker threads. For client side buses, you probably only need a single worker thread. Service buses will probably have more.</p>
<p>The Send method that accepts the callback and cookie is used so that when the bus receives a response message (possibly identified by a correlationId field, but that&#8217;s an implementation detail), it would activate the callback passed before. The cookie is there so that the initiator can differentiate between different messages that it sent. For instance, if we had two CustomerDetailsForms open, and from each we initiated an update, when we get two responses back, we need to know which response goes with which form. If we were to pass the form object in as a cookie, which we&#8217;d get back in the callback, that would be just dandy. The errorCode passed in the reply would also be passed to the callback.</p>
<p>This asynchronous request/response pattern, combined with pub/sub &#8211; event-based communication is at the heart of loosely coupled systems. The API I described does a fine job of enabling it in a technology neutral fashion. Indigo does a much poorer job, in my opinion.</p>
<p>So, I&#8217;m afraid that I&#8217;ll have to keep using my MSMQ implementation &#8211; it seems that Indigo never really wanted to be a bus anyway. Although it does a fine job of uniting the technology stacks that were previously out there, WCF/YAA appears to have a long way to go.</p>
<p>BTW, my <a href="http://www.ddj.com/188700967">podcast on ESBs </a>is up on Dr. Dobbs now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2006/06/02/can-indigo-be-my-bus/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
