<?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>Teun Berkers &#187; teun</title>
	<atom:link href="https://teunsblog.azurewebsites.net/?author=1&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>https://teunsblog.azurewebsites.net</link>
	<description>Just some of my thoughts on .NET Software Development &#124; NServiceBus &#124; Enterprise Integration</description>
	<lastBuildDate>Tue, 03 Jun 2014 16:46:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.2.1</generator>
	<item>
		<title>DTC troubles with long running transactions in NServiceBus</title>
		<link>https://teunsblog.azurewebsites.net/?p=21</link>
		<comments>https://teunsblog.azurewebsites.net/?p=21#comments</comments>
		<pubDate>Fri, 30 May 2014 19:48:20 +0000</pubDate>
		<dc:creator><![CDATA[teun]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dtc]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[nservicebus]]></category>
		<category><![CDATA[transaction]]></category>

		<guid isPermaLink="false">http://teunsblog.azurewebsites.net/?p=21</guid>
		<description><![CDATA[NServiceBus is a powerful and easy-to-use platform and it&#8217;s asynchronous messaging enables you to handle long-running processing tasks without blocking your main application. Ok, most of the time you should try to avoid long <a href="https://teunsblog.azurewebsites.net/?p=21" class="more-link">[&#8230;]</a>]]></description>
				<content:encoded><![CDATA[<p>NServiceBus is a powerful and easy-to-use platform and it&#8217;s asynchronous messaging enables you to handle long-running processing tasks without blocking your main application. Ok, most of the time you should try to avoid long running tasks: there&#8217;s a fair chance it&#8217;s running so long because of something evil, but there can be situations where your tasks just needs some time to complete &#8211; for example when you&#8217;re calling an external web service or when you need to process a lot of data.</p>
<p>Still no problem&#8230;&#8230; except when your task takes longer than 60 seconds to complete, then you&#8217;ll end up with <code>Cannot enlist the transaction</code> exceptions in your log. What happens in this case is as follows:</p>
<ol>
<li>NServiceBus starts a new distributed transaction using the DTC</li>
<li>The messages is taken from the queue and the message handler starts doing its work</li>
<li>On completion, NServiceBus tries to commit the started transaction, but the transaction is gone: it was already discarded by the DTC after 60 seconds.</li>
</ol>
<p>This can be deceiving as the system default timeout of the DTC is 10 minutes. Still, the transaction times out after 60 seconds. Don&#8217;t bother trying to <a href="http://support.microsoft.com/kb/287499">change the default timeout</a> (I already did)&#8230; it makes no difference.</p>
<p>I suspect it&#8217;s the System.Transactions of .NET that overrules the system timeout as adding the setting below to the configuration section of the config solves the issue:</p>
<p><code>&lt;system.transactions&gt;<br />
&lt;defaultSettings timeout="00:10:00"/&gt;<br />
&lt;/system.transactions&gt;<br />
</code></p>
<p>You can also check out <a href="http://erictummers.wordpress.com/2014/05/28/cannot-enlist-the-transaction/">Eric Tummers&#8217; blog</a> for more info.</p>
]]></content:encoded>
			<wfw:commentRss>https://teunsblog.azurewebsites.net/?feed=rss2&#038;p=21</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
