<?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>Gojko Adzic &#187; nservicebus</title>
	<atom:link href="http://gojko.net/tag/nservicebus/feed/" rel="self" type="application/rss+xml" />
	<link>http://gojko.net</link>
	<description>Building software that matters</description>
	<lastBuildDate>Wed, 04 Aug 2010 11:38:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Messaging is not just for investment banks</title>
		<link>http://gojko.net/2009/01/06/messaging-is-not-just-for-investment-banks/</link>
		<comments>http://gojko.net/2009/01/06/messaging-is-not-just-for-investment-banks/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 13:49:30 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[presentations]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[alt.net]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[asynchronous]]></category>
		<category><![CDATA[messaging]]></category>
		<category><![CDATA[nservicebus]]></category>
		<category><![CDATA[scalability]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=582</guid>
		<description><![CDATA[In the last week of November, Dave de Florinier and I did a talk on Asynchronous .NET architectures and NServiceBus. The sound of the recording was not that good so some readers asked for a transcript. The following is a transcript of my introduction to the talk, encouraging developers to investigate messaging architectures for mid-size [...]]]></description>
			<content:encoded><![CDATA[<p><img src='/images/msg1.png' align="left" style="border:1px solid black; margin:5px 5px 5px 5px"/><i>In the last week of November, Dave de Florinier and I did a talk on <a href="http://gojko.net/2008/12/02/asynchronous-net-applications-with-nservicebus">Asynchronous .NET architectures and NServiceBus</a>. The sound of the recording was not that good so some readers asked for a transcript. The following is a transcript of my introduction to the talk, encouraging developers to investigate messaging architectures for mid-size and smaller projects. I&#8217;ll try to get the rest of the talk published here soon as well.</i></p>
<p>Today, we use web and web-related services for content distribution, for remoting, for application partitioning and distribution. It seems that HTTP calls have become a default way to think about distributed systems. HTTP and Web services definitely have a lot to offer, but they are not the only way to do things and there are definitely cases where web is not the right choice. HTTP calls are synchronous, stateless (although there is a state simulation with cookie-based sessions) and generally not that reliable. They are also often one-way, which means that any kind of continuous notification always comes down to polling. When you need asynchronous actions, proper state and reliability or event driven behaviour, Web is not the right choice. Unfortunately, lots of people just stick with web services and hack on, trying to fit a square peg in a round hole. In cases such as these, a different distribution paradigm can save us quite a lot of time and effort both in development and later in maintenance. One of those different paradigms is messaging.</p>
<p>I&#8217;m not sure why, but I got the impression that lots of people think that messaging is only for huge systems in investment banks, not something that a small or a mid-size project should consider at all. This is false and now I&#8217;ll try to convince you.  <span id="more-582"></span></p>
<p>In a nutshell, messaging allows us to reliably break up a single process into several parts which can then be executed asynchronously. They can be executed with different threads, or even on different machines. The parts communicate by sending each other messages. The messaging framework guarantees that messages get delivered to the right recipient and wake up the appropriate thread when a message arrives.</p>
<h2>Fire and Forget</h2>
<p><img align="left"  src='/images/msg2.png' style="border:1px solid black; margin:5px 5px 5px 5px"/>Messaging is a great solution when you want to ensure that something gets done, but you don&#8217;t really care about the results and you don&#8217;t want to wait for it to finish. This kind of behaviour can often be found when the last part of a process requires talking to an external system or some sort of batch processing. </p>
<p>For example, after a user registers on the web site we want to send him a confirmation e-mail, but there is not much point in waiting for the e-mail to be sent to continue the work. We can send the e-mail synchronously from the web page, but that means blocking up the web server request (and a thread on the server and the user looking at the page and any other resources that the page holds such as a database connection) while the e-mail is sent through an external server. Another solution is to split this process into two parts. The actual registration is really important to finish while the user is there so that he can correct any problems, so that gets done synchronously. Instead of actually sending the e-mail, the web page can just enqueue an e-mail request in a form of a message and then finish working. This releases the database connections, threads and other server resources and returns the page to the user faster. The messaging framework then delivers this request to a dedicated e-mail sender which can dispatch the e-mail in the background. In addition to making the system more responsive, this approach also makes it more resilient. If the e-mail server is temporarily down or there is a DNS problem, the primary process will not be affected and the background process can retry after a while. If the background process is processor or resource intensive, this approach enables us to scale it better because we can have several workers waiting to handle requests from the primary part of the process. If the secondary part of the process is time-consuming, this approach enables the user to go offline knowing that the work will actually be done, and done only once. Remember messaging every time you create a page that contains something like &#8220;do not close this window, click on back or reload the page until you see a confirmation&#8221;. Messaging also makes the whole thing easier to test because we can check the contents of the message request from a unit test, without actually sending the e-mail. I wrote about this in a bit more detail earlier in <a href="http://gojko.net/2008/10/30/how-to-test-e-mail-notifications-properly/">How to test e-mail notifications properly</a>.</p>
<p>In any case, fire and forget is incredibly easy to implement with messaging and really hard to (properly) do it with a synchronous stateless unreliable platform such as web. </p>
<h2>Just leave it there when you&#8217;re done</h2>
<p><img align="left"  src='/images/msg3.png' style="border:1px solid black; margin:5px 5px 5px 5px"/>Another very interesting case is when there is a resource intensive or a time consuming operation that we want to execute and we care about the results, such as generating a long report or processing transactions with external payment providers. Messaging can also help a lot with this case. Instead of a single web request that consumes resources during the whole process, we can split it into the initial part that has to be done synchronously (collecting the report criteria or storing transaction information), assign an ID to that task and then break into two branches. The actual work gets done in the background, decoupled with messaging. For example, a background process picks up the report request and assembles it, saving a PDF to a predefined location on the disk. The second branch is executed by the browser, periodically checking with the server whether the work is done by passing the request ID. When the request is finally done, the client can ask for the results. The web server resources are released straight after the initial part, so that other users can utilise the server and we get better responsiveness and better resource usage. Again, this approach enables us to scale the system better &#8211; we can have many workers on many different machines building reports or processing transactions to help the system to scale, or we can limit the number of workers and ensure that scarse resources such as database connections or payment gateway links are available to a much larger number of web servers. I wrote about this earlier in <a href="http://gojko.net/2008/04/07/lazy-web-sites-run-faster/">Lazy Web Sites Run Faster</a>.</p>
<h2>Share the load</h2>
<p><img align="left"  src='/images/msg4.png' style="border:1px solid black; margin:5px 5px 5px 5px"/>This brings me to the third really useful situation when messaging should be considered. Whenever lots of different agents can request some work to be done, consider messaging as a way to decouple requesters and workers. Web services allow us to scale processing using simple HTTP load balancing, but this gets quite tedious to set up when the number of participants in the process grows. The requester must know how to call the worker and who the worker is. A messaging solution might help to divide and conquer, isolating parts of the system so that they don&#8217;t really care about each other. It also makes the system easier to scale and extend. The agents can just publish requests to a message queue, not caring about who and where will actually process them. A number of different processes, running on different machines, can pick up requests and service them, pushing the results back to the message queue. The results might be delivered back to the original requester or picked up by another worker to continue or complete the job. </p>
<p>Thinking about processing in this way allows us to scale the system at runtime much easier (just start up more workers that listen on the queue), extend the system easier (have specialised workers to process particular types of messages) or make the system more flexible (start up workers overnight to pick up low-priority tasks). All these changes can be done in runtime, without touching the code at all. </p>
<h2>The key to efficient asynchronous architectures</h2>
<p><img align="left" src='/images/msg5.png' style="border:1px solid black; margin:5px 5px 5px 5px"/>I hope that, by this point, I&#8217;ve at least tickled your imagination and possibly convinced you that messaging can help you do your job easier in some cases. The key to actually getting this done is having an efficient messaging framework in between, that coordinates processing and guarantees that messages actually get delivered. This framework is there to do the heavy lifting and our code should just be concerned with sending or picking up the messages and acting on them.</p>
<p>Maybe people are afraid of messaging because it is typically mentioned in the context of expensive application servers or service bus products, but there are some really lightweight and free (opensource) solutions for messaging as well. So you don&#8217;t have to pay a lot of money or hire expensive consultants to benefit from messaging. One such framework for .NET is <a target="_blank" href="http://nservicebus.com" rel="nofollow">NServiceBus</a>, which utilises Microsoft&#8217;s MSMQ queues, makes MSMQ programming dead easy and implements several really useful communication patterns for you out of the box. For Java, there is the <a href="http://activemq.apache.org/" target="_blank" rel="nofollow">Apache ActiveMQ</a>, which is really straightforward to set up and even supports Ajax and Flash clients almost out of the box. <a href="http://activemq.apache.org/camel/"  target="_blank" rel="nofollow">Apache Camel</a> implements various enterprise integration patterns out of the box with ActiveMQ.  </p>
<p>Image credits:<br />
<a href="http://www.sxc.hu/photo/1084274" target="_blank" rel="nofollow">Luisem</a>, <a href="http://www.sxc.hu/photo/319039" target="_blank" rel="nofollow"> Penelope Berger</a>,<br />
<a href="http://www.flickr.com/photos/library_of_congress/2179123671/" target="_blank" rel="nofollow">Library of Congres</a>, <a href="http://www.sxc.hu/photo/1035790" target="_blank" rel="nofollow">Dani Simmonds</a></p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2009/01/06/messaging-is-not-just-for-investment-banks/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Asynchronous .NET applications with NServiceBus</title>
		<link>http://gojko.net/2008/12/02/asynchronous-net-applications-with-nservicebus/</link>
		<comments>http://gojko.net/2008/12/02/asynchronous-net-applications-with-nservicebus/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 16:48:55 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[presentations]]></category>
		<category><![CDATA[alt.net]]></category>
		<category><![CDATA[altdotnet]]></category>
		<category><![CDATA[asynchronous applications]]></category>
		<category><![CDATA[messaging]]></category>
		<category><![CDATA[nservicebus]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=495</guid>
		<description><![CDATA[Here is the video from the talk that Dave de Florinier and I did last week on NServiceBus and asynchronous .NET applications. At the start, I talk about the fact that messaging and asynchronous applications are not just for investment banks and large enterprise systems and how lots of smaller projects can also benefit from [...]]]></description>
			<content:encoded><![CDATA[<p><embed id="VideoPlayback" src="http://video.google.com/googleplayer.swf?docid=-8915783692128518581&#038;hl=en&#038;fs=true" style="border:1px solid black; margin:5px 5px 5px 5px;width:400px;height:326px; float:left" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash"> </embed>Here is the video from the talk that Dave de Florinier and I did last week on NServiceBus and asynchronous .NET applications. At the start, I talk about the fact that messaging and asynchronous applications are not just for investment banks and large enterprise systems and how lots of smaller projects can also benefit from messaging. Dave then presents NServiceBus as a nice tool to help develop asynchronous applications in .NET, talks about publish-subscribe, full duplex, saga and distributor patterns and explains sample implementations. On the end, we had an open discussion on deployment and alternatives. </p>
<p>Here are the downloads and links:</p>
<ul>
<li><a href="/resources/nsb-skillsmatter-20081127.zip">source code</a></li>
<li><a href="/resources/nsb-skillsmatter-20081127.ppt">powerpoint slides</a></li>
<li><a href="http://www.nservicebus.com">NService bus main site</a></li>
<li><a href="http://www.udidahan.com">Udi Dahan&#8217;s blog (author of NServiceBus) </a></li>
<li><a href="http://ayende.com/Blog/archive/2008/03/24/NServiceBus-Review.aspx">Ayende&#8217;s review of NServiceBus</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2008/12/02/asynchronous-net-applications-with-nservicebus/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Enterprise .NET Development with Opensource .NET tools: SPA2009</title>
		<link>http://gojko.net/2008/11/11/enterprise-net-development-with-opensource-net-tools-spa2009/</link>
		<comments>http://gojko.net/2008/11/11/enterprise-net-development-with-opensource-net-tools-spa2009/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 12:26:02 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[alt.net]]></category>
		<category><![CDATA[castle]]></category>
		<category><![CDATA[nhibernate]]></category>
		<category><![CDATA[nservicebus]]></category>
		<category><![CDATA[spa2009]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=464</guid>
		<description><![CDATA[I just got the e-mail that my proposal for a session on Enterprise .NET Development with Opensource .NET tools was accepted for the Software practice advancement 2009 conference. The conference will take place in London in April 2009. This session will be presented as an experience report from several enteprise .NET projects I have been [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.spaconference.org/spa2009/uploads/images/spa2009/furniture/spa2009topleftlogo.gif" style="margin:5px 5px 5px 5px;" align="left"/> I just got the e-mail that my proposal for a session on <a href="http://www.spaconference.org/spa2009/sessions/session189.html">Enterprise .NET Development with Opensource .NET tools</a> was accepted for the <a href="http://www.spaconference.org/spa2009/">Software practice advancement 2009</a> conference. The conference will take place in London in April 2009. </p>
<p>This session will be presented as an experience report from several enteprise .NET projects I have been involved in over the course of the last two years, which all included extensive use of opensource tools. Most of the innovation today in software happens in the opensource community and it is driven by opensource tools, but the attitude of software companies in the .NET market towards opensource tools is a lot worse then in the Java world. Using opensource tools on .NET project allows us to harness the innovation years before equivalent commercial tools appear. It also causes a lot more political and personal opposition, from lawyers that are concerned about licensing to contractors who refuse to do it because &#8220;it&#8217;s not .NET&#8221;. In this session, I will present the benefits that my teams got from the Castle project stack, NServiceBus, NHibernate and the like, what problems we faced on the way, how we solved them, how to shorten the learning curve for people with a more traditional .NET background and how to convince managers and lawyers that this is not a danger for them.</p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2008/11/11/enterprise-net-development-with-opensource-net-tools-spa2009/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Opensource .NET talks schedule</title>
		<link>http://gojko.net/2008/08/27/opensource-net-talks-schedule/</link>
		<comments>http://gojko.net/2008/08/27/opensource-net-talks-schedule/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 20:51:12 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[alt.net]]></category>
		<category><![CDATA[castle]]></category>
		<category><![CDATA[gwt]]></category>
		<category><![CDATA[nservicebus]]></category>
		<category><![CDATA[script#]]></category>
		<category><![CDATA[skills matter]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[windsor]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=315</guid>
		<description><![CDATA[We have worked out the schedule for opensource .NET talks at Skills Matter in London for the next few months. Here are the dates to note in your calendar &#8211; more detail on sessions will follow: 25th September: Script #, .NET response to Google Web Toolkit. Registration is now open 23rd October: Dependency injection with [...]]]></description>
			<content:encoded><![CDATA[<p>We have worked out the schedule for opensource .NET talks at <a target="_blank" href="http://skillsmatter.com/go/open-source-dot-net">Skills Matter</a> in London for the next few months. Here are the dates to note in your calendar &#8211; more detail on sessions will follow:</p>
<ul>
<li>25th September: Script #, .NET response to Google Web Toolkit.<br />
<a target="_blank" href="http://skillsmatter.com/event/open-source-dot-net/script-the-dot-net-response-to-the-google-web-toolkit">Registration is now open</a></li>
<li>23rd October: Dependency injection with Castle Windsor</li>
<li>27th November: Asynchronous enterprise .NET applications with NServiceBus</li>
<li>17th December: Test driven development in .NET</li>
</ul>
<p>We will probably do another Alt.NET evening in January like the one this July. This time we&#8217;ll have more time and hopefully a bigger venue. At the moment, we have a slot on 13th Jan available for this. If you attended the July talks, please let me know what you thought of the way that we organised it, what you liked, what you disliked, and what we could do to make it better next time.</p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2008/08/27/opensource-net-talks-schedule/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Alt.Net evening in London</title>
		<link>http://gojko.net/2008/07/17/altnet-evening-in-london/</link>
		<comments>http://gojko.net/2008/07/17/altnet-evening-in-london/#comments</comments>
		<pubDate>Thu, 17 Jul 2008 14:48:49 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[presentations]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[alt.net]]></category>
		<category><![CDATA[catle]]></category>
		<category><![CDATA[nhibernate]]></category>
		<category><![CDATA[nservicebus]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[rhino]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=150</guid>
		<description><![CDATA[We are organising a gathering of Alt.Net enthusiasts on the 31st this month at Skills Matter offices. We&#8217;ll do seven talks in total with beer and pizza during the break, and then go out for beers and socialising. Here&#8217;s the programme for the talks: NHibernate &#8211; Ian Cooper PowerShell &#8211; Zi Makki OpenRasta &#8211; Sebastian [...]]]></description>
			<content:encoded><![CDATA[<p>We are organising a gathering of Alt.Net enthusiasts on the 31st this month at Skills Matter offices. We&#8217;ll do seven talks in total with beer and pizza during the break, and then go out for beers and socialising. Here&#8217;s the programme for the talks:</p>
<p>NHibernate &#8211; Ian Cooper<br />
PowerShell &#8211; Zi Makki<br />
OpenRasta &#8211; Sebastian Lambla<br />
Castle Windsor &#8211; Mike Hadlow<br />
Rhino Mocks &#8211; Chris Roff<br />
NServiceBus &#8211; David De Florinier<br />
Subversion &#8211; Gojko Adzic</p>
<p>The event is free but the number of places is limited. Apparently about half of the places are already taken and Skills Matter have not yet started to advertise it seriously, so if you were planning to come to the event make sure to register soon. For more info and to register <a href="http://skillsmatter.com/event/open-source-dot-net/alternative-tools-for-dot-net-development">click here</a>.</p>
<p>See you on 31st. </p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2008/07/17/altnet-evening-in-london/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
