<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.lostechies.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">PhatBoyG (Chris Patterson)</title><subtitle type="html">Coding from the Hood since &amp;#39;87</subtitle><id>http://www.lostechies.com/blogs/chris_patterson/atom.aspx</id><link rel="alternate" type="text/html" href="http://www.lostechies.com/blogs/chris_patterson/default.aspx" /><link rel="self" type="application/atom+xml" href="http://www.lostechies.com/blogs/chris_patterson/atom.aspx" /><generator uri="http://communityserver.org" version="4.1.30929.2835">Community Server</generator><updated>2008-11-21T11:52:38Z</updated><entry><title>I'm a Microsoft C# MVP!</title><link rel="alternate" type="text/html" href="/blogs/chris_patterson/archive/2009/07/01/i-m-a-microsoft-c-mvp.aspx" /><id>/blogs/chris_patterson/archive/2009/07/01/i-m-a-microsoft-c-mvp.aspx</id><published>2009-07-02T00:14:35Z</published><updated>2009-07-02T00:14:35Z</updated><content type="html">&lt;p&gt;Opening my Inbox this morning resulted in a pleasant surprise from Microsoft. I have been presented with the 2009 Microsoft&amp;reg; MVP Award as a recognition for sharing my expertise in Visual C# with others. It is an honor to be recognized by Microsoft for doing something that I truly enjoy - building really cool software.&lt;/p&gt;

&lt;div style="text-align:center;"&gt;&lt;img src="http://blog.phatboyg.com/wp-content/uploads/2009/07/mvpbanner.png" alt="MVPbanner.png" border="0" width="584" height="108" /&gt;&lt;/div&gt;

&lt;p style="text-align:center;"&gt;&lt;blockquote&gt;&lt;em&gt;Microsoft Most Valuable Professionals (MVPs) are exceptional technical community leaders from around the world who are awarded for voluntarily sharing their high quality, real world expertise in offline and online technical communities. Microsoft MVPs are a highly select group of experts that represents the technical community&amp;#39;s best and brightest, and they share a deep commitment to community and a willingness to help others.&lt;/em&gt;&lt;/blockquote&gt;
&lt;/p&gt;
&lt;p&gt;A community-based award like this would not be possible without the support of my peers, and I look forward to meeting up with some of those very peers at the next MVP Summit! In the meantime, congratulations to all the new and renewed MVPs!&lt;/p&gt;

&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=22573" width="1" height="1"&gt;</content><author><name>phatboyg</name><uri>http://www.lostechies.com/members/phatboyg/default.aspx</uri></author><category term=".net" scheme="http://www.lostechies.com/blogs/chris_patterson/archive/tags/.net/default.aspx" /><category term="c#" scheme="http://www.lostechies.com/blogs/chris_patterson/archive/tags/c_2300_/default.aspx" /></entry><entry><title>Dallas TechFest 2009 Tomorrow</title><link rel="alternate" type="text/html" href="/blogs/chris_patterson/archive/2009/06/18/dallas-techfest-2009-tomorrow.aspx" /><id>/blogs/chris_patterson/archive/2009/06/18/dallas-techfest-2009-tomorrow.aspx</id><published>2009-06-19T03:04:26Z</published><updated>2009-06-19T03:04:26Z</updated><content type="html">&lt;p&gt;It&amp;#39;s been a couple of busy weeks! The weekend before my presentations in Arkansas, I decided to forego sleep and go to &lt;a href="http://www.wakarusa.com/"&gt;Wakarusa&lt;/a&gt;! The Saturday lineup included two of my favorite electronica acts, &lt;a href="http://www.twistedmusic.com/artists/shpongle"&gt;Shpongle&lt;/a&gt; and &lt;a href="http://www.ottsonic.com/"&gt;Ott&lt;/a&gt;, and introduced to another band STS9. Staying up all night dancing to heavy techno music and getting no sleep was one heck of a prelude to the week. After the seriously fun times I stopped in on the Fort Smith and Northwest Arkansas .NET user groups and shared my thoughts on Event Driven Architecture. Both nights went well, with some great conversations afterwards about the how and why that took me towards that style of architectural system design.&lt;/p&gt;

&lt;p&gt;Tomorrow morning at 9:00 AM (hey, if you aren&amp;#39;t first, you&amp;#39;re last -- this is Texas after all) I&amp;#39;ll be presenting at Dallas TechFest on the same subject in the .NET track. If you want to learn more about Event Driven Architecture and how we are making it easier to implement with MassTransit, come by and check it out. I promise to deliver a demo that includes all sorts of cool things like NHibernate, FluentNHibernate, StructureMap, Castle, Topshelf, Magnum, and of course, MassTransit.&lt;/p&gt;

&lt;p&gt;Also, if you&amp;#39;re in the Tulsa area and weren&amp;#39;t able to make it to Dallas TechFest, I&amp;#39;ll be presenting at the Tulsa .NET User Group on the 29th of June as well. If you do come by, be sure to stop afterwards and say hello. I&amp;#39;ll be at the event throughout the day and am more than happy to talk to anyone interested in learning more about &lt;a href="http://code.google.com/p/masstransit/"&gt;MassTransit&lt;/a&gt;. I&amp;#39;m sure I&amp;#39;ll be around the functional programming open space playing with crazy monadic parsers written in C#.&lt;/p&gt;

&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=22197" width="1" height="1"&gt;</content><author><name>phatboyg</name><uri>http://www.lostechies.com/members/phatboyg/default.aspx</uri></author></entry><entry><title>Presenting on Event Driven Architecture and MassTransit</title><link rel="alternate" type="text/html" href="/blogs/chris_patterson/archive/2009/05/27/presenting-on-event-driven-architecture-and-masstransit.aspx" /><id>/blogs/chris_patterson/archive/2009/05/27/presenting-on-event-driven-architecture-and-masstransit.aspx</id><published>2009-05-28T02:57:29Z</published><updated>2009-05-28T02:57:29Z</updated><content type="html">&lt;div style="text-align:center;padding-bottom:12px;"&gt;&lt;h3&gt;Event Driven Architecture&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;Business applications no longer exist as isolated systems. In order to provide integrated solutions that add business value, applications must be connected. Modern approaches for enterprise application integration (EAI) such as Service Oriented Architecture (SOA) separate applications into services that can be accessed via a standard interface such as a web service. This collection of services provides a platform on which new applications can be created that leverage the existing functionality.
&lt;/p&gt;&lt;p&gt;
However, as application complexity increases, the coupling of services becomes an impediment in adapting applications to meet the ever-changing goals of the business. Event Driven Architecture (EDA) is a method of designing and implementing systems where events are exchanged between highly decoupled components and services. EDA does not replace SOA, instead it compliments the request/response nature of SOA with a highly scalable event model for building and coordinating asynchronous transactions.
&lt;/p&gt;&lt;p&gt;
In this presentation, I will explain event driven architecture, describe the different types of events, demonstrate how events can be related and orchestrated, and provide a basic understanding of how this method can drive the architecture of enterprise systems. In addition to understanding the concepts of event driven architecture, we will explore a working sample built using an open-source .NET messaging framework called MassTransit.
&lt;/p&gt;
&lt;p&gt;You can catch this presentation at the following events:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;On Monday, June 8th, I&amp;#39;ll be presenting at the &lt;a href="http://www.fsdnug.org/"&gt;Fort Smith .NET User Group&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;On Tuesday, June 9th, I&amp;#39;ll be presenting at the &lt;a href="http://nwadnug.org/tabid/54/ModuleID/370/ItemID/42/mctl/EventDetails/Default.aspx"&gt;Northwest Arkansas .NET User Group&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;On Friday, June 19th, I&amp;#39;ll be presenting at &lt;a href="http://www.dallastechfest.com/"&gt;Dallas TechFest 2009&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="text-align:center;padding-bottom:12px;"&gt;&lt;img src="http://blog.phatboyg.com/wp-content/uploads/2009/05/dallas-techfest-slide.png" alt="Dallas TechFest Slide.png" border="0" width="477" height="179" /&gt;&lt;/div&gt;
&lt;p&gt;If you are one or more of these events, be sure to come up and introduce yourself after the session. Also, if you have any feedback on the presentation, feel free to post your comments here or via e-mail.&lt;/p&gt;

&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=21277" width="1" height="1"&gt;</content><author><name>phatboyg</name><uri>http://www.lostechies.com/members/phatboyg/default.aspx</uri></author><category term=".net" scheme="http://www.lostechies.com/blogs/chris_patterson/archive/tags/.net/default.aspx" /><category term="masstransit" scheme="http://www.lostechies.com/blogs/chris_patterson/archive/tags/masstransit/default.aspx" /><category term="esb" scheme="http://www.lostechies.com/blogs/chris_patterson/archive/tags/esb/default.aspx" /></entry><entry><title>MassTransit Now Speaks XML By Default</title><link rel="alternate" type="text/html" href="/blogs/chris_patterson/archive/2009/05/27/masstransit-now-speaks-xml-by-default.aspx" /><id>/blogs/chris_patterson/archive/2009/05/27/masstransit-now-speaks-xml-by-default.aspx</id><published>2009-05-27T14:12:00Z</published><updated>2009-05-27T14:12:00Z</updated><content type="html">&lt;p&gt;&lt;strong&gt;Last night, I made a major update to the trunk of MassTransit that changes the default message format from binary to XML.&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Since the first drop of &lt;a href="http://code.google.com/p/masstransit/"&gt;MassTransit&lt;/a&gt;, the default format for messages was &lt;em&gt;binary&lt;/em&gt;. This had several advantages, one being the ability to take any object and just use it as a message. The BinaryFormatter in .NET is pretty hard core about making sure that the object will come out the other end without any changes. The disadvantage of using binary as a message format is it makes it very difficult to interoperate with other systems. For this reason, we are embracing XML as the new default message format.
&lt;/p&gt;
&lt;p&gt;
The road to XML was not easy. Many months ago when we opened up the endpoints to a configurable serialization format, we ran into some issues with our first attempt at XML. We used the .NET XmlSerializer at first, and found it to be too limited to meet our needs. There was no support for serializing dictionaries (which I would call a smell in your message contract anyway), and you had to register the type of every object being serialized in advance in order for it work properly. With all these problems, we continued to keep binary as the default with XML being experimental.
&lt;/p&gt;
&lt;p&gt;
I started writing a new XML serializer from the ground up nearly a year ago. I went through a lot of approaches and just didn&amp;#39;t find something that I liked using .NET 2.0 as the framework. I looked at a more Google Protocol Buffers technique for a while, but found it a little cumbersome to deal with compared to just using XML. Then, a month or two ago, I started to seriously look at how we could do a solid XML serialization attempt again using the .NET 3.5 framework features. From that research, the current default XML serializer was founded.
&lt;/p&gt;
&lt;p&gt;
Like many ORMs such as NHibernate, the use of the XML message serializer requires that the objects being serialized have a no-argument constructor. It can be protected to hide it from developers, but it must exist. Also, only properties are serialized as they represent the public contract that the message object is sharing. And the properties must be read/write so that the serializer can get and set the value of the property. Here is an example of one of our messages:
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;public class NewUserRegistered : 
	CorrelatedBy&amp;lt; Guid &amp;gt;
{
	public Guid CorrelationId { get; set; }
	public string Username { get; set; }
	public string Email { get; set; }
	public DateTime RegisteredAt { get; set; }
}
&lt;/pre&gt;
&lt;p&gt;
Since messages are DTOs (data transfer objects), I try to keep them clean and simple. They are pure data containers and are not meant to have any behavior associated with them. While I treat my messages as immutable, I don&amp;#39;t find I need to express that in the message class itself since it just tends to make the object more confusing. And quite honestly, there are better ways to express immutable message contracts, such as using interfaces.
&lt;/p&gt;
&lt;p&gt;
The resulting XML for the above message looks like:
&lt;/p&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;?xml encoding=&amp;quot;utf-8&amp;quot; version=&amp;quot;1.0&amp;quot;?&amp;gt;
&amp;lt;x:XmlMessageEnvelope 
	xmlns:x=&amp;quot;MassTransit.Serialization.XmlMessageEnvelope, MassTransit&amp;quot;
	xmlns:m=&amp;quot;MassTransit.Tests.Serialization.NewUserRegistered, MassTransit.Tests&amp;quot; 
	xmlns:s=&amp;quot;System.String, mscorlib&amp;quot; 
	xmlns:d=&amp;quot;System.DateTime, mscorlib&amp;quot; 
	xmlns:g=&amp;quot;System.Guid, mscorlib&amp;quot; 
	xmlns:i=&amp;quot;System.Int32, mscorlib&amp;quot;&amp;gt;
  &amp;lt;m:Message&amp;gt;
    &amp;lt;s:Username&amp;gt;billg&amp;lt;/s:Username&amp;gt;
    &amp;lt;s:Email&amp;gt;billg@microsoft.com&amp;lt;/s:Email&amp;gt;
    &amp;lt;d:RegisteredAt &amp;gt;2009-05-27T13:50:21.106875Z&amp;lt;/d:RegisteredAt&amp;gt;
    &amp;lt;g:CorrelationId &amp;gt;acb709df-7e32-45e2-a48c-9c160091aa5d&amp;lt;/g:CorrelationId&amp;gt;
  &amp;lt;/m:Message&amp;gt;
  &amp;lt;s:SourceAddress &amp;gt;loopback://localhost/source&amp;lt;/s:SourceAddress&amp;gt;
  &amp;lt;s:DestinationAddress &amp;gt;loopback://localhost/destination&amp;lt;/s:DestinationAddress&amp;gt;
  &amp;lt;s:MessageType &amp;gt;MassTransit.Tests.Serialization.NewUserRegistered, MassTransit.Tests&amp;lt;/s:MessageType&amp;gt;
&amp;lt;/x:XmlMessageEnvelope&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
Namespaces are created for each type of object that is serialized. This makes it fast and easy for the deserialization process to figure out what type to use when reading the value from the XML. It&amp;#39;s easy to look and see the actual data that belongs to the message, as well as the headers used by MassTransit.
&lt;/p&gt;
&lt;p&gt;
I wanted to post this as quickly as possible after committing the changes to the trunk so I will wrap up. I&amp;#39;m pretty excited about having a nice, readable message format. Since finding &lt;a href="http://www.geekproject.com/tools.aspx#10"&gt;MSMQ Studio&lt;/a&gt;, I&amp;#39;ve really wanted to improve the diagnosis story for looking at messages inside the queues. I think this is a solid move towards that goal and a great first steps towards interoperability with other systems.
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=21254" width="1" height="1"&gt;</content><author><name>phatboyg</name><uri>http://www.lostechies.com/members/phatboyg/default.aspx</uri></author><category term=".net" scheme="http://www.lostechies.com/blogs/chris_patterson/archive/tags/.net/default.aspx" /><category term="masstransit" scheme="http://www.lostechies.com/blogs/chris_patterson/archive/tags/masstransit/default.aspx" /><category term="msmq" scheme="http://www.lostechies.com/blogs/chris_patterson/archive/tags/msmq/default.aspx" /></entry><entry><title>MassTransit Saga Enhancements for Event Processing</title><link rel="alternate" type="text/html" href="/blogs/chris_patterson/archive/2009/05/22/masstransit-saga-enhancements-for-event-processing.aspx" /><id>/blogs/chris_patterson/archive/2009/05/22/masstransit-saga-enhancements-for-event-processing.aspx</id><published>2009-05-23T02:32:18Z</published><updated>2009-05-23T02:32:18Z</updated><content type="html">&lt;p&gt;In the past year, I&amp;#39;ve been learning about &lt;a href="http://en.wikipedia.org/wiki/Event_Driven_Architecture"&gt;Event Driven Architecture&lt;/a&gt; and how using it in the enterprise can make adding functionality over time easier through a loosely-coupled event-based architecture. With Event Driven Architecture, business components can subscribe and react to events, using correlation and orchestration to combine those events to represent business processes. The loose-coupled nature makes it easier to add functionality without modifying existing services -- reducing the risk of deploying new services over time.
&lt;/p&gt;&lt;p&gt;
When I first added saga support to &lt;a href="http://code.google.com/p/masstransit/"&gt;MassTransit&lt;/a&gt;, the focus was purely on allowing for long-lived transactions and the orchestration of a series of events that related to a specific process. Earlier this year, the first release of a new declarative programming style for sagas using a fluent interface was put into the trunk, making it possible to design sagas using a more natural structure and language. This feature alone is one of the more compelling things about sagas in MassTransit.
&lt;/p&gt;&lt;p&gt;
Over the past month or so, I&amp;#39;ve been working on extending the capabilities of sagas in MassTransit beyond the orchestration of directly correlated events (represented as messages). With the latest updates to the trunk, messages that are not directly correlated to the saga can now be observed by the saga using either the interface-based or declarative state machine based saga syntax. This makes for some very compelling functionality as sagas can now &lt;em&gt;observe&lt;/em&gt; other events and react to them!
&lt;/p&gt;&lt;p&gt;
Let&amp;#39;s take a quick look at the syntax using the state machine syntax using a simple message indicating a user has signed out.
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
public class UserSignedOut
{
	public string Username { get; set; }
}
&lt;/pre&gt;
&lt;p&gt;
This message only contains the username of the user that signed out of the system. If we had a saga that tracked the state of an operation on a web site based on the current user, we could observe this message and release any resources that were being tracked by the saga. For example:
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
public class ShoppingCartSaga : 
	SagaStateMachine
{
	static ShoppingCartSaga()
	{
		Define(()=&amp;gt;
		{
			Correlate(UserSignedOut).By((saga,message) =&amp;gt; saga.Username == message.Username);
	
			During(Active,
				When(UserSignedOut)
					.Then(saga =&amp;gt; saga.ReturnCartItemsToInventory())
					.Complete());
		};
	}

	public static Event UserSignedOut { get; set; }
}
&lt;/pre&gt;
&lt;p&gt;
The Correlate() method is used to define the correlation expression used to match a message to one or more sagas in the saga repository. With this addition, the &lt;a href="http://code.google.com/p/masstransit/source/browse/trunk/MassTransit/Saga/ISagaRepository.cs"&gt;ISagaRepository&lt;/a&gt; has been changed to make it more integrated into the message pipeline, along with the new pipeline message sinks to support this enhanced functionality. The pipeline viewer has also been updated to show the contents of the message pipeline, including all the messages handled by the saga. The Correlate() method can also be used to change how a &lt;a href="http://code.google.com/p/masstransit/source/browse/trunk/MassTransit/CorrelatedBy.cs"&gt;CorrelatedBy&lt;/a&gt; message is also correlated to the saga, making it possible to override the logic on how messages are used to create/use existing saga instances. 
&lt;/p&gt;&lt;p&gt;
The first use case for this new functionality was to improve the subscription service. By making Subscription and SubscriptionClient sagas observe messages from each other, the sagas are able to now complete when they see a node coming back online after a crash or going offline, etc. Since the saga repositories themselves are used to keep track of all the clients and subscriptions in the system, putting that responsibility within the declaration of the saga state machine itself makes for a really clean implementation.
&lt;/p&gt;&lt;p&gt;
These bits are currently in the trunk and will be part of the next release drop of MassTransit. I encourage you to check them out and provide some feedback on any issues. Some of this may be extended soon to also allow for the custom definition of the policy associated with how messages should be applied to sagas, such as always creating a new instance or using an existing instance of a saga. Some conventions are currently in place based on the Initial state that select a default saga policy (check out &lt;a href="http://code.google.com/p/masstransit/source/browse/trunk/MassTransit/Saga/ISagaPolicy.cs"&gt;ISagaPolicy&lt;/a&gt; and the classes that implement it for more details there).
&lt;/p&gt;&lt;p&gt;
So check it out and keep the great feedback and comments coming on the message group. The new syntax additions should be added to the &lt;a href="http://masstransit.pbworks.com/"&gt;wiki&lt;/a&gt; soon.
&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=21187" width="1" height="1"&gt;</content><author><name>phatboyg</name><uri>http://www.lostechies.com/members/phatboyg/default.aspx</uri></author></entry><entry><title>I'm Down With M.V.C., Yeah You Know Me!</title><link rel="alternate" type="text/html" href="/blogs/chris_patterson/archive/2009/05/10/i-m-down-with-m-v-c-yeah-you-know-me.aspx" /><id>/blogs/chris_patterson/archive/2009/05/10/i-m-down-with-m-v-c-yeah-you-know-me.aspx</id><published>2009-05-11T01:48:01Z</published><updated>2009-05-11T01:48:01Z</updated><content type="html">&lt;p&gt;Over the past week, I&amp;#39;ve had some time to dig into the new &lt;a href="http://www.asp.net/mvc/"&gt;ASP.NET MVC framework&lt;/a&gt;. For starters, my background in web development is mostly classic ASP talking to COM objects built in C++. I&amp;#39;ve only used ASP.NET to provide web services for smart clients. Beyond that, my experience has been all PHP joined by a short experimentation period with Ruby on Rails. When Scott Gu presented the new ASP.NET MVC framework at the first ALT.NET Austin in 2007, I was excited to see Microsoft stepping into the space where at the time Monorail was the only viable choice.&lt;/p&gt;

&lt;p&gt;First things first -- the benefit of waiting until now to jump into ASP.NET MVC is being able to learn from the writing that has been produced. Jimmy Bogard has &lt;a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/04/24/how-we-do-mvc.aspx"&gt;written&lt;/a&gt; a number of articles about how they are using the MVC framework, including strong opinions about how to adhere to the SOLID principles and ensure the long-term maintainability of the final application. Jeremy Miller and Chad Myers have certainly &lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2008/10/23/our-opinions-on-the-asp-net-mvc-introducing-the-thunderdome-principle.aspx"&gt;voiced&lt;/a&gt; their &lt;a href="http://www.lostechies.com/blogs/chad_myers/archive/2009/04/27/to-mvc-or-to-webforms.aspx"&gt;opinions&lt;/a&gt; about the framework, resulting in their own &lt;a href="http://code.google.com/p/fubumvc/"&gt;FubuMVC&lt;/a&gt; framework.&lt;/p&gt;

&lt;p&gt;From my initial dive into the framework, it seems as if an emphasis was put on the View and Controller while leaving the Model a bit behind. Views and controllers are certainly easier to demonstrate, but a good model is going to be very domain specific and hard to generalize in a demo. The framework does make it easy to keep the domain and application services separate from both the controllers and the views, so I think the underpinnings for success are certainly present.&lt;/p&gt;

&lt;p&gt;At this point, I&amp;#39;ve only been working with ASP.NET MVC for about a week and I am enthusiastic about what is being provided by Microsoft. Considering Microsoft&amp;#39;s efforts to work with the development community during the development of the framework combined with developer interest, I think it is a sensible solution and certainly a better alternative to ASP.NET WebForms in a .NET development shop. Plus, I feel that web developers &lt;strong&gt;should&lt;/strong&gt; know both HTML and JavaScript, they are the languages of the web after all.&lt;/p&gt;

&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=20914" width="1" height="1"&gt;</content><author><name>phatboyg</name><uri>http://www.lostechies.com/members/phatboyg/default.aspx</uri></author><category term="altdotnet" scheme="http://www.lostechies.com/blogs/chris_patterson/archive/tags/altdotnet/default.aspx" /><category term=".net" scheme="http://www.lostechies.com/blogs/chris_patterson/archive/tags/.net/default.aspx" /></entry><entry><title>Declarative Workflow with MassTransit</title><link rel="alternate" type="text/html" href="/blogs/chris_patterson/archive/2009/04/07/declarative-workflow-with-masstransit.aspx" /><id>/blogs/chris_patterson/archive/2009/04/07/declarative-workflow-with-masstransit.aspx</id><published>2009-04-08T01:53:36Z</published><updated>2009-04-08T01:53:36Z</updated><content type="html">&lt;p&gt;One of the really cool features that is available in the 0.6 release of MassTransit is the ability to declaratively define a saga/workflow using a nested-closure syntax in combination with a fluent builder. While some wonder if fluent interfaces are going to &lt;a href="http://odetocode.com/Blogs/scott/archive/2009/03/16/12651.aspx"&gt;become the &amp;quot;aluminum wiring&amp;quot;&lt;/a&gt; of the current generation of software development, I find them incredible valuable for building an expressive representation of logic.
&lt;/p&gt;&lt;p&gt;
A saga is a way of defining a long-lived transaction, typically involving multiple transactional actors. A workflow is a way of orchestrating a number of actors into a process. Both sagas and workflows can be modeled using the new declarative syntax. First, let&amp;#39;s look at what this new language looks like in code:
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
static DrinkPreparationSaga()
{
	Define(() =&amp;gt;
		{
			Initially(
				When(NewOrder)
					.Then((saga, message) =&amp;gt; saga.ProcessNewOrder(message))
					.TransitionTo(WaitingForPayment)
				);

			During(WaitingForPayment,
			       When(PaymentComplete)
			       	.Then((saga, message) =&amp;gt;
			       		{
			       			Console.WriteLine(&amp;quot;Payment Complete for &amp;#39;{0}&amp;#39; got it!&amp;quot;, saga.Name);
			       			saga.ServeDrink();
			       		})
			       	.Complete()
				);
		});
}
&lt;/pre&gt;
&lt;p&gt;
&lt;em&gt;(I&amp;#39;ve removed the class structure around the constructor to keep the code short)&lt;/em&gt;
&lt;/p&gt;&lt;p&gt;
If we read from the top down, it is easy to understand the behavior for this saga. Initially (which signifies the creation of a new saga based on an event in this block), when a NewOrder is received, then we&amp;#39;re going to call the ProcessNewOrder method on the saga passing it the message that was received. Once that method completes, the saga will transition to the WaitingForPayment state. During the WaitingForPayment state, if a PaymentComplete is received, the saga will output a message, call the ServeDrink method on the saga, and complete.
&lt;/p&gt;&lt;p&gt;
The states and events of the saga are defined by adding some static properties to the class:
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
public static State Initial { get; set; }
public static State Completed { get; set; }
public static State PreparingDrink { get; set; }
public static State WaitingForPayment { get; set; }

public static Event NewOrder { get; set; }
public static Event PaymentComplete { get; set; }
&lt;/pre&gt;
&lt;p&gt;
The static constructor for the state machine initializes these properties during the definition of the behavior as part of the Define() call. It is nice to be able to see all the states and events for the saga in one place, as well as the messages that are related to the events.
&lt;/p&gt;&lt;p&gt;
Another great feature allows us to ask the saga state machine engine to tell us what it is going to do based on how we defined the behavior of the saga. The StateMachineInspector class is a tool that will output a trace of the defined behavior of the state machine. For the above saga, the output looks like:
&lt;/p&gt;&lt;p&gt;
&lt;pre&gt;
	During Initial
		When NewOrder Occurs Containing NewOrderMessage
			(custom action)
			Transition To WaitingForPayment
	During PreparingDrink
	During WaitingForPayment
		When PaymentComplete Occurs Containing PaymentCompleteMessage
			(custom action)
			Transition To Completed
	During Completed
&lt;/pre&gt;
&lt;/p&gt;&lt;p&gt;
This information is generated by using expressions and reflecting over the class and types contained. The above example is taken from the Starbucks example in the MassTransit trunk. For a service to subscribe and handle sagas like this, the service only needs to call:
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
var unsubscribe = bus.Subscribe();
&lt;/pre&gt;
&lt;p&gt;
Like all component-based consumers in MassTransit, the container should know how to build the saga and needs to have a ISagaRepository implementation for the saga as well.
&lt;/p&gt;&lt;p&gt;
I hope as more people start to use this syntax that it evolves in a really rich was of doing code-first workflow and saga definitions. One thing we definitely want to do is take the text-based visualization of the saga and output it in a format that can be used by GraphViz or MSGLEE to get a nice diagram of the behavior of the saga. Hopefully that will be coming sooner rather than later!
&lt;/p&gt;&lt;p&gt;
So that&amp;#39;s one of the really cool features of MassTransit that have been added.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=20181" width="1" height="1"&gt;</content><author><name>phatboyg</name><uri>http://www.lostechies.com/members/phatboyg/default.aspx</uri></author><category term=".net" scheme="http://www.lostechies.com/blogs/chris_patterson/archive/tags/.net/default.aspx" /></entry><entry><title>MassTransit 0.6 Release Candidate</title><link rel="alternate" type="text/html" href="/blogs/chris_patterson/archive/2009/03/30/masstransit-0-6-release-candidate.aspx" /><id>/blogs/chris_patterson/archive/2009/03/30/masstransit-0-6-release-candidate.aspx</id><published>2009-03-31T02:17:51Z</published><updated>2009-03-31T02:17:51Z</updated><content type="html">&lt;p&gt;
I&amp;#39;m proud to announce that we are getting close to a final 0.6 release of &lt;a href="http://code.google.com/p/masstransit/"&gt;MassTransit&lt;/a&gt;. We&amp;#39;ve been working on this release since early December and have added a lot of new functionality. We&amp;#39;re also glad to have integrated a number of patches that the community has contributed -- thanks for your help!
&lt;/p&gt;&lt;p&gt;
If you are currently developing with MassTransit, please check out the new bits and give us feedback. The trunk contains all of the latest code. &lt;a href="http://masstransit.googlecode.com/files/masstransit-0.6RC1-r1829-src.zip"&gt;A snapshot of the trunk&lt;/a&gt;, along with a &lt;a href="http://masstransit.googlecode.com/files/masstransit-0.6RC1-r1829.zip"&gt;0.6 RC1 build&lt;/a&gt; have been added to the &lt;a href="http://code.google.com/p/masstransit/"&gt;GoogleCode&lt;/a&gt; site. If you have any problems, comments, suggestions, or patches please post them to the &lt;a href="http://groups.google.com/group/masstransit-discuss"&gt;Google Group for MassTransit&lt;/a&gt;. We&amp;#39;re interested in all experiences, good, bad, or otherwise.
&lt;/p&gt;&lt;p&gt;
A quick run down of the changes includes:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Message Pipeline&lt;/strong&gt;&lt;br /&gt;
The message pipeline is a replacement for the message dispatcher, as well as the cache-based publishing and subscribing bits. This new pipeline is built using a pipes-and-filter approach and is dynamically adjusted as subscriptions are added and removed -- both locally and by remote services.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Saga State Machine&lt;/strong&gt;&lt;br /&gt;
With the all new method of defining sagas using a state/event fluent interface, it is now even easier to describe the business logic of a process and the events from which it is built. With the new state machine, it is not necessary to have message consumers and interfaces on your saga, you can just define the events in the class and they are wired automatically by the subscription framework. The early version of the syntax was discussed &lt;a href="http://blog.phatboyg.com/2009/01/16/state-machine-for-managing-sagas/"&gt;in this post&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Better Request/Response Support&lt;/strong&gt;&lt;br /&gt;
The old bus.Request() syntax has been replaced with a new fluent style for making requests and waiting for responses. Both synchronous and asynchronous calling conventions are supported. Look for the new bus.MakeRequest extension method for more information on this slick new syntax.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code-based Configuration Syntax&lt;/strong&gt;&lt;br /&gt;
A new, code-based method of configuring and running a service bus has been added. This syntax significantly simplifies getting started with MassTransit and has been used throughout the unit tests. The facilities for Castle have also been updated to transparently use this new syntax with the same XML-style configuration in Windsor. More details on this syntax can be &lt;a href="http://blog.phatboyg.com/2008/12/21/simplified-masstransit-configuration/"&gt;found here&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Message Headers&lt;/strong&gt;&lt;br /&gt;
Messages are now wrapped in an envelope and headers are associated with the message. The pipeline will add certain headers, and additional headers can be added by the message publisher using an extension method to the IServiceBus.Publish and IEndpoint.Send methods. Header properties such as ResponseAddress, FaultAddress, DestinationAddress, and SourceAddress make some more advanced routing options available. All three message serializers support the message headers. Which brings me to...
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Binary, XML, and JSON Message Serializers&lt;/strong&gt;&lt;br /&gt;
All three serializers can now be configured for use as the wire message format.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Topshelf Integration&lt;/strong&gt;&lt;br /&gt;
The old MassTransit.Host has been replaced with the easier to use &lt;a href="http://code.google.com/p/topshelf/"&gt;Topshelf&lt;/a&gt; service hosting framework. 
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unsubscribe via Delegate&lt;/strong&gt;&lt;br /&gt;
The Unsubscribe methods on IServiceBus have been removed. When Subscribe is called, an UnsubscribeAction is returned instead. This delegate should be called when the subscription is no longer needed. This makes it easier to modify the state of the service bus in response to subscribe/unsubscribe actions by maintaining all of the information needed to unsubscribe in a lambda expression. The UnsubscribeAction is a delegate, and multiple unsubscribe handlers can be added together via the += operator. You can also use the extension method to get an IDisposable version of the subscription.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Redesigned Subscription Service&lt;/strong&gt;&lt;br /&gt;
The subscription service and client have been rewritten to take advantage of the new saga syntax. This reduces the number of specialized components needed for each service, as well as leveraging the features of MassTransit internally. Check out the SubscriptionManagerGUI in the WinFormSample for a demonstration of the service, as well as the pre-built services for use in your production environment.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Starbucks Sample Updated&lt;/strong&gt;&lt;br /&gt;
The Starbucks example has been updated to use the new saga state machines as well as some housekeeping updates to use the new features. Be sure to check it out as a starting point for understanding sagas and how to interact with them. Details on how to get the Starbucks sample running &lt;a href="http://masstransit.pbwiki.com/starbucks"&gt;are on the wiki&lt;/a&gt;.
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
We&amp;#39;re hoping to get an official 0.6 release in the next couple of weeks, so please provide any feedback you have to help us wrap it up. You can get the bits, including a &lt;a href="http://masstransit.googlecode.com/files/masstransit-0.6RC1-r1829-src.zip"&gt;source&lt;/a&gt; and &lt;a href="http://masstransit.googlecode.com/files/masstransit-0.6RC1-r1829.zip"&gt;binary&lt;/a&gt; distribution &lt;a href="http://code.google.com/p/masstransit/downloads/list"&gt;here&lt;/a&gt;.
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=20078" width="1" height="1"&gt;</content><author><name>phatboyg</name><uri>http://www.lostechies.com/members/phatboyg/default.aspx</uri></author><category term=".net" scheme="http://www.lostechies.com/blogs/chris_patterson/archive/tags/.net/default.aspx" /></entry><entry><title>Dr. Dru and PhatBoyG On Elegant Code Cast</title><link rel="alternate" type="text/html" href="/blogs/chris_patterson/archive/2009/03/19/dr-dru-and-phatboyg-on-elegant-code-cast.aspx" /><id>/blogs/chris_patterson/archive/2009/03/19/dr-dru-and-phatboyg-on-elegant-code-cast.aspx</id><published>2009-03-19T04:41:39Z</published><updated>2009-03-19T04:41:39Z</updated><content type="html">&lt;p&gt;Just over a week ago, &lt;a href="http://drusellers.codebetter.com/"&gt;Dru Sellers&lt;/a&gt; and I recorded a podcast with &lt;a href="http://elegantcode.com/"&gt;Elegant Code&lt;/a&gt;rs &lt;a href="http://elegantcode.com/about/jarod-ferguson/"&gt;Jarod Ferguson&lt;/a&gt; and &lt;a href="http://elegantcode.com/about/david-starr/"&gt;David Starr&lt;/a&gt;. We spent a couple of hours discussing &lt;a href="http://en.wikipedia.org/wiki/Event_Driven_Architecture"&gt;event driven architecture&lt;/a&gt; (EDA), messaging, and &lt;a href="http://code.google.com/p/masstransit/"&gt;MassTransit&lt;/a&gt;. Through the magic of editing, they managed to end up with a solid eighty minutes (most likely to achieve a straight up &lt;a href="http://www.urbandictionary.com/define.php?term=G"&gt;G&lt;/a&gt; rating). &lt;/p&gt;

&lt;p&gt;&lt;a href="http://elegantcode.com/2009/03/18/code-cast-25-masstransit/"&gt;Check it out on their web site&lt;/a&gt; (where you can listen, or subscribe via iTunes/PodCastRSS).&lt;/p&gt;

&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=19938" width="1" height="1"&gt;</content><author><name>phatboyg</name><uri>http://www.lostechies.com/members/phatboyg/default.aspx</uri></author><category term=".net" scheme="http://www.lostechies.com/blogs/chris_patterson/archive/tags/.net/default.aspx" /></entry><entry><title>Developing for the iPhone</title><link rel="alternate" type="text/html" href="/blogs/chris_patterson/archive/2009/02/08/developing-for-the-iphone.aspx" /><id>/blogs/chris_patterson/archive/2009/02/08/developing-for-the-iphone.aspx</id><published>2009-02-09T00:01:05Z</published><updated>2009-02-09T00:01:05Z</updated><content type="html">&lt;p&gt;First, one my the reasons I love using OSX: 16 applications open including 4 Xcode projects, Photoshop, Numbers, Evernote, Mindjet MindManager, and more without a hint of slowdown and still 1.3 GB free (4GB total on my MBP). It&amp;#39;s wide, because I use a 24&amp;quot; display next to my built-in laptop display.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://blog.phatboyg.com/wp-content/uploads/2009/02/widedesktop.jpg" alt="WideDesktop.jpg" border="0" width="640" height="229" /&gt;&lt;/p&gt;

&lt;p&gt;I&amp;#39;ve been doing a lot of work in Xcode lately, building an application for the iPhone. I officially joined the developer program this past weekend, making it possible to load applications into my phone for testing. I&amp;#39;ve got a few ideas for some applications that I haven&amp;#39;t seen done yet, so hopefully I can get something out there to fill the void.&lt;/p&gt;

&lt;p&gt;I have to say, the more I work in Objective-C, the more I like it. Sure, I&amp;#39;m missing a few things like all my comfortable frameworks and such, but there are plenty of other ways to deal with things I&amp;#39;ve coming across. And since the NDA, sites like &lt;a href="http://www.stackoverflow.com/"&gt;Stack Overflow&lt;/a&gt; have become a great resource for getting answers to issues I come across.&lt;/p&gt;

&lt;p&gt;I&amp;#39;m still working on my other projects like MassTransit, this is just something to broaden my knowledge and have fun at the same time. Between developing on the iPhone, doing Java projects at work, and building open-source .NET frameworks at home -- I&amp;#39;ve got plenty to keep me busy!&lt;/p&gt;




&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=16198" width="1" height="1"&gt;</content><author><name>phatboyg</name><uri>http://www.lostechies.com/members/phatboyg/default.aspx</uri></author><category term="osx" scheme="http://www.lostechies.com/blogs/chris_patterson/archive/tags/osx/default.aspx" /></entry><entry><title>State Machine for Managing Sagas</title><link rel="alternate" type="text/html" href="/blogs/chris_patterson/archive/2009/01/16/state-machine-for-managing-sagas.aspx" /><id>/blogs/chris_patterson/archive/2009/01/16/state-machine-for-managing-sagas.aspx</id><published>2009-01-17T04:42:00Z</published><updated>2009-01-17T04:42:00Z</updated><content type="html">&lt;p&gt;MassTransit supports sagas, which are long-lived transactions consisting of multiple events. The saga support makes it easy to orchestrate the events into a process, but it doesn&amp;#39;t do much to help with state management. Since state management is fairly common, I felt it necessary to add some support for a state machine.
&lt;/p&gt;
&lt;p&gt;
In MassTransit, a &lt;em&gt;saga&lt;/em&gt; is defined by creating a class and attaching some interfaces for the messages that will be consumed. The messages are the &lt;em&gt;events&lt;/em&gt;, and the class is the saga. An example saga is shown below.
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre style="width:626px;height:104px;margin:2px;" class="csharp" name="code"&gt;   public class DrinkPreparationSaga :
        InitiatedBy &amp;lt; NewOrderMessage &amp;gt;,
        Orchestrates &amp;lt; PaymentCompleteMessage &amp;gt;,
        ISaga
    {
        public void Consume(NewOrderMessage message)
        {
        }
        public void Consume(PaymentCompleteMessage message)
        {
        }
    }
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
I&amp;#39;ve omitted the code for each consumer to keep it short, but the business logic defined would handle the fact that once the drink is prepared, it should not be served until the PaymentCompleteMessage has been received. Storing this state is an application concern.
&lt;/p&gt;
&lt;p&gt;
While I was &lt;a href="http://blog.phatboyg.com/2008/11/21/qcon-in-san-francisco-getting-started/"&gt;at QCon San Francisco&lt;/a&gt;, I attended a tutorial session on DSLs. It was here that I got the idea to somehow make a DSL for defining the behavior of a state machine that could be used with sagas in MassTransit. It&amp;#39;s taken a couple of months, but I think I&amp;#39;ve managed to put something together that simplifies state management in sagas. With the addition of a new state machine in Magnum, along with persistence support for NHibernate, it is now easy to manage this state automatically. 
&lt;/p&gt;
&lt;p&gt;
To demonstrate this, below is the state machine for the above process.
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class="csharp" name="code"&gt;	public class DrinkPreprationStateMachine :
		StateMachine &amp;lt; DrinkPreprationStateMachine &amp;gt;,
		ISaga,
		InitiatedBy &amp;lt; NewOrderMessage &amp;gt;,
		Orchestrates &amp;lt; PaymentCompleteMessage &amp;gt;,
		Orchestrates &amp;lt; DrinkPreparedMessage &amp;gt;
	{
		static DrinkPreprationStateMachine()
		{
			Define(() =&amp;gt;
				{
					Initially(
						When(NewOrder)
							.Then(saga =&amp;gt;
								{
									// start preparing the drink
								})
							.TransitionTo(PreparingDrink));
					During(PreparingDrink,
						When(DrinkPrepared)
					       	.TransitionTo(WaitingForPayment),
						When(PaymentComplete)
					       	.TransitionTo(WaitingForDrink));
					During(WaitingForPayment,
					    When(PaymentComplete)
					       	.Then(saga =&amp;gt;
					       		{
					       			// publish drink ready message
					       		})
					       	.Complete());
					During(WaitingForDrink,
						When(DrinkPrepared)
					       	.Then(saga =&amp;gt;
					       		{
					       			// publish drink ready message
					       		})
					       	.Complete());
				});
		}
		// event and state definitions not shown, but are simple properties
	}
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
As shown above, all the logic of states, events, and transitions is wrapped into a clean fluent interface. The During() blocks define what is to be done when events are received during a particular state. The When() blocks define the behavior when the specified events occur. All state transitions are explicit, allowing them to be captured as part of the state machine. 
&lt;/p&gt;
&lt;p&gt;
There are two types of events. BasicEvent supports an event without any accompanying data. The DataEvent &amp;lt; V &amp;gt; allows data to be associated with an event. In MassTransit, each DataEvent would have a matching Consume() handler. For example, &lt;em&gt;Event &amp;lt; NewOrder &amp;gt;&lt;/em&gt; would have a &lt;em&gt;public void Consume(NewOrder message)&lt;/em&gt; that would call &lt;em&gt;RaiseEvent(NewOrderEvent, message)&lt;/em&gt; to pass the event to the state machine along with the message. 
&lt;/p&gt;
&lt;p&gt;
The state machine also supports inspection, allowing the definition to be output for verification that the intent was properly conveyed by the interface. This not only makes it possible to verify the flow between states, but also could allow the creation of a graph to display the states, events, and transitions in a visual manner. The provided state machine inspector currently only outputs to the trace window, but could easily be enhanced by somebody with some skills.
&lt;/p&gt;
&lt;p&gt;
Also, not shown above, is the ability to specify an expression using the .And() method to evaluate the data associated with an event to determine if that event is handled by that state event action. This expression is kept as an expression, allowing the details to be output using the inspector as well.
&lt;/p&gt;
&lt;p&gt;
Currently, the saga must still implement the Consume() method for each message and call RaiseEvent() on the state machine to pass the message and trigger the event. I plan to add some new message sinks to the message pipeline to make those methods unnecessary, mapping the messages directly into the event handlers within the state machine. This isn&amp;#39;t done yet, but it is planned.
&lt;/p&gt;
&lt;p&gt;
The StateMachine also provides an IUserType implementation for NHibernate in the Magnum.Infrastructure assembly. This makes it easy to persist the state using NHibernate, storing the current state as a string. This is just the default implementation, any other could be built if your needs are different.
&lt;/p&gt;
&lt;p&gt;
I originally presented this syntax during the &lt;a href="http://zachariahyoung.com/zy/post/2009/01/Recording-for-VAN-meeting-on-1709.aspx"&gt;Virtual ALT.NET meeting last week&lt;/a&gt;. It was a last minute presentation, so I wasn&amp;#39;t sure I covered all the details. Hopefully this will help provide some guidance on how it is used, along with plans for the future.
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=13666" width="1" height="1"&gt;</content><author><name>phatboyg</name><uri>http://www.lostechies.com/members/phatboyg/default.aspx</uri></author><category term=".net" scheme="http://www.lostechies.com/blogs/chris_patterson/archive/tags/.net/default.aspx" /><category term="masstransit" scheme="http://www.lostechies.com/blogs/chris_patterson/archive/tags/masstransit/default.aspx" /></entry><entry><title>MassTransit Turns One Year Old, Celebrations Held Around the World</title><link rel="alternate" type="text/html" href="/blogs/chris_patterson/archive/2008/12/26/masstransit-turns-one-year-old-celebrations-held-around-the-world.aspx" /><id>/blogs/chris_patterson/archive/2008/12/26/masstransit-turns-one-year-old-celebrations-held-around-the-world.aspx</id><published>2008-12-26T16:20:06Z</published><updated>2008-12-26T16:20:06Z</updated><content type="html">&lt;p&gt;&lt;img src="http://blog.phatboyg.com/wp-content/uploads/2008/12/ndf03569.jpg" alt="NDF03569.jpg" border="0" width="640" height="503" /&gt;&lt;/p&gt;

&lt;p&gt;Today marks the one year anniversary of the first commit to the &lt;a href="http://code.google.com/p/masstransit/"&gt;MassTransit GoogleCode repository&lt;/a&gt;. While &lt;a href="http://blog.acuriousmind.com/"&gt;Dru Sellers&lt;/a&gt; and I initially did some proof of concept work, this day marks the decision to go forward with a standalone .NET messaging framework.&lt;/p&gt;

&lt;p&gt;MassTransit was started as a collaborative effort to provide a lightweight messaging framework on MSMQ for .NET applications. Both Dru and I needed a framework for asynchronous messaging to address some work-related application requirements. While MSMQ is provided out of the box, it doesn&amp;#39;t directly encourage some good distributed application practices such a loose coupling. Our goal was to abstract the messaging aspects so the services could be built to deal with plain old objects (POCOs) instead of lower level transport messages.&lt;/p&gt;

&lt;p&gt;Originally, we both looked at &lt;a href="http://www.nservicebus.com/"&gt;NServiceBus&lt;/a&gt; as a way to make this happen. I&amp;#39;ve followed Udi&amp;#39;s blog for a while and have really gained a lot of knowledge from his posts and presentations. However, our lack of experience in Spring.NET, along with a general lack of understanding of all the complexity of such a framework led us down the path of building our own framework.&lt;/p&gt;

&lt;p&gt;So that&amp;#39;s how MassTransit got started. A year later we&amp;#39;re still improving the code and providing useful functionality for developers to build loosely-coupled asynchronous applications. We&amp;#39;ve even harvested some common functionality (such as the service host, which is now a standalone project &lt;a href="http://code.google.com/p/topshelf/"&gt;Topshelf&lt;/a&gt;), and plan to harvest out some additional features in the near future. The great thing about building open source software is the cooperative nature -- even on similar projects. We all learn from each other and build that knowledge into tools that other developers can use and learn from as well.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=11538" width="1" height="1"&gt;</content><author><name>phatboyg</name><uri>http://www.lostechies.com/members/phatboyg/default.aspx</uri></author></entry><entry><title>Simplified MassTransit Configuration</title><link rel="alternate" type="text/html" href="/blogs/chris_patterson/archive/2008/12/21/simplified-masstransit-configuration.aspx" /><id>/blogs/chris_patterson/archive/2008/12/21/simplified-masstransit-configuration.aspx</id><published>2008-12-21T05:26:02Z</published><updated>2008-12-21T05:26:02Z</updated><content type="html">&lt;p&gt;One of the things I&amp;#39;ve missed since we integrated container support is the ability to quickly and easily create an instance of the ServiceBus. After Ayende agreed, I decided it was time to do something about it.&lt;/p&gt;

&lt;p&gt;Behold the minimum amount of code necessary to create a service bus:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/chris_5F00_patterson/Picture-4.png" alt="Picture 4.png" border="0" width="620" height="213" /&gt;&lt;/p&gt;

&lt;p&gt;That&amp;#39;s it. In fact, you can easily mock out the container with some nifty Rhino.Mocks usage:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/chris_5F00_patterson/Picture-5.png" alt="Picture 5.png" border="0" width="619" height="172" /&gt;&lt;/p&gt;

&lt;p&gt;I&amp;#39;m starting to convert the tests to use the mocked container approach to reduce the runtime of the tests. But so far the HeavyLoad, Starbucks and WinFormSample samples have been verified to work with the new model. The Windsor facility is also using the new model (Dru is going to update the other two tomorrow).&lt;/p&gt;

&lt;p&gt;I&amp;#39;m pretty happy with the new configuration syntax, it certainly makes it easier to setup a bus with zero XML abuse. Look for more of this style of configuration/extension in MT in the near future.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=10769" width="1" height="1"&gt;</content><author><name>phatboyg</name><uri>http://www.lostechies.com/members/phatboyg/default.aspx</uri></author></entry><entry><title>QCon San Francisco, Opening Day</title><link rel="alternate" type="text/html" href="/blogs/chris_patterson/archive/2008/11/22/qcon-san-francisco-opening-day.aspx" /><id>/blogs/chris_patterson/archive/2008/11/22/qcon-san-francisco-opening-day.aspx</id><published>2008-11-22T05:50:49Z</published><updated>2008-11-22T05:50:49Z</updated><content type="html">&lt;p&gt;The main conference for QCon started Wednesday, opening with a keynote by Martin Fowler and Rebecca Parsons from Thoughtworks. The topic was Architects and Agilists - Allies not Adversaries. As you can surmise from the title, this talk focused on building a collaborative relationship between ivory tower architects and the teams responsible for delivering software. With a scene from the Matrix where Neo meets The Architect as the backdrop, a number of solutions were presented after highlighting the key disconnects between the two roles. I&amp;#39;ve always been a firm believer that architects who do not code (NCA&amp;#39;s) are not nearly as effective as those who understand the issues of those actually writing code.&lt;/p&gt;

&lt;h3&gt;MERB&lt;/h3&gt;

&lt;p&gt;Since the presentation by Dan North was overflowing with humanity, we opted to attend the session on MERB. MERB is a high-performance, scalable MVC framework for Ruby. It is in the same space as Rails, but with a lot of optimizations to increase performance. It also supports slices, allowing features to be added as simple gems. This is one to keep an eye on as it grows.&lt;/p&gt;

&lt;h3&gt;Google App Engine and the Google Data APIs&lt;/h3&gt;

&lt;p&gt;My next stop was to learn about Google&amp;#39;s AppEngine and how it handles scalability and performance. It&amp;#39;s currently free, and developers can build and deploy applications into the cloud using Python and Bigtable. It&amp;#39;s an interesting engine with a completely transparent scaling infrastructure. You worry about your application, the system takes care of the rest. Large applications have been built and Google has allowed them to scale beyond the standard quota for free accounts. While final pricing has yet to be discussed, it&amp;#39;s likely to be very competitive. There is also a planned introduction of new language support early next year, but the exact language runtime being added was kept secret.&lt;/p&gt;

&lt;h3&gt;Responsive Design&lt;/h3&gt;

&lt;p&gt;The next stop was a talk by the legendary Kent Beck and his thoughts on what he calls responsive design. This talk was way up the clouds, and I&amp;#39;m talking the real ones. I think it&amp;#39;s great that we have people that think that far out, but I found little to take away from this session other than some looks of befuddlement. &lt;/p&gt;

&lt;h3&gt;Coupling, Messages, and Conversations&lt;/h3&gt;

&lt;p&gt;Since I started working on &lt;a href="http://code.google.com/p/masstransit/"&gt;MassTransit&lt;/a&gt;, I&amp;#39;ve used the &lt;a href="http://www.integrationpatterns.com/"&gt;Enterprise Integration Patterns&lt;/a&gt; book by Gregor Hohpe as a reference manual for building distributed message-based systems. In this talk, Gregor laid down some fundamentals and set the stage for a sequel to the book that will be titled Conversation Patterns. But first, the challenges of message-based systems were presented. The levels of failure are quite involved, and include things like lost request, lost response, slow response and retry duplication. A lot of these are covered in texts online, so much of this material was review for me. A new acronym for ACID was also declared: Associative, Commutative, Idempotent, and Distributed. &lt;/p&gt;

&lt;p&gt;With large scale distributed systems where consistency is of a more eventual rather than immediate nature, it&amp;#39;s important to recognize that the future if flexible and redundant rather than predictable and accurate. Building distributed transactions that are durable and that support compensation is crucial to having a success, scalable application.&lt;/p&gt;

&lt;p&gt;During the final session slot, a few of us sat down and had an in-depth discussion about what we had learned that day. Realizing that this was only the first and lightest day, we recognized quickly that we were in for a couple of dense days of exposure. We went over some things in MassTransit, and thought about how we could offer a more developer-friendly method of managing the state of distributed transactions (sagas in MT). We also delved into the hierarchical structure of conversations on top of sagas, a topic we hoped to dig into more as we saw multiple concurrent sagas running in parallel as part of an overall conversation.&lt;/p&gt;

&lt;h3&gt;Attendee Party&lt;/h3&gt;

&lt;p&gt;That evening, there was an attendee party at a nearby pool hall. After some snacks and a quick game of pool, Dru and I sat down with Gregor to discuss some messaging concepts. After a quick exchange in Japanese, we earned a seat at the table and started to talk about various conversation patterns that we had identified in our own work. I was surprised that we were thinking along the same lines and that several of the message patterns we had used were going to be covered in the book. We also talked a little bit about &lt;a href="http://code.google.com/apis/protocolbuffers/"&gt;Google Protocol Buffers&lt;/a&gt; (a platform and language independent format for serializing data in an efficient, binary stream). We started digging into GPB a few weeks ago as a way to build more system interoperability between Java and .NET when using MassTransit. Based on our process so far, this is likely to end up in a future release of MT.&lt;/p&gt;

&lt;p&gt;With that, the evening was pretty much done with my head pounding. I retired for the night recognizing that the time zone change was probably going to result in me waking up at 4:00 AM again (which, of course, I did).&lt;/p&gt;

&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=7091" width="1" height="1"&gt;</content><author><name>phatboyg</name><uri>http://www.lostechies.com/members/phatboyg/default.aspx</uri></author></entry><entry><title>QCon in San Francisco Getting Started</title><link rel="alternate" type="text/html" href="/blogs/chris_patterson/archive/2008/11/21/qcon-in-san-francisco-getting-started.aspx" /><id>/blogs/chris_patterson/archive/2008/11/21/qcon-in-san-francisco-getting-started.aspx</id><published>2008-11-21T16:52:38Z</published><updated>2008-11-21T16:52:38Z</updated><content type="html">&lt;p&gt;This week I&amp;#39;m attending &lt;a href="http://qconsf.com/"&gt;QCon&lt;/a&gt;, the international software developers conference, and since the day I arrived it has been great. The depth of knowledge is truly amazing and I&amp;#39;m enjoying some excellent conversations. The attendee mix is (based on my estimation) 50% Java developers, 30% .NET developers, and 20% other languages like Ruby or Python. The diverse nature of the conference is interesting in that many of the sessions are platform-neutral, focusing more on patterns and practices and a less on tools. &lt;/p&gt;

&lt;h4&gt;Domain Specific Language (DSL) Tutorial&lt;/h4&gt;

&lt;p&gt;The first day for me was an all-day tutorial on domain-specific languages hosted by &lt;a href="http://martinfowler.com/"&gt;Martin Fowler&lt;/a&gt;, &lt;a href="http://www.nealford.com/my/bio.htm"&gt;Neal Ford&lt;/a&gt;, and &lt;a href="http://www.thoughtworks.com/who-we-are/leadership-profiles/rebecca-parsons.html"&gt;Rebecca Parsons&lt;/a&gt; from &lt;a href="http://www.thoughtworks.com/index.html"&gt;Thoughtworks&lt;/a&gt;. The content was deep, and covered everything from XML (the least expressive DSL, despite being one of the most widely used) to custom languages built using Lex/Yacc grammar syntax. Martin&amp;#39;s site has a good amount of the content for &lt;a href="http://martinfowler.com/dslwip/"&gt;his upcoming book&lt;/a&gt; on domain specific languages and a lot of that content was covered in the session.&lt;/p&gt;

&lt;p&gt;My favorite takeaway was the styles shown for internal DSLs (also called fluent interfaces). An internal DSL is built using the language itself rather than creating a new grammar. There are plenty of great examples of fluent interfaces, including the &lt;a href="http://code.google.com/p/fluent-nhibernate/"&gt;FluentNHibernate&lt;/a&gt; project and &lt;a href="http://structuremap.sourceforge.net/Default.htm"&gt;StructureMap&lt;/a&gt;&amp;#39;s registry DSL. The immediate value of an internal DSL is the understanding gained from reading code written using this style of interface.&lt;/p&gt;

&lt;p&gt;Tuesday night is when a lot of the people started showing up since the tutorials were more of a pre-conference. I got to meet up with some friends and have some good chats before calling it an early night before the next three days.&lt;/p&gt;

&lt;p&gt;I&amp;#39;ll post more about the rest of the conference soon!&lt;/p&gt;

&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=7070" width="1" height="1"&gt;</content><author><name>phatboyg</name><uri>http://www.lostechies.com/members/phatboyg/default.aspx</uri></author></entry></feed>