<?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; WCF</title>
	<atom:link href="http://www.udidahan.com/category/wcf/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.udidahan.com</link>
	<description>Enterprise Development Expert &#38; SOA Specialist</description>
	<lastBuildDate>Tue, 31 Aug 2010 09:56:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>NServiceBus &#8211; .NET Service Bus Smackdown</title>
		<link>http://www.udidahan.com/2010/08/04/nservicebus-net-service-bus-smackdown/</link>
		<comments>http://www.udidahan.com/2010/08/04/nservicebus-net-service-bus-smackdown/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 11:24:39 +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=1322</guid>
		<description><![CDATA[I get this question quite often: &#8220;what is the difference between NServiceBus and the .NET Service Bus from Microsoft?&#8221; And I&#8217;m afraid the answer is that the two technologies were designed to handle a very different set of problems. 
The .NET Service Bus was designed to bridge internet communications using the cloud to enable a [...]]]></description>
			<content:encoded><![CDATA[<p>I get this question quite often: &#8220;what is the difference between NServiceBus and the .NET Service Bus from Microsoft?&#8221; And I&#8217;m afraid the answer is that the two technologies were designed to handle a very different set of problems. </p>
<p>The .NET Service Bus was designed to bridge internet communications using the cloud to enable a variety of devices to communicate using a WCF-remote-procedure-call type of API. NServicebus was designed to simplify the design of on-premise distributed systems using reliable messaging.</p>
<p>Still, people seem to want a kind of comparison, so here&#8217;s a quick one off-the-top-of-my-head:</p>
<table style="text-align:center; font-size:12px;" border="1">
<tr style="font-weight:bold; font-size:16px;">
<td>Feature</td>
<td>.NET Service Bus</td>
<td>NServiceBus</td>
</tr>
<tr>
<td>Cloud-based messaging</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td>Internet-spanning communication</td>
<td>Yes</td>
<td>Yes &#8211; via additional gateway process</td>
</tr>
<tr>
<td>Lightweight client support</td>
<td>Yes</td>
<td>Yes &#8211; via exposed WCF endpoint</td>
</tr>
<tr>
<td>Full duplex communication</td>
<td>Yes</td>
<td>Yes &#8211; not including lightweight clients</td>
</tr>
<tr>
<td>Publish / Subscribe support</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>Interop with non-.Net platforms</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>Maximum message size</td>
<td>64 KB</td>
<td>4012 KB</td>
</tr>
<tr>
<td>Long-running stateful processes</td>
<td>Using WF on top</td>
<td>Yes</td>
</tr>
<tr>
<td>On-premise messaging</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>Client can send messages if server is offline</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>Poison message detection and dispatching</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>Poison messages re-processing</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>Subscriptions persist after restart</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>Polymorphic message dispatch</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>Polymorphic message routing</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>Message-driven unit testing</td>
<td>No</td>
<td>Yes</td>
</tr>
</table>
<p>This is not meant to be an exhaustive list, or even an accurate representation of the relative strengths and weaknesses of the technologies because, as I said, they&#8217;re designed for different purposes. </p>
<p>One could even plug the .NET Service Bus into NServiceBus instead of its MSMQ transport to get broad reach where required, and then switching back to the on-premise strengths of MSMQ. The pluggability of NServiceBus makes it easy to swap out almost all implementation components like the subscription storage, transport, authorization mechanisms, containers, etc.</p>
<p>For more information on the .NET Service Bus see the <a href="http://www.microsoft.com/windowsazure/appfabric/">Azure AppFabric page</a>. Juval Lowey also has a nice article on it up on MSDN magazine <a href="http://msdn.microsoft.com/en-us/magazine/dd569756.aspx">here</a>.</p>
<p>For more information on NServiceBus see the <a href="http://www.NServiceBus.com">NServiceBus site</a>. Also take a look at the pages giving you comparisons to WCF and BizTalk.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2010/08/04/nservicebus-net-service-bus-smackdown/feed/</wfw:commentRss>
		<slash:comments>2</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>MSDN Magazine Smart Client Article</title>
		<link>http://www.udidahan.com/2009/03/28/msdn-magazine-smart-client-article/</link>
		<comments>http://www.udidahan.com/2009/03/28/msdn-magazine-smart-client-article/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 19:16:39 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[Scalability]]></category>
		<category><![CDATA[Smart Client]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://www.udidahan.com/2009/03/28/msdn-magazine-smart-client-article/</guid>
		<description><![CDATA[
My article on “optimizing a large-scale Software+Services application” has been published in the April edition of MSDN Magazine.
Here’s a short excerpt:
“We had to juggle occasional connectivity, data synchronization, and publish/subscribe all at the same time. We learned that we couldn’t solve all problems either client-side or server-side, but rather that an integrated approach was needed [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://msdn.microsoft.com/en-us/magazine/dd569749.aspx"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; margin: 0px 0px 10px 10px; border-left: 0px; border-bottom: 0px" height="244" alt="image" src="http://www.udidahan.com/wp-content/uploads/MSDNMagazineSmartClientArticle_13E17/image.png" width="189" align="right" border="0" /></a></p>
<p>My article on “optimizing a large-scale Software+Services application” has been published in the April edition of MSDN Magazine.</p>
<p>Here’s a short excerpt:</p>
<blockquote><p>“We had to juggle occasional connectivity, data synchronization, and publish/subscribe all at the same time. We learned that we couldn’t solve all problems either client-side or server-side, but rather that an integrated approach was needed since any changes on one side needed corresponding changes on the other side.”</p></blockquote>
<p><a href="http://msdn.microsoft.com/en-us/magazine/dd569749.aspx">Continue reading… </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2009/03/28/msdn-magazine-smart-client-article/feed/</wfw:commentRss>
		<slash:comments>12</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>WCF, Smart Clients, and Deadlocks</title>
		<link>http://www.udidahan.com/2008/04/11/wcf-smart-clients-and-deadlocks/</link>
		<comments>http://www.udidahan.com/2008/04/11/wcf-smart-clients-and-deadlocks/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 09:15:38 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Simplicity]]></category>
		<category><![CDATA[Smart Client]]></category>
		<category><![CDATA[Threading]]></category>
		<category><![CDATA[WCF]]></category>

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

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

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/12/29/wcf-everywhere-not-on-my-watch/</guid>
		<description><![CDATA[ The other day I was at Juval&#8217;s presentation where the main message was WCF is a better .NET. In other words, if you use WCF on every one of your classes, you&#8217;ll benefit. I don&#8217;t know about you, but I&#8217;m quite wary of silver bullets &#8211; they tend to inflict quite a bit of [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://udidahan.weblogs.us/wp-content/uploads/silver_bullets.png" alt="silver bullets" style="border: 0px none ; margin: 0px 20px 20px" align="right" border="0" height="139" width="98" /></a> The other day I was at <a href="http://www.idesign.net/">Juval&#8217;s</a> presentation where the main message was WCF is a better .NET. In other words, if you use WCF on every one of your classes, you&#8217;ll benefit. I don&#8217;t know about you, but I&#8217;m quite wary of silver bullets &#8211; they tend to inflict quite a bit of pain when used indiscriminately. This post is my response to all the people who came up to me at the end of the presentation and wanted to know if I agreed with these far-reaching architectural statements.</p>
<p><a href="http://udidahan.weblogs.us/wp-content/uploads/oz1.jpg"><img src="http://udidahan.weblogs.us/wp-content/uploads/oz-thumb1.jpg" alt="oz" style="border: 0px none ; margin: 0px 20px 20px 0px" align="left" border="0" height="137" width="134" /></a>  First of all let me say that Juval is indeed a master presenter. The &#8220;looks like a class, walks like a class, quacks like a class&#8221; bit was excellent. I could tell that most people didn&#8217;t notice the speedy hands quickly deleting all attributes from the classes before the &#8220;looks like a class&#8230;&#8221; bit. At times, I got flashbacks from the Wizard of Oz &#8211; &#8220;pay no attention to the man behind the curtain&#8221;. If all attributes in WCF only went on the interfaces, then this might actually fly, but we all know that that&#8217;s not the case.</p>
<p>One of the interesting comparisons Juval made with WCF was the introduction of .NET. Few people in the audience seemed to remember (or maybe were just professionally younger than .NET&#8217;s 8 years), but when it came out .NET was marketed as being mainly about XML Web Services. Juval stated that this was done to play down the fact that .NET made the previous Windows programming technologies obsolete. He then drew the same conclusion about WCF &#8211; that it&#8217;s as much .NET 3.0 as .NET was the next version of MFC; besides being written in a language that resembles the previous technology, it&#8217;s really all different. I don&#8217;t think that anyone would argue the difference, but is it really a &#8220;plain .NET&#8221; killer?</p>
<p><a title="answer" name="answer"></a>The answer seemed to come around the overhead of WCF &#8211; yet Juval deftly deflected that issue with a demo showing WCF doing 200 calls a second. And everybody just bought it &#8211; I was shocked. That&#8217;s 5ms per call. If you actually take Juval&#8217;s advice and use WCF on all your classes, you&#8217;ve bought yourself one hell of a performance nightmare. Say you have around 20 of your objects involved in a sequence to handle a user action &#8211; not that many actually. With a 5ms lag per object interaction, that user action is going to take 100ms &#8211; not including any database or webservice stuff you might be doing. If you do that in a server environment, you&#8217;ll be doing roughly 10 concurrent users per core. And that&#8217;s not even doing any heavy calculations or anything. Moderately sized systems are running upwards of 1000 concurrent users &#8211; if they needed 100 cores (or dozens of servers) for that, I&#8217;m guessing that they&#8217;d be out of business.</p>
<p>Let&#8217;s cut this short &#8211; WCF everywhere doesn&#8217;t scale, doesn&#8217;t perform, isn&#8217;t maintainable, or testable either. In other words &#8211; don&#8217;t do it. I know Juval is a brilliant guy, and an amazing presenter &#8211; but I don&#8217;t believe he would be employing this with his own clients. This actually bears repeating. WCF is a fine technology for your application&#8217;s boundaries, but don&#8217;t be pushing it in.</p>
<h1>Don&#8217;t do it.</h1>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/12/29/wcf-everywhere-not-on-my-watch/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>No more workflow for nServiceBus &#8211; please welcome the Saga</title>
		<link>http://www.udidahan.com/2007/12/17/no-more-workflow-for-nservicebus-please-welcome-the-saga/</link>
		<comments>http://www.udidahan.com/2007/12/17/no-more-workflow-for-nservicebus-please-welcome-the-saga/#comments</comments>
		<pubDate>Mon, 17 Dec 2007 11:42:40 +0000</pubDate>
		<dc:creator>udidahan</dc:creator>
				<category><![CDATA[ESB]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/12/17/no-more-workflow-for-nservicebus-please-welcome-the-saga/</guid>
		<description><![CDATA[As a part of my efforts to make clearer what place nServiceBus has in the Microsoft .NET ecosystem, I&#8217;ve decided to retire the term &#8220;workflow&#8221;.  Almost every conversation about nServiceBus where the term &#8220;workflow&#8221; was brought up, the reaction was almost identical:
&#8220;What&#8217;s wrong with Workflow Foundation? Why aren&#8217;t you using it like you use [...]]]></description>
			<content:encoded><![CDATA[<p>As a part of my efforts to make clearer what place <a href="http://www.nservicebus.com">nServiceBus</a> has in the Microsoft .NET ecosystem, I&#8217;ve decided to retire the term &#8220;workflow&#8221;.  Almost every conversation about nServiceBus where the term &#8220;workflow&#8221; was brought up, the reaction was almost identical:</p>
<p>&#8220;What&#8217;s wrong with Workflow Foundation? Why aren&#8217;t you using it like you use WCF?&#8221;</p>
<p>There&#8217;s nothing wrong with Workflow Foundation. The thing is that nServiceBus doesn&#8217;t really need workflow in the general sense of the term.  An older term that&#8217;s been used in the DBMS community might make more sense &#8211; &#8220;long-lived transactions&#8221;. You see, nServiceBus requires state management over many messaging interactions, and thus, some kind of long-lived transaction to maintain consistency.</p>
<p>In 1987, a different model was introduced for handling these scenarios &#8211; the Saga [<a href="http://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf">GARCIA-MOLINA 87</a>], and was further expanded in 1992 [<a href="http://citeseer.ist.psu.edu/chrysanthis92acta.html">CHRYSANTHIS 92</a>] to allow the saga to commit if a non-vital subset of the sub-transactions abort. This is what is used in nServiceBus.</p>
<p>When used in distributed manner on top of one-way messaging, this results in a solution where each service runs its own &#8220;mini-workflow&#8221;, and coordinates its actions with other services via messages. This integration style is different from the traditional broker, man-in-the-middle approach found in products like Biztalk; and is known as &#8220;choreography&#8221;, and is in the process of standardization in the WS-* specs, known as <a href="http://www.w3.org/TR/ws-chor-model/">WS-Choreography</a>.</p>
<p>So, the bottom line is that the source, examples, and documentation of nServiceBus is being moved in this direction. The source and examples on the <a href="http://sourceforge.net/projects/nservicebus">sourceforge site</a> have already been brought forward. This is a breaking change.</p>
<p>I hope that this will make it clearer that nServiceBus is a higher-level set of abstractions than WCF/WF &#8211; limiting the generality found in these frameworks to enable one cohesive way of working that will result in a solution that is both scalable and robust. On the other hand, nServiceBus is not a fully integrated product like Biztalk and intends to tackle different kinds of problems.</p>
<p>Bigger than a WCF/WF, smaller than a <strike>breadbox</strike> Biztalk.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/12/17/no-more-workflow-for-nservicebus-please-welcome-the-saga/feed/</wfw:commentRss>
		<slash:comments>2</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>[Podcast] Durable Services with WCF, WF, and NServiceBus</title>
		<link>http://www.udidahan.com/2007/10/23/podcast-durable-services-with-wcf-wf-and-nservicebus/</link>
		<comments>http://www.udidahan.com/2007/10/23/podcast-durable-services-with-wcf-wf-and-nservicebus/#comments</comments>
		<pubDate>Tue, 23 Oct 2007 21:17:40 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Ask Udi Podcast]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Scalability]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/10/23/podcast-durable-services-with-wcf-wf-and-nservicebus/</guid>
		<description><![CDATA[In this podcast we&#8217;ll look at the issues around Durable Services, what makes them stateful or stateless, as well as how WCF and WF can be used to implement them. Finally, we&#8217;ll compare solutions based on .NET 3.5 and on NServiceBus&#8211;covering aspects such as transactions and persistent time-outs. 
Suresh asks:

Hi Udi,
I&#8217;ve been reading about the [...]]]></description>
			<content:encoded><![CDATA[<p>In this podcast we&#8217;ll look at the issues around Durable Services, what makes them stateful or stateless, as well as how WCF and WF can be used to implement them. Finally, we&#8217;ll compare solutions based on .NET 3.5 and on NServiceBus&#8211;covering aspects such as transactions and persistent time-outs. </p>
<p>Suresh asks:</p>
<blockquote><p>
Hi Udi,</p>
<p>I&#8217;ve been reading about the coming &#8220;durable services&#8221; that will be available with the next version of WCF. I also have been listening to your podcasts and reading your blog posts about NServiceBus where you talk about long-running workflows. It sounds like both of these technologies are trying to solve the same problem.</p>
<p>Do durable services do away with long-running workflow? If so, does that mean we don&#8217;t need Workflow Foundation either? If not, what is the connection between them.</p>
<p>If you could shed some light on the matter that would be great.</p>
<p>Suresh
</p></blockquote>
<p><b>Download</b></p>
<p><a href="http://www.ddj.com/architect/202600413">Download via the Dr. Dobb&#8217;s site</a></p>
<p>Or download directly <a href="http://www.dobbsprojects.com/media/newengine/dynamp.php/071022ud01.mp3?podcast=071022ud01.mp3">here</a></p>
<p><b>Additional References</b></p>
<ul>
<li>Blog post on <A href="http://www.winterdom.com/weblog/2007/06/28/WorkflowServicesInOrcas.aspx">Workflow Services in Orcas</A></li>
<li>Blog post on <A href="http://weblogs.asp.net/gsusx/archive/2007/06/14/orcas-durable-services.aspx">Orcas Durable Services</A></li>
<li>Blog post on <a href="https://www.gazitt.com/blog/PermaLink,guid,a8383226-a0dd-48c5-9fea-33d5da159d17.aspx">.NET Framework 3.5 Beta1 is Live on the Web</a></li>
</ul>
<p><b>Want more?</b></p>
<p>Check out the <a href="/ask-udi/">&#8220;Ask Udi&#8221; archives</a>.</p>
<p><b>Got a question?</b></p>
<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/2007/10/23/podcast-durable-services-with-wcf-wf-and-nservicebus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.dobbsprojects.com/media/newengine/dynamp.php/071022ud01.mp3?podcast=071022ud01.mp3" length="16231213" type="audio/mp3" />
		</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>IOutputChannel and IRequestChannel &#8211; More WCF Angst</title>
		<link>http://www.udidahan.com/2007/08/28/ioutputchannel-and-irequestchannel-more-wcf-angst/</link>
		<comments>http://www.udidahan.com/2007/08/28/ioutputchannel-and-irequestchannel-more-wcf-angst/#comments</comments>
		<pubDate>Tue, 28 Aug 2007 12:15:26 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Simplicity]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/08/28/ioutputchannel-and-irequestchannel-more-wcf-angst/</guid>
		<description><![CDATA[I&#8217;m in the process of implementing a generic WCF transport for NServiceBus and am seriously going out of my mind. The fact that I have to do crazy reflection over generics to get around some of the channel model is ludicrous. To top it off, I now find out that there isn&#8217;t a simple generic [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m in the process of implementing a generic WCF transport for <a href="www.NServiceBus.com">NServiceBus</a> and am seriously going out of my mind. The fact that I have to do crazy reflection over generics to get around some of the channel model is ludicrous. To top it off, I now find out that there isn&#8217;t a simple generic way to send messages.</p>
<p>IOutputChannel exposes &#8220;void Send(Message message);&#8221; while IRequestChannel exposes &#8220;Message Request(Message message);&#8221;. Of course, they are incompatible having only an anorexic common interface IChannel (which exposes <i>only</i> &#8220;T GetProperty&lt;T&gt;() where T: class;&#8221;).</p>
<p>I&#8217;m doing everything in power to hide the complexity (sorry, flexibility) of WCF behind the simple IBus interface, but it looks like it&#8217;s going to bubble up in the configuration anyway.</p>
<p>If push comes to shove, I&#8217;ll just implement a bunch of my own transports which will specifically encapsulate each of the WCF bindings.</p>
<p>New release coming soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/08/28/ioutputchannel-and-irequestchannel-more-wcf-angst/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>[Podcast] Using WCF for Entity and Activity Services to Implement Business Services</title>
		<link>http://www.udidahan.com/2007/07/17/podcast-using-wcf-for-entity-and-activity-services-to-implement-business-services/</link>
		<comments>http://www.udidahan.com/2007/07/17/podcast-using-wcf-for-entity-and-activity-services-to-implement-business-services/#comments</comments>
		<pubDate>Tue, 17 Jul 2007 14:00:08 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Ask Udi Podcast]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/07/17/podcast-using-wcf-for-entity-and-activity-services-to-implement-business-services/</guid>
		<description><![CDATA[This week we return to the topic of Entity, Activity, and Process services and compares their usages as top-level SOA elements and as implementation details of the application architecture inside a business service.
And the question that this answers is:

Hi Udi,
We&#8217;ve been having some discussions about how to implement our latest project using SOA and this [...]]]></description>
			<content:encoded><![CDATA[<p>This week we return to the topic of Entity, Activity, and Process services and compares their usages as top-level SOA elements and as implementation details of the application architecture inside a business service.</p>
<p>And the question that this answers is:</p>
<blockquote><p>
Hi Udi,</p>
<p>We&#8217;ve been having some discussions about how to implement our latest project using SOA and this is what we came up with: </p>
<p>Every activity is a method, which is broken into a class ( Think separation of concerns ), so we get high reusability.<br />
On top of those classes we have decided to put a WCF layer, so you can expose the method as a web method. If an activity needs data, then it will access a entity service via WCF. To make the activities useful for the business we put them in a class which we have called processes ( a process layer). A process contains one or more activities and is able to call other processes and activities aren&#8217;t allowed to call processes or other activities.  On top of each process we have decided to put a WCF so the UI can access them. </p>
<p>So it&#8217;s pretty close to what you wrote about in the Microsoft Architecture Journal except that we don&#8217;t have direct call to the entity services, we wrap it up in an activity before the call, which is wrapped in a WCF-host. Much like the definitions in Ontology and Taxonomy of Services in a Service-Oriented Architecture</p>
<p>I would love to hear your comments and thoughts about this architecture. </p>
<p>With thanks, Ingo
</p></blockquote>
<p><a href="http://www.ddj.com/dept/webservices/201001690">Download via the Dr. Dobbs&#8217; site</a>.</p>
<p>Or download directly <a href="http://www.dobbsprojects.com/media/newengine/dynamp.php/070716ud01.mp3?podcast=070716ud01.mp3">here</a>.</p>
<p><u>Additional References:</u></p>
<ul>
<li><a href="http://msdn2.microsoft.com/en-us/arcjournal/bb491121.aspx">Ontology and Taxonomy of Services in a Service-Oriented Architecture</a></li>
<li><a href="http://udidahan.weblogs.us/2007/02/20/autonomous-services-and-enterprise-entity-aggregation/">Udi&#8217;s Architecture Journal article on Autonomous Services<br />
</a></li>
<li><a href="http://udidahan.weblogs.us/2007/04/18/podcast-how-to-structure-net-solutions-and-components/">Podcast on how to structure .NET solutions and components</a></li>
<li><a href="http://udidahan.weblogs.us/2007/06/08/entity-services-rollup/">Blog post covering a discussion on Entity Services</a></li>
</ul>
<p><b>Want More?</b></p>
<p>Check out the <a href="/ask-udi/">&#8220;Ask Udi&#8221; archives</a>.</p>
<p><b>Got a question?</b></p>
<p>Send Udi your question and have him answer it on the show: <a href="mailto:podcast@UdiDahan.com">podcast@UdiDahan.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/07/17/podcast-using-wcf-for-entity-and-activity-services-to-implement-business-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.dobbsprojects.com/media/newengine/dynamp.php/070716ud01.mp3?podcast=070716ud01.mp3" length="10951162" type="audio/mp3" />
		</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>[Podcast] Passing Data Between Layers in SOA Model/Smart Client Application</title>
		<link>http://www.udidahan.com/2007/07/12/podcast-passing-data-between-layers-in-soa-modelsmart-client-application/</link>
		<comments>http://www.udidahan.com/2007/07/12/podcast-passing-data-between-layers-in-soa-modelsmart-client-application/#comments</comments>
		<pubDate>Thu, 12 Jul 2007 22:37:18 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Ask Udi Podcast]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Smart Client]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/07/12/podcast-passing-data-between-layers-in-soa-modelsmart-client-application/</guid>
		<description><![CDATA[This week we discuss the different options that are available for passing data between a client and a service, as well as common pitfalls around trying to use the same objects for both presentation to the user and persistence to the database.
Download via the Dr. Dobb&#8217;s site.
Or download directly here.
And here&#8217;s the question that gets [...]]]></description>
			<content:encoded><![CDATA[<p>This week we discuss the different options that are available for passing data between a client and a service, as well as common pitfalls around trying to use the same objects for both presentation to the user and persistence to the database.</p>
<p><a href="http://ddj.com/dept/webservices/201001098">Download via the Dr. Dobb&#8217;s site.</a></p>
<p>Or download directly <a href="http://www.dobbsprojects.com/media/newengine/dynamp.php/070712ud01.mp3?podcast=070712ud01.mp3">here</a>.</p>
<p>And here&#8217;s the question that gets us started:</p>
<blockquote><p>
Hello there, </p>
<p>We are developing an application in .NET Smart Client application which connects to a WCF service and then to the data access layer.  The issue we have here is on the type of data which can be passed between the client side and web service. </p>
<p>1. Can it be a dataset (No!), custom entity or XML or anything else ? </p>
<p>     Which is the best one ?</p>
<p>2. Ofcourse , a dataset can&#8217;t be used coz it can&#8217;t be used in non-.NET environment?</p>
<p>3. If we go for custom-entity or XML how do we ensure the changes happen to the data during client-side actions ? For example, binding the XML or custom entity to a data grid can be done.  But if user makes any changes to the same,  how do we identify ?</p>
<p>4. If we use custom entities / XM L, the same can not be passed to the Data Access Application Block which invokes the data objects.</p>
<p>Note : All the above are based on assumption without using a translator in between any of the layers.</p>
<p>Please provide a better solution if you have come across any.
</p></blockquote>
<p><u>Additional References:</u></p>
<ul>
<li><a href="http://udidahan.weblogs.us/2007/03/28/podcast-datasets-web-services/">Podcast on using DataSets with Web Services</li>
<li><a href="http://udidahan.weblogs.us/2007/03/30/entity-framework-disconnected-problems-solutions/">Blog post on tracking changes to objects on the client side</a></li>
<li><a href="/ask-udi/">Looking for more of the &#8220;Ask Udi&#8221; podcast?</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/07/12/podcast-passing-data-between-layers-in-soa-modelsmart-client-application/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
<enclosure url="http://www.dobbsprojects.com/media/newengine/dynamp.php/070712ud01.mp3?podcast=070712ud01.mp3" length="15111103" type="audio/mp3" />
		</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>Testing services the hard way with WCF</title>
		<link>http://www.udidahan.com/2007/05/17/testing-services-the-hard-way-with-wcf/</link>
		<comments>http://www.udidahan.com/2007/05/17/testing-services-the-hard-way-with-wcf/#comments</comments>
		<pubDate>Thu, 17 May 2007 11:50:15 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Simplicity]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/05/17/testing-services-the-hard-way-with-wcf/</guid>
		<description><![CDATA[I just read the kind of hoops you have to go through in order to test your WCF service implementations. Oh. My. GOD.
If that&#8217;s the best there is, NOBODY is going to be testing their WCF services. That&#8217;s scary.
When using this message-based design, your service implementations tend to look like this:

public class WorkflowMessageHandler : IMessageHandler
{
	public [...]]]></description>
			<content:encoded><![CDATA[<p>I just read the kind of hoops you have to go through in order to <a href="http://blogs.msdn.com/martijnh/archive/2007/05/17/testing-wcf-service-implementations.aspx">test your WCF service implementations</a>. Oh. My. GOD.</p>
<p>If that&#8217;s the best there is, NOBODY is going to be testing their WCF services. That&#8217;s <i>scary</i>.</p>
<p>When using this <a href="http://udidahan.weblogs.us/2006/06/02/can-indigo-be-my-bus/">message-based design</a>, your service implementations tend to <a href="http://udidahan.weblogs.us/2007/05/12/service-enabled-workflows-with-wf-and-wcf/">look like this</a>:</p>
<pre>
public class WorkflowMessageHandler : IMessageHandler<Stage1Msg>
{
	public void Handle(Stage1Msg msg)
	{
		using (IDBScope scope = this.DbServices.GetScope(TransactionOption.On))
		{
			IWorkflow wf = this.DbServices.Get(msg.WorkFlowID);
			wf.Handle(msg);

			scope.Complete();
		}
	}
}
</pre>
<p>And it&#8217;s this easy to test them:</p>
<pre>
[TestMethod]
public void TestWorkflowMessageHandler()
{
	WorkflowMessageHandler handler = new WorkflowMessageHandler();
	handler.Bus = this.MockBus;

	// set up expectations on bus in terms of messages returned

	Stage1Msg msg = new Stage1Msg();
	// fill msg with data

	handler.Handle(msg);

	// verify expectations on bus
}
</pre>
<p>That&#8217;s right, it&#8217;s just plain old unit testing the way we test everything else these days.</p>
<p>I&#8217;m beginning to get the impression that the new suite of technologies that is coming out of Microsoft is making things more complicated than they need to be.</p>
<p>Well, maybe that&#8217;s just me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/05/17/testing-services-the-hard-way-with-wcf/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Service-Enabled Workflows with WF and WCF</title>
		<link>http://www.udidahan.com/2007/05/12/service-enabled-workflows-with-wf-and-wcf/</link>
		<comments>http://www.udidahan.com/2007/05/12/service-enabled-workflows-with-wf-and-wcf/#comments</comments>
		<pubDate>Sat, 12 May 2007 15:04:57 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/05/12/service-enabled-workflows-with-wf-and-wcf/</guid>
		<description><![CDATA[I’ve looked over the example Guy put up in his blog on how to interact with external services from a workflow, and tried it out using asynchronous APIs with WCF. This is done quite simply by having our service accept an object as a parameter that it can call methods on (which has availability issues, [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve looked over the example Guy put up in his blog on <a href="http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/04/21/WF-and-WCF-Integration-in-_2200_Orcas_2200_-_2D00_-Part-2-_2D00_-Service-Enabled-Workflows.aspx">how to interact with external services from a workflow</a>, and tried it out using asynchronous APIs with WCF. This is done quite simply by having our service accept an object as a parameter that it can call methods on (which has <a href="http://udidahan.weblogs.us/category/availability">availability issues</a>, but whatever). The object that we pass in is quite simply a reference to our own service. Anyway, I haven’t been able to get the SendActivity in WF to work with it. Bummer. I guess I’m &#8220;stuck&#8221; doing things <a href="http://udidahan.weblogs.us/2006/06/02/can-indigo-be-my-bus/">the &#8220;old fashioned&#8221; way</a>.</p>
<p>By having messages dealing with workflow contain the ID of the specific instance they refer to, we can do simple message to workflow mapping. When a message handler receives a message containing a workflow ID, it just goes to the workflow store and retrieves the object by its ID. Finally, it calls the Handle method on that object, and I’m done. Workflow classes are just state machines whose triggers are the arrival of a message.</p>
<p>Here’s some example code so you can see how simple it really is:</p>
<pre>
public class WorkflowMessageHandler : IMessageHandler&lt;Stage1Msg&gt;
{
	public void Handle(Stage1Msg msg)
	{
		using (IDBScope scope = this.DbServices.GetScope(TransactionOption.On))
		{
			IWorkflow wf = this.DbServices.Get<IWorkflow>(msg.WorkFlowID);
			wf.Handle(msg);

			scope.Complete();
		}
	}
}
</pre>
<p>You can see how easy it would be to take this and make it generic. Just define an IWorkflowMessage that inherits from IMessage and has a single property &#8211; WorkFlowID. Then we could have a BaseWorkflowMessageHandler&lt;T&gt; which would inherit from IMessageHandler&lt;T&gt; where T : IWorkflowMessage.</p>
<p>After that, it would be enough to have a class inherit from the base for a specific message and you&#8217;d be done, just like this:</p>
<pre>
public class Stage1Message : IWorkflowMessage { // WorkFlowID and other data };

public class WorkflowMessageHandler : BaseWorkflowMessageHandler&lt;Stage1Msg&gt; {}
</pre>
<p>I could even automate the creation of these message handlers given the set of messages that correspond to a workflow. I could then create all sorts of sexy designers on top of that.</p>
<p>But, seeing as there&#8217;s so little extra code to get long-running workflows to work with &#8220;asynchronous services&#8221;, I don&#8217;t think I&#8217;ll bother. I mean, why do I even need a &#8220;SendActivity&#8221;? It&#8217;s just a simple little call:</p>
<pre>this.Bus.Send(msg);</pre>
<p>It appears that clean designs don&#8217;t leave much to be draggy-dropped. Oh well. Your mileage may vary.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/05/12/service-enabled-workflows-with-wf-and-wcf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Service-Layer Separation of Concerns</title>
		<link>http://www.udidahan.com/2007/04/01/service-layer-separation-of-concerns/</link>
		<comments>http://www.udidahan.com/2007/04/01/service-layer-separation-of-concerns/#comments</comments>
		<pubDate>Sun, 01 Apr 2007 21:25:13 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Autonomous Services]]></category>
		<category><![CDATA[ESB]]></category>
		<category><![CDATA[NServiceBus]]></category>
		<category><![CDATA[Pub/Sub]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[Simplicity]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://udidahan.weblogs.us/2007/04/01/service-layer-separation-of-concerns/</guid>
		<description><![CDATA[The idea of having a generic bus object that dispatches message objects to their appropriate message handler objects seems to have struck a chord with Ayende (aka Oren). It is definitely one way of doing the Unit-of-Work Pattern that also partly goes along with the idea of Consumer-Driven Contracts, in that the consumer &#8220;defines&#8221; the [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="MARGIN: 0cm 0cm 10pt"><span lang="EN-US" style="mso-ansi-language: EN-US"><font face="Calibri" size="3">The idea of having a generic bus object that dispatches message objects to their appropriate message handler objects seems to have </font><a href="http://ayende.com/Blog/archive/2007/03/31/Disconnected-Mode-Change-Tracking.aspx"><font face="Calibri" color="#800080" size="3">struck a chord</font></a><font face="Calibri" size="3"> with Ayende (aka Oren). It is definitely one way of doing the </font><a href="http://www.martinfowler.com/eaaCatalog/unitOfWork.html"><font face="Calibri" size="3">Unit-of-Work Pattern</font></a><font face="Calibri" size="3"> that also partly goes along with the idea of </font><a href="http://www.martinfowler.com/articles/consumerDrivenContracts.html"><font face="Calibri" size="3">Consumer-Driven Contracts</font></a><font face="Calibri" size="3">, in that the consumer &ldquo;defines&rdquo; the transaction boundary. These two topics are directions that the </font><a href="http://udidahan.weblogs.us/2006/06/02/can-indigo-be-my-bus/"><font face="Calibri" color="#800080" size="3">Bus API</font></a><font size="3"><font face="Calibri"> was not originally intended to cover, but I&rsquo;ve found them useful in many cases.<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 10pt"><span lang="EN-US" style="mso-ansi-language: EN-US"><font size="3"><font face="Calibri">One of the strengths of this approach that isn&rsquo;t immediately apparent is that you can have multiple classes that handle the same message type. These classes are then configured in the Bus to run in a certain order &ndash; very similar to the channel model in WCF, or the HTTP Handlers in ASP.NET. Each message handler in the chain can stop processing of the message if it should so choose.<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 10pt"><span lang="EN-US" style="mso-ansi-language: EN-US"><font size="3"><font face="Calibri">The use of this strength is that it allows for a strong separation of concerns in the message handling logic. Need to do some pessimistic lock checking first? No problem &ndash; have a separate message handler class that does that. Want to add some custom auditing before and after all other processing, configure in a couple more message handlers. Have some complex validation logic that you&rsquo;d like to keep separate from the rest of the business logic? Put it in its own message handler class.<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 10pt"><span lang="EN-US" style="mso-ansi-language: EN-US"><font face="Calibri" size="3">For those thinking about more advanced messaging scenarios, you could have each message handler in the chain do some </font><a href="http://www.enterpriseintegrationpatterns.com/DataEnricher.html"><font face="Calibri" color="#800080" size="3">Content Enrichment</font></a><font size="3"><font face="Calibri"> and have that data available in down-stream handlers.<o:p></o:p></font></font></span></p>
<p><span lang="EN-US" style="FONT-SIZE: 11pt; LINE-HEIGHT: 115%; FONT-FAMILY: &quot;Calibri&quot;,&quot;sans-serif&quot;; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-theme-font: minor-bidi; mso-fareast-language: EN-US; mso-bidi-language: HE"></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 10pt"><span lang="EN-US" style="mso-ansi-language: EN-US">I&rsquo;ll address the issue of sending messages using this pattern in a coming post, so stay tuned </span><span lang="EN-US" style="FONT-FAMILY: Wingdings; mso-ansi-language: EN-US; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-char-type: symbol; mso-symbol-font-family: Wingdings"><span style="mso-char-type: symbol; mso-symbol-font-family: Wingdings">J</span></span><span lang="EN-US" style="mso-ansi-language: EN-US"><o:p></o:p></span></p>
<p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2007/04/01/service-layer-separation-of-concerns/feed/</wfw:commentRss>
		<slash:comments>4</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>Web Service Software Factory &#8211; Data Access CRUD!</title>
		<link>http://www.udidahan.com/2006/09/24/web-service-software-factory-data-access-crud/</link>
		<comments>http://www.udidahan.com/2006/09/24/web-service-software-factory-data-access-crud/#comments</comments>
		<pubDate>Mon, 25 Sep 2006 02:50:47 +0000</pubDate>
		<dc:creator>thesoftwaresimplist</dc:creator>
				<category><![CDATA[Data Access]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[OO]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://wp_630.weblogs.us/archives/320</guid>
		<description><![CDATA[And I don't mean CRUD as in Create,Read,Update,Delete.
<br/><br/>
I haven't been following the factories much but David Hayden's <a href="http://codebetter.com/blogs/david.hayden/archive/2006/09/24/Web-Service-Software-Factory-_2D00_-Data-Access-Guidance-Package-_2D00_-Code-Generation.aspx">recent post</a> pulled me back in. Here's an example of the kind of solution that the factory creates:
<br/><br/>
<img src="http://codebetter.com/photos/david.hayden/images/149515/original.aspx" />
<br/><br/>
I thought that object orientation was already accepted as good practice, but here comes Microsoft splitting up data and behavior once again. Business components that have only behavior, and business entities that contain only data (relationships between entities doesn't count as behavior) &#60;shudder/&#62;.
<br/><br/>
If anything, the business components, when you actually look at the code in them, are more service layer objects than anything else. Which kind of makes you wonder why there is a separate Service Implementation layer. Is it because the service implementation is technology dependent? The answer is yes.
<br/><br/>
Wouldn't it be great if we could have service layer objects that were technology independent? Then we could take the code in the "business components" and put it there, and do away with an entire layer.
<br/><br/>
You know where this is heading. The tried and true Domain Model pattern and its friends. Its just that this whole "data access" paradigm that Microsoft keeps pushing gets on my nerves. It just does not hold up in complex domains - I know, I've tried. I've also consulted on many other projects that have tried, and seen them get to the point of no return. The point where programmers just don't know what the domain logic is - because its spread all over the place: service implementation, business components, entities, data access, stored procedures... Its at that point when they have to "ship" so that the project won't be called a failure. Then they scrap the whole thing, and start working on version 2.0 which will be totally different! They use a rules engine! I've already <a href="http://udidahan.weblogs.us/archives/036915.html">wrote about </a>the kinds of successes I've seen there.
<br/><br/>
OK, enough whining. Do your own design. There are other patterns besides what Microsoft puts out. Read them, use them. Just because there's a factory that autogenerates thousands of lines of code, doesn't mean that they're the right thousands of lines of code.]]></description>
			<content:encoded><![CDATA[<p>And I don&#8217;t mean CRUD as in Create,Read,Update,Delete.</p>
<p>I haven&#8217;t been following the factories much but David Hayden&#8217;s <a href="http://codebetter.com/blogs/david.hayden/archive/2006/09/24/Web-Service-Software-Factory-_2D00_-Data-Access-Guidance-Package-_2D00_-Code-Generation.aspx">recent post</a> pulled me back in. Here&#8217;s an example of the kind of solution that the factory creates:</p>
<p><img src="http://codebetter.com/photos/david.hayden/images/149515/original.aspx" /></p>
<p>I thought that <a href="http://udidahan.weblogs.us/category/oo/">object orientation</a> was already accepted as good practice, but here comes Microsoft splitting up data and behavior once again. Business components that have only behavior, and business entities that contain only data (relationships between entities doesn&#8217;t count as behavior) &lt;shudder/&gt;.</p>
<p>If anything, the business components, when you actually look at the code in them, are more <a href="http://udidahan.weblogs.us/2007/04/01/service-layer-separation-of-concerns/">service layer objects</a> than anything else. Which kind of makes you wonder why there is a separate Service Implementation layer. Is it because the service implementation is technology dependent? The answer is yes.</p>
<p>Wouldn&#8217;t it be great if we could have service layer objects that were technology independent? Then we could take the code in the &#8220;business components&#8221; and put it there, and do away with an entire layer.</p>
<p>You know where this is heading. The tried and true <a href="http://udidahan.weblogs.us/2007/04/21/domain-model-pattern/">Domain Model pattern</a> and its friends. Its just that this whole <a href="http://udidahan.weblogs.us/category/data-access/">&#8220;data access&#8221;</a> paradigm that Microsoft keeps pushing gets on my nerves. It just does not hold up in complex domains &#8211; I know, I&#8217;ve tried. I&#8217;ve also consulted on many other projects that have tried, and seen them get to the point of no return. The point where programmers just don&#8217;t know what the domain logic is &#8211; because its spread all over the place: service implementation, business components, entities, data access, stored procedures&#8230; Its at that point when they have to &#8220;ship&#8221; so that the project won&#8217;t be called a failure. Then they scrap the whole thing, and start working on version 2.0 which will be totally different! They use a rules engine! I&#8217;ve already <a href="http://udidahan.weblogs.us/2006/09/05/soa-meets-business-rules/">wrote about </a>the kinds of successes I&#8217;ve seen there.</p>
<p>OK, enough whining. Do your own design. There are other patterns besides what Microsoft puts out. Read them, use them. Just because there&#8217;s a factory that autogenerates thousands of lines of code, doesn&#8217;t mean that they&#8217;re the right thousands of lines of code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.udidahan.com/2006/09/24/web-service-software-factory-data-access-crud/feed/</wfw:commentRss>
		<slash:comments>4</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>
