<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Building A Service Gateway Using MassTransit, Part 1</title>
	<atom:link href="http://lostechies.com/chrispatterson/2009/10/29/building-a-service-gateway-using-masstransit-part-1/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/chrispatterson/2009/10/29/building-a-service-gateway-using-masstransit-part-1/</link>
	<description>Just another LosTechies site</description>
	<lastBuildDate>Mon, 06 May 2013 07:30:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Chris Patterson</title>
		<link>http://lostechies.com/chrispatterson/2009/10/29/building-a-service-gateway-using-masstransit-part-1/#comment-93</link>
		<dc:creator>Chris Patterson</dc:creator>
		<pubDate>Thu, 29 Oct 2009 20:56:20 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chris_patterson/archive/2009/10/28/building-a-service-gateway-using-masstransit-part-1.aspx#comment-93</guid>
		<description>@drzul:

And I agree with Udi and Ayende (and even Greg). If you can access the data store using NHibernate or LINQ2SQL, then by all means do that. It&#039;s an explicit dependency on a system that is designed for query performance. Introducing 2+ message delays into the query path adds no real value in this situation.

As for the obese IDataAccessor (or whatever) with 50 methods on it, you can still break your collection of queries into individual classes, with each class designed to handle the specifics of the query (instead of a bunch of overloaded arguments on a method-heavy class). It allows allows you to separate out the queries and make them more testable given a known set of data being queried (with can be unit tested with something like SQLite copying a preloaded database to ensure consistent results for unit tests).

It also makes it easy to apply a data caching layer around the query objects, allowing each query to control aspects such as cache lifetime for query results, batching of results independent of the actual number of rows requested, etc.

The next post will also address a more complex query scenario that uses messaging, but this series is about building a SERVICE gateway, not a data gateway. In the case of these queries, a remote service is being queried for the data (think SAP, etc.) and not a set of tables in a SQL database.
</description>
		<content:encoded><![CDATA[<p>@drzul:</p>
<p>And I agree with Udi and Ayende (and even Greg). If you can access the data store using NHibernate or LINQ2SQL, then by all means do that. It&#8217;s an explicit dependency on a system that is designed for query performance. Introducing 2+ message delays into the query path adds no real value in this situation.</p>
<p>As for the obese IDataAccessor (or whatever) with 50 methods on it, you can still break your collection of queries into individual classes, with each class designed to handle the specifics of the query (instead of a bunch of overloaded arguments on a method-heavy class). It allows allows you to separate out the queries and make them more testable given a known set of data being queried (with can be unit tested with something like SQLite copying a preloaded database to ensure consistent results for unit tests).</p>
<p>It also makes it easy to apply a data caching layer around the query objects, allowing each query to control aspects such as cache lifetime for query results, batching of results independent of the actual number of rows requested, etc.</p>
<p>The next post will also address a more complex query scenario that uses messaging, but this series is about building a SERVICE gateway, not a data gateway. In the case of these queries, a remote service is being queried for the data (think SAP, etc.) and not a set of tables in a SQL database.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Oliver</title>
		<link>http://lostechies.com/chrispatterson/2009/10/29/building-a-service-gateway-using-masstransit-part-1/#comment-92</link>
		<dc:creator>Jonathan Oliver</dc:creator>
		<pubDate>Thu, 29 Oct 2009 16:16:52 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chris_patterson/archive/2009/10/28/building-a-service-gateway-using-masstransit-part-1.aspx#comment-92</guid>
		<description>@drzul

Typically messages are used for asynchronous communication.  When you’re performing a query, there are much better tools for the job.  Why not just talk directly to the database?   Databases are very good at querying data.  You could abstract the database using Linq2Sql or NHibernate Projections or something similar.  In this way, you are able to get all of the data for a particular screen back in one call without regards to any type of domain or object model.

Then, when you want to mutate the data in some fashion, send a message asynchronously to your domain model (or whatever mechanism you use to dictate business logic).  The domain model would update the database and you’re good to go.

Greg Young talks a lot about this pattern—it’s called Command Query Responsibility Separation (CQRS).  I’ve written up a little bit about how to get started going down that road:
http://jonathan-oliver.blogspot.com/2009/03/dddd-and-cqs-getting-started.html</description>
		<content:encoded><![CDATA[<p>@drzul</p>
<p>Typically messages are used for asynchronous communication.  When you’re performing a query, there are much better tools for the job.  Why not just talk directly to the database?   Databases are very good at querying data.  You could abstract the database using Linq2Sql or NHibernate Projections or something similar.  In this way, you are able to get all of the data for a particular screen back in one call without regards to any type of domain or object model.</p>
<p>Then, when you want to mutate the data in some fashion, send a message asynchronously to your domain model (or whatever mechanism you use to dictate business logic).  The domain model would update the database and you’re good to go.</p>
<p>Greg Young talks a lot about this pattern—it’s called Command Query Responsibility Separation (CQRS).  I’ve written up a little bit about how to get started going down that road:<br />
<a href="http://jonathan-oliver.blogspot.com/2009/03/dddd-and-cqs-getting-started.html" rel="nofollow">http://jonathan-oliver.blogspot.com/2009/03/dddd-and-cqs-getting-started.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://lostechies.com/chrispatterson/2009/10/29/building-a-service-gateway-using-masstransit-part-1/#comment-91</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Thu, 29 Oct 2009 14:24:08 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chris_patterson/archive/2009/10/28/building-a-service-gateway-using-masstransit-part-1.aspx#comment-91</guid>
		<description>Looking forward to the next installment!</description>
		<content:encoded><![CDATA[<p>Looking forward to the next installment!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: drzul</title>
		<link>http://lostechies.com/chrispatterson/2009/10/29/building-a-service-gateway-using-masstransit-part-1/#comment-90</link>
		<dc:creator>drzul</dc:creator>
		<pubDate>Thu, 29 Oct 2009 06:20:53 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chris_patterson/archive/2009/10/28/building-a-service-gateway-using-masstransit-part-1.aspx#comment-90</guid>
		<description>Very interesting. Looking forward for the next posts.

One question though. Both Ayende and Udi are &quot;screaming&quot;:
&quot;Don&#039;t use messaging for quering data&quot;. 

Personally I&#039;m still straggling to understand why not, since
&quot;promoting&quot; the query to a message, would yield me (among other things) the benefit that the client (ex. the Controller in an MVC application) has no dependency on another class or interface (just the service bus) and is completely unaware of who gives back the data and with what mechanism, plus it would mean only one Message Handler for each query/message instead of some bloated class/facade with 50 methods &quot;GetOrderByStatus(...)&quot;, &quot;GetOrderByCriteria(...)&quot;, &quot;GetOrdersOfCustomer(...), etc...

Any comment on that?</description>
		<content:encoded><![CDATA[<p>Very interesting. Looking forward for the next posts.</p>
<p>One question though. Both Ayende and Udi are &#8220;screaming&#8221;:<br />
&#8220;Don&#8217;t use messaging for quering data&#8221;. </p>
<p>Personally I&#8217;m still straggling to understand why not, since<br />
&#8220;promoting&#8221; the query to a message, would yield me (among other things) the benefit that the client (ex. the Controller in an MVC application) has no dependency on another class or interface (just the service bus) and is completely unaware of who gives back the data and with what mechanism, plus it would mean only one Message Handler for each query/message instead of some bloated class/facade with 50 methods &#8220;GetOrderByStatus(&#8230;)&#8221;, &#8220;GetOrderByCriteria(&#8230;)&#8221;, &#8220;GetOrdersOfCustomer(&#8230;), etc&#8230;</p>
<p>Any comment on that?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
