<?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; Reliability</title>
	<atom:link href="http://www.udidahan.com/category/reliability/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.udidahan.com</link>
	<description>Enterprise Development Expert &#38; SOA Specialist</description>
	<lastBuildDate>Sun, 08 Jan 2012 12:45:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Myth Of &#8220;Infinite Scalability&#8221;</title>
		<link>http://www.udidahan.com/2011/12/29/the-myth-of-infinite-scalability/</link>
		<comments>http://www.udidahan.com/2011/12/29/the-myth-of-infinite-scalability/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 09:58:52 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Availability]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Reliability]]></category>
		<category><![CDATA[Scalability]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=1607</guid>
		<description><![CDATA[Scalability is a topic near and dear to my heart.
Many a client seeks me out for the first time for help in this area.
Usually the request is for an amount substantially smaller than infinity.
It&#8217;s usually on the discussion groups and in conference presentations that infinity is brought into it.
The basics
The first issue with scalability is [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.udidahan.com/wp-content/uploads/globe.jpg" alt="globe" title="globe" width="250" height="205" style="float:right; margin-left:10px; margin-bottom:10px;" />Scalability is a topic near and dear to my heart.</p>
<p>Many a client seeks me out for the first time for help in this area.</p>
<p>Usually the request is for an amount substantially smaller than infinity.</p>
<p>It&#8217;s usually on the discussion groups and in conference presentations that infinity is brought into it.</p>
<h3>The basics</h3>
<p>The first issue with scalability is the use of the word as an adjective: scalable.</p>
<p>&#8220;Is the system scalable?&#8221;</p>
<p>Or the similar verb use: &#8220;Does it scale?&#8221;</p>
<p>The problem here is the implication that there is a yes/no answer to the question. </p>
<p>Scalability is not boolean.</p>
<h3>Linear Scalability</h3>
<p><img src="http://www.udidahan.com/wp-content/uploads/scalability.gif" alt="scalability" title="scalability" width="150" height="150" style="float:right; margin-left:10px; margin-bottom:10px;" />When people talk about scalability, or a system being able to scale, they&#8217;re usually referring to a graph that looks something like this:</p>
<p>The red graph indicating a system that does not scale well, the green graph indicating one that does.</p>
<p>What is missing from this diagram are the labels of the axes. </p>
<p>The Y axis is Cost, Expense, or Money.<br />
The X axis is usually the number of users (for internet-type companies).</p>
<p>Ultimately, scalability is a cost-function that will tell us how much it will cost to have the system support a certain number of users. </p>
<p>Linear scalability is when the cost of the next user is the same as the cost of the previous user. This means our system doesn&#8217;t have bottlenecks. This is what people usually mean when they say &#8220;infinite scalability&#8221;.</p>
<h3>But there&#8217;s more</h3>
<p>As many of the internet companies (and their investors) have realized over the years, there&#8217;s a difference between the number of users and the number of <b>active</b> users. It&#8217;s very easy to scale to a billion users when only 1000 of them are active at any given time.</p>
<p>To be more accurate, what we want is additional X-axes for things like total data managed by the system, number of requests per user, resource utilization per request, propagation speed (how quickly information entered by one user needs to be visible to others), and more.</p>
<p>Scalability is a multi-dimensional cost function, where part of an architects job is to figure out which dimensions are significant for the system/business, and what the expectation for growth is across each axis.</p>
<h3>Preparing for &#8220;infinity&#8221;</h3>
<p>Be careful not to optimize for only a single dimension &#8211; reality is a whole lot more complex.</p>
<p>There are so many other things to deal with as a system scales.</p>
<p>For example, do you really think you&#8217;re going to want your configuration entirely centralized? Putting everything in one place means easier management, yes, but it also means a mistake will instantly affect everyone. Is it worth the risk? Maybe instead of centralization, we could do with some automation that will allow a staged rollout of configuration changes with the ability to rollback. </p>
<p>The same goes for rolling out new versions, patches, and upgrades.</p>
<p>But that now means we may have multiple versions of the same system in production at the same time. How will that work? Will they all talk to the same database? How will we version the database then? If not, how will we handle state? Won&#8217;t this mean our code will have to be backwards compatible from one version to another? Isn&#8217;t that hard? Like, insanely hard?</p>
<p>Please, can we park the whole &#8220;infinite scalability&#8221; thing?<br />
It&#8217;s really not the most important concern &#8211; not by a long shot.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2011/12/29/the-myth-of-infinite-scalability/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Inconsistent data, poor performance, or SOA &#8211; pick one</title>
		<link>http://www.udidahan.com/2011/09/18/inconsistent-data-poor-performance-or-soa-pick-one/</link>
		<comments>http://www.udidahan.com/2011/09/18/inconsistent-data-poor-performance-or-soa-pick-one/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 16:52:17 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[Business Rules]]></category>
		<category><![CDATA[CQRS]]></category>
		<category><![CDATA[DDD]]></category>
		<category><![CDATA[Data Access]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[Reliability]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=1527</guid>
		<description><![CDATA[One of the things that surprises some developers that I talk to is that you don&#8217;t always get consistency even with end-to-end synchronous communication and a single database. This goes beyond things like isolation levels that some developers are aware of and is particularly significant in multi-user collaborative domains.
The problem
Let&#8217;s start with an image to [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things that surprises some developers that I talk to is that you don&#8217;t always get consistency even with end-to-end synchronous communication and a single database. This goes beyond things like isolation levels that some developers are aware of and is particularly significant in multi-user collaborative domains.</p>
<h3>The problem</h3>
<p>Let&#8217;s start with an image to describe the scenario:</p>
<p><img src="http://www.udidahan.com/wp-content/uploads/Inconsistency1.gif" alt="Inconsistency" title="Inconsistency" width="600" height="285" class="aligncenter size-full wp-image-1533" /><br />
<center>Image 1. 3 transactions working in parallel on 3 entities</center></p>
<p>The main issue we have here is that the values transaction 2 gets for A and B are those from T0 &#8211; before either transaction 1 or 3 completed. The reason this is an issue is that these old values (usually together with some message data) are used to calculate what the new state of C should be. </p>
<p>Traditional optimistic concurrency techniques won&#8217;t detect any problem if we don&#8217;t touch A or B in transaction 2.</p>
<p>In short, systems today are causing inconsistency.</p>
<h3>Some solutions</h3>
<p>1. Don&#8217;t have transactions which operate on multiple entities (which probably isn&#8217;t possible for some of your most important business logic).</p>
<p>2. Turn on <a href="http://en.wikipedia.org/wiki/Multiversion_concurrency_control">multi-version concurrency control</a> &#8211; this is called snapshot isolation in MS Sql Server.</p>
<p>Yes, you need to turn it on. It&#8217;s off by default.</p>
<p>The good news is that this will stop the writing of inconsistent data to your database.<br />
The bad news is that it will probably cause your system many more exceptions when going to persist.</p>
<p>For those of you who are using transaction messaging with automatic retrying, this will end up as &#8220;just&#8221; a performance problem (unless you follow the recommendations below). For those of you who are using regular web/wcf services (over tcp/http), you&#8217;re &#8220;cross cutting&#8221; exception management will likely end up discarding all the data submitted in those requests (but since that&#8217;s what you&#8217;re doing when you run into deadlocks this shouldn&#8217;t be news to you).</p>
<h3>The solution to the performance issues</h3>
<p>Eventual consistency.</p>
<p>Funny isn&#8217;t it &#8211; all those people who were afraid of eventual consistency got <b>inconsistency</b> instead.</p>
<p>Also, it&#8217;s not enough to just have eventual consistency (like between the command and query sides of CQRS). You need to drastically decrease the size of your entities. And the best way of doing that is to partition those entities across multiple business services (also known in DDD lingo as Bounded Contexts) each with its own database.</p>
<p>This is yet another reason why I say that CQRS shouldn&#8217;t be the top level architectural breakdown. Very useful within a given business service, yes &#8211; though sometimes as small as just some sagas.</p>
<h3>Next steps</h3>
<p>It may seem unusual that the title of this post implies that SOA is the solution, yet the content clearly states that traditional HTTP-based web services are a problem. Even REST wouldn&#8217;t change matters as it doesn&#8217;t influence how transactions are managed against a database.</p>
<p>The SOA solution I&#8217;m talking about here is the one I&#8217;ve spent the last several years <a href="http://www.udidahan.com/category/soa/">blogging about</a>. It&#8217;s a different style of SOA which has services stretch up to contain parts of the UI as well as down to contain parts of the database, resulting in a composite UI and multiple databases. This is a drastically different approach than much of the literature on the topic &#8211; especially Thomas Erl&#8217;s books.</p>
<p>Unfortunately there isn&#8217;t a book out there with all of this in it (that I&#8217;ve found), and I&#8217;m afraid that with my schedule (and family) writing a book is pretty much out of the question. Let&#8217;s face it &#8211; I&#8217;m barely finding time to blog.</p>
<p>The one thing I&#8217;m trying to do more of is provide training on these topics. I&#8217;ve just finished a course in London, doing another this week in Aarhus Denmark, and another next month in San Francisco (which is now sold out). The next openings this year will be in Stockholm, London; Sydney Australia and Austin Texas will be coming in January of next year. I&#8217;ll be coming over to the US more next year so if you missed San Francisco, keep an eye out.</p>
<p>I wish there was more I could do, but I&#8217;m only one guy.</p>
<p>Hmm, maybe it&#8217;s time to change that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2011/09/18/inconsistent-data-poor-performance-or-soa-pick-one/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>NServiceBus 2.5 Released</title>
		<link>http://www.udidahan.com/2010/12/31/nservicebus-2-5-released/</link>
		<comments>http://www.udidahan.com/2010/12/31/nservicebus-2-5-released/#comments</comments>
		<pubDate>Fri, 31 Dec 2010 16:12:44 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[Reliability]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=1376</guid>
		<description><![CDATA[Just before we usher in the new year, I&#8217;m happy to announce the release of NServiceBus version 2.5.

Yes, there&#8217;s a new logo, and the website&#8217;s been redesigned.
It&#8217;s been a long time coming &#8211; the previous version (2.0) was released in March.
I&#8217;m really quite excited about this version as it rolls up all the bug fixes [...]]]></description>
			<content:encoded><![CDATA[<p>Just before we usher in the new year, I&#8217;m happy to announce the release of NServiceBus version 2.5.</p>
<p><a href="http://www.NServiceBus.com"><img src="http://www.nservicebus.com/img/nServiceBus_Logo.png" width="330" height="77" style="border:none;" alt="Go to the NServiceBus website" title="Go to the NServiceBus website" /></a></p>
<p>Yes, there&#8217;s a new logo, and the website&#8217;s been redesigned.<br />
It&#8217;s been a long time coming &#8211; the previous version (2.0) was released in March.</p>
<p>I&#8217;m really quite excited about this version as it rolls up all the bug fixes and enhancements that customers have asked for as they ran version 2.0 under the most severe types of production environments. The next thing that is a big deal that many have been asking for is a <strong>licensed</strong> version of NServiceBus &#8211; that is, the ability to purchase a commercial license and receive support.</p>
<p>We all know how managers like having a throat to choke.</p>
<p>And now they&#8217;ll have one &#8211; NServiceBus Ltd is the company that will be providing licensing, services, and support for all customers&#8217; NServiceBus needs. After more than 33,000 downloads and over 1000 developers in the community, the demand has really grown. Who would&#8217;ve thought all this would happen when I started NServiceBus 4 years ago (before it even had a name).</p>
<h3>Why NServiceBus is better than WCF for your distributed systems</h3>
<p>This question comes up repeatedly for people hearing about NServiceBus for the first time.</p>
<p>The answer is simple &#8211; reliability.</p>
<p>A system built with NServiceBus is so much more reliable to all kinds of production conditions than WCF that it&#8217;s hardly a fair comparison at all. While WCF can be configured to provide something kind of close to the same level of reliability, you need to do a fair amount of spelunking through the various options of netMsmqBinding to get it right. </p>
<p>The second reason to use NServiceBus instead of WCF is publish/subscribe.</p>
<p>The ability to make use of events and the observer pattern not just to achieve loose coupling within a single process, but across many processes, machines, and sites. Can you imagine going back to programming without events? Shudder. But that&#8217;s exactly what it&#8217;s like to use WCF in your distributed system. NServiceBus brings you the best of object-oriented programming but in a distributed and reliable infrastructure.</p>
<h3>Don&#8217;t wait any longer</h3>
<p>Take NServiceBus for a spin.</p>
<p>But things may look a bit different after you do&#8230;</p>
<p><img src="http://www.udidahan.com/wp-content/uploads/RedPillBluePill.jpg" alt="RedPillBluePill" title="RedPillBluePill" width="595" height="239" class="alignnone size-full wp-image-1384" /></p>
<p><a href="http://www.NServiceBus.com">http://www.NServiceBus.com</a></p>
<p>And have a happy New Year.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2010/12/31/nservicebus-2-5-released/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>High Availability Presentation</title>
		<link>http://www.udidahan.com/2010/06/21/high-availability-presentation/</link>
		<comments>http://www.udidahan.com/2010/06/21/high-availability-presentation/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 06:36:34 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Availability]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[Reliability]]></category>
		<category><![CDATA[The Team]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/?p=1308</guid>
		<description><![CDATA[OK &#8211; this is the last one, I promise. Well, for now, anyway.
Earlier this month at TechEd North America I gave a fairly new presentation that was only delivered once before (at the Connected Systems User Group in London) and I&#8217;m happy to say is now online for your viewing pleasure.
High Availability &#8211; A Contrarian [...]]]></description>
			<content:encoded><![CDATA[<p>OK &#8211; this is the last one, I promise. Well, for now, anyway.</p>
<p>Earlier this month at TechEd North America I gave a fairly new presentation that was only delivered once before (at the Connected Systems User Group in London) and I&#8217;m happy to say is now online for your viewing pleasure.</p>
<p><a href="http://www.msteched.com/2010/NorthAmerica/ARC308">High Availability &#8211; A Contrarian View</a></p>
<p>Comments? Thoughts? Let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2010/06/21/high-availability-presentation/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Lost Notifications? No Problem.</title>
		<link>http://www.udidahan.com/2008/12/07/lost-notifications-no-problem/</link>
		<comments>http://www.udidahan.com/2008/12/07/lost-notifications-no-problem/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 09:46:05 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[EDA]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[Reliability]]></category>
		<category><![CDATA[SOA]]></category>

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

		<guid isPermaLink="false">http://www.udidahan.com/2008/11/15/reliability-availability-and-scalability/</guid>
		<description><![CDATA[The great people at IASA have made the recording for my webcast available online.
You can find it here.
The slides can be found here.
I also gave this talk at TechEd Barcelona and wanted to thank the attendee who posted this comment:

“You’ve done it again. Everytime I attend a session of yours I leave the room with [...]]]></description>
			<content:encoded><![CDATA[<p>The great people at IASA have made the recording for my <a href="http://www.udidahan.com/2008/09/25/presentation-reliability-scalability-and-availability/">webcast</a> available online.</p>
<p>You can find it <a href="http://www.iasahome.org/flash/global/udiras.wmv">here</a>.<br />
The slides can be found <a href="http://cid-c8ad44874742a74d.skydrive.live.com/self.aspx/Blog/Reliability|_Availability|_Scalability.pdf">here</a>.</p>
<p>I also gave this talk at TechEd Barcelona and wanted to thank the attendee who posted this comment:</p>
<blockquote><p>
<b>“You’ve done it again. Everytime I attend a session of yours I leave the room with new insights and inspiration on how to improve my software…”</b>
</p></blockquote>
<p>You made my day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/11/15/reliability-availability-and-scalability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Durable Messaging Dilemmas</title>
		<link>http://www.udidahan.com/2008/07/17/durable-messaging-dilemmas/</link>
		<comments>http://www.udidahan.com/2008/07/17/durable-messaging-dilemmas/#comments</comments>
		<pubDate>Thu, 17 Jul 2008 22:18:47 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Availability]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Reliability]]></category>
		<category><![CDATA[Scalability]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2008/07/17/durable-messaging-dilemmas/</guid>
		<description><![CDATA[I&#8217;ve received some great feedback on my MSDN article and some really great questions that I think more people are wondering about, so I think I&#8217;ll try to do a post per question and see how that goes.
Libor asks:
&#8220;Would you recommend using durable messaging for systems where there are similar requirements with respect to data [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve received some great feedback on my <a href="http://msdn.microsoft.com/en-us/magazine/cc663023.aspx">MSDN article</a> and some really great questions that I think more people are wondering about, so I think I&#8217;ll try to do a post per question and see how that goes.<img style="margin: 10px 0px 10px 10px" height="175" src="http://www.ewashtenaw.org/government/departments/cmhpsm/provider_information/Provider%20Training%20Resources/images/scales_of_justice.jpg" width="143" align="right"></p>
<p>Libor asks:</p>
<blockquote><p>&#8220;Would you recommend using durable messaging for systems where there are similar requirements with respect to data reliability as you had – ie. not losing any messages? If so, then why didn&#8217;t the final version of your solution use it? If not, can you explain why?&#8221;</p>
</blockquote>
<p>The answer is, as always, it depends, but here&#8217;s on what it depends:</p>
<p>When designing a system, we need to take a good, hard look at how we manage state, and what properties that state has. In a system of reasonable size we can expect various families of state with respect to their business value, data volatility, and fault-tolerance window. Each family needs to be treated differently. While durable messaging may be suitable for one, it may be overkill or underkill for another.</p>
<p>So, here&#8217;s what we&#8217;re going to be looking at:</p>
<ol>
<li>Business Value</li>
<li>Data Volatility</li>
<li>Fault-Tolerance Window</li>
</ol>
<h4>Business Value</h4>
<p>When talking about business value, I want to talk about what it means &#8220;not losing any messages&#8221;. The question is under what conditions will the messages not be lost, or rather, what are the threshold conditions where messages may start getting lost. If all our datacenters are nuked, we will lose data. It&#8217;s likely the business is OK with that (as much as can be expected under those circumstances). If a single server goes down, it&#8217;s likely the business would not be OK with losing messages containing financial data. However if a message requesting the health of a server were to get lost under those same conditions, that would probably be alright. In other words, what does that message represent in business terms.</p>
<h4>Data Volatility</h4>
<p><img style="margin: 0px 10px 0px 0px" height="150" src="http://www.classicdriver.com/upload/images/_de/3161/img02.jpg" width="270" align="left">Data volatility also has an impact. Let&#8217;s say that we&#8217;re building a financial trading system. The time that it takes us to respond to an event (message) that the cost of a certain financial instrument has changed, and the message that we send requesting to buy that security is critical. Let&#8217;s say that has to be done in under 10ms. Now, some failure has occurred preventing our message from reaching its destination for 20ms. What should we do with that message? Should we keep it around, making sure it doesn&#8217;t get lost? Not in this domain. On the contrary, that message should be thrown away as its &#8220;business lifetime&#8221; has been exceeded. Furthermore, even during that original period of 10ms, the use of durable messaging may make it close to impossible to maintain our response times.</p>
<h4>Fault-Tolerance Window</h4>
<p>These two topics feed into the third and more architectural one &#8211; fault-tolerance window: what period of time do we require fault tolerance, and with respect to how many (and what kind of) faults? This will lead us into an analysis of to how many machines do we need to copy a message before we release the calling thread. We&#8217;d also look at in which datacenters those machines reside. This will also impact (or be impacted by) the kinds of links we have to these datacenters if we want to maintain response times. These numbers will need to change when the system identifies a disaster &#8211; degrading itself to a lower level of fault-tolerance after a hurricane knocks out a datacenter, and returning to normal once it comes back up.</p>
<h4>Re-Evaluating Durable Messaging</h4>
<p>Durable messaging may be used at various points in each part of the solution, but we need to look at message size, the rate those messages are being written to disk, how fast the disk is, how much available disk we have (so we don&#8217;t make things worse in the case of degraded service), etc. Companies like Amazon also take into account disk failure rates, replacement rates (disks aren&#8217;t replaced <em>immediately</em> you know), and many other factors when making these decisions<img style="margin: 10px 0px 10px 10px;" height="231" alt="image" src="http://udidahan.weblogs.us/wp-content/uploads/image-thumb25.png" width="143" align="right" border="0"> </p>
<h4>Summary</h4>
<p>Our job as architects when designing the system is to find that cost-benefit balance for the various parts of the system according to these very applicative parameters. No, it&#8217;s not easy. No, cloud computing will not magically solve all of this for us. But, we are getting more technical tools to work with, operations staff is getting better at working with us in the design phase, and our thought processes more rigorous in dealing with the scary conditions of the real world. </p>
<p>To your question, Libor, as to why we didn&#8217;t eventually use durable messaging in our solution, the answer is that we solved the overall state management problem by setting up an applicative protocol with our partners which was resilient in the face of faults by using idempotent messages that could be resent as many times as necessary. You can read more about it <a href="http://udidahan.weblogs.us/2008/04/10/scalability-article-up-on-infoq/">here</a>. This solution isn&#8217;t viable for other kinds of interactions but was just what we needed to get the job done.</p>
<p>Hope that helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2008/07/17/durable-messaging-dilemmas/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Make WCF and WF as Scalable and Robust as NServiceBus</title>
		<link>http://www.udidahan.com/2008/06/30/make-wcf-and-wf-as-scalable-and-robust-as-nservicebus/</link>
		<comments>http://www.udidahan.com/2008/06/30/make-wcf-and-wf-as-scalable-and-robust-as-nservicebus/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 14:47:08 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Reliability]]></category>
		<category><![CDATA[Scalability]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Workflow]]></category>

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

