<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>IT Developer World &#187; Queue</title>
	<atom:link href="http://itdevworld.wordpress.com/tag/queue/feed/" rel="self" type="application/rss+xml" />
	<link>http://itdevworld.wordpress.com</link>
	<description>IT Related thoughts</description>
	<lastBuildDate>Tue, 01 Dec 2009 01:33:06 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='itdevworld.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/1d1eb8f45f88efe16b1fb8474a943568?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>IT Developer World &#187; Queue</title>
		<link>http://itdevworld.wordpress.com</link>
	</image>
			<item>
		<title>First impressions of IBM WebSphere MQ Low Latency Messaging</title>
		<link>http://itdevworld.wordpress.com/2009/04/10/first-impressions-of-ibm-websphere-mq-low-latency-messaging/</link>
		<comments>http://itdevworld.wordpress.com/2009/04/10/first-impressions-of-ibm-websphere-mq-low-latency-messaging/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 00:39:00 +0000</pubDate>
		<dc:creator>rafaelri</dc:creator>
				<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[JMS]]></category>
		<category><![CDATA[LLM]]></category>
		<category><![CDATA[Low Latency Messaging]]></category>
		<category><![CDATA[Multicast]]></category>
		<category><![CDATA[Queue]]></category>
		<category><![CDATA[Resource Adapter]]></category>
		<category><![CDATA[RMM]]></category>
		<category><![CDATA[RUM]]></category>
		<category><![CDATA[Topic]]></category>
		<category><![CDATA[Unicast]]></category>
		<category><![CDATA[WebSphere MQ]]></category>

		<guid isPermaLink="false">http://itdevworld.wordpress.com/?p=178</guid>
		<description><![CDATA[IBM has a rather new platform for messaging. It is called WebSphere MQ Low Latency Messaging (aka WebSphere MQ LLM). It was released on the fourth quarter of 2007 and sincerely it hasn&#8217;t much similarities with the well known WebSphere MQ (former MQ Series).
First of all, after installing it you will probably notice that there [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=178&subd=itdevworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>IBM has a rather new platform for messaging. It is called WebSphere MQ Low Latency Messaging (aka WebSphere MQ LLM). It was released on the fourth quarter of 2007 and sincerely it hasn&#8217;t much similarities with the well known WebSphere MQ (former MQ Series).</p>
<p>First of all, after installing it you will probably notice that there isn&#8217;t a service for starting up. Soon you notice that it is rather a library that provides messaging services. Actually, it is a native library (currently [v2.1] only available for Linux x86, Windows x86 and Solaris Sparc) that comes already with JNI bindings.</p>
<p>To make things even harder, there isn&#8217;t much documentation available (<a href="http://publib.boulder.ibm.com/infocenter/wllm/v2r1/topic/com.ibm.wllm.doc/api/javadoc/messaging/com/ibm/llm/rum/RumInstance.html" target="_blank">and it seems like IBM is still organizing its docs online</a>).</p>
<p>But, IBM claims that it has shown impressive numbers on its benchmarks:</p>
<blockquote><p>WebSphere MQ Low Latency Messaging has demonstrated very high throughput, one-to-many multicast messaging, which can deliver approximately one million 120-byte messages per second on Ethernet, close to three million 120-byte messages per second on InfiniBand, and more than 8 million smaller messages per second, all on common x86 servers. Testing has also measured very low latency of 30 microseconds for 120 byte messages delivered at 10,000 messages per second on InfiniBand or 61 microseconds on Ethernet (1)</p></blockquote>
<p>Source: <a href="http://www-03.ibm.com/press/us/en/pressrelease/22558.wss" target="_blank">IBM press release</a></p>
<p>In its Java version, the main classes that you&#8217;ll interact when using WMQ LLM are:</p>
<ul>
<li>RUMInstance (available through RUMFactory)</li>
<li>RMMInstance</li>
</ul>
<p>For instance, RUM stands for Reliable Unicast Messaging and RMM stands for Reliable Multicast Messaging. As you can guess, RUM is used for Queue styled messaging and RMM for Topic styled messaging.</p>
<p>One of its drawbacks is that it still lacks a JMS based Resource Adapter but nothing denies you from rolling your own if you can&#8217;t wait for an official adapter from IBM.</p>
<p>I am planning to do some benchmarking against a regular MQ integrated application. As soon as I have the results I&#8217;ll post them over here.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itdevworld.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itdevworld.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itdevworld.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itdevworld.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itdevworld.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itdevworld.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itdevworld.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itdevworld.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itdevworld.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itdevworld.wordpress.com/178/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=178&subd=itdevworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://itdevworld.wordpress.com/2009/04/10/first-impressions-of-ibm-websphere-mq-low-latency-messaging/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/292a48d9cbe4c198ce280095a4e3fecc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rafaelri</media:title>
		</media:content>
	</item>
		<item>
		<title>Avoiding method timeouts in EJB Containers using Command Pattern with a JMS Queue</title>
		<link>http://itdevworld.wordpress.com/2009/03/14/avoiding-method-timeouts-in-ejb-containers-using-command-pattern-with-a-jms-queue/</link>
		<comments>http://itdevworld.wordpress.com/2009/03/14/avoiding-method-timeouts-in-ejb-containers-using-command-pattern-with-a-jms-queue/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 00:54:50 +0000</pubDate>
		<dc:creator>rafaelri</dc:creator>
				<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[Command]]></category>
		<category><![CDATA[Container]]></category>
		<category><![CDATA[CorrelationID]]></category>
		<category><![CDATA[EJB]]></category>
		<category><![CDATA[JMS]]></category>
		<category><![CDATA[JMS Queue]]></category>
		<category><![CDATA[Long Running Task]]></category>
		<category><![CDATA[MDB]]></category>
		<category><![CDATA[MessageDriven]]></category>
		<category><![CDATA[Method Timeout]]></category>
		<category><![CDATA[Pattern]]></category>
		<category><![CDATA[Queue]]></category>
		<category><![CDATA[Runnable]]></category>
		<category><![CDATA[SessionBean]]></category>
		<category><![CDATA[Timeout]]></category>

		<guid isPermaLink="false">http://itdevworld.wordpress.com/?p=164</guid>
		<description><![CDATA[If you ever needed to run a complex processing in EJB that would take for example two minutes you probably have already faced the container time limitation for SessionBean methods.
This timeout (in contrast to what most think) isn&#8217;t there only to developer&#8217;s life harder. Actually, it is exactly the opposite: it is there to avoid [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=164&subd=itdevworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you ever needed to run a complex processing in EJB that would take for example two minutes you probably have already faced the container time limitation for SessionBean methods.</p>
<p>This timeout (in contrast to what most think) isn&#8217;t there only to developer&#8217;s life harder. Actually, it is exactly the opposite: it is there to avoid that someone inadvertly implement a code that takes the whole server down (including your beloved application).</p>
<p>But there are times when long running operations are really necessary, for example a cache warmup.</p>
<p><strong>MDBs are an exception</strong></p>
<p>As in our project a few operations would easily violate this limitation we had to research a smart way of circumventing this limitation. During our research we found out this post on <a title="/dev/websphere" href="http://www.devwebsphere.com/devwebsphere/2006/01/coping_with_lon.html" target="_blank">/dev/websphere</a> blog. So we already knew that we would end up using a JMS Queue but having one Queue, MDB and so ever for each task would be a mess (not to mention that it was way too much work and not ellegant). So, that was when we came to the conclusion that what we needed was an way of having multiple tasks on top of the same infra-structure.</p>
<p><strong>Command Pattern to the Rescu</strong><strong>e</strong></p>
<p>We realized that by using an ObjectMessage that carried our <a title="Command Pattern" href="http://en.wikipedia.org/wiki/Command_pattern" target="_blank">Command object</a> we would end up having a single queue that would handle all of our long running tasks. If there is specific context for the task processing we can have it stored in the Command Object (eg.: id of a purchase transaction that needs to be processed, or even the purchase object itself).</p>
<p><strong>Sequence Diagrams for the solution</strong></p>
<p>Let&#8217;s have an example, suppose we have a long running cleanup of a database that needs to be run in a timely manner. We would end up having the following flow of method calls:</p>
<div id="attachment_166" class="wp-caption aligncenter" style="width: 544px"><a href="http://itdevworld.files.wordpress.com/2009/03/jobsubmissiononworkingqueue1.jpg"><img class="size-full wp-image-166" title="JOB Submission on Working Queue" src="http://itdevworld.files.wordpress.com/2009/03/jobsubmissiononworkingqueue1.jpg?w=534&#038;h=244" alt="JOB Submission on Working Queue" width="534" height="244" /></a><p class="wp-caption-text">JOB Submission on Working Queue</p></div>
<p>Having the Command object implement <a title="Runnable" href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/class-use/Runnable.html" target="_blank">Runnable interface</a> is a wise idea (to avoid having another interface that is almost a Runnable clone not to mention that future JavaEE Asynch beans will probably be implemented on top of Runnable interface).</p>
<p>The next important part is the JOB execution, which is depicted below:</p>
<div id="attachment_167" class="wp-caption aligncenter" style="width: 541px"><a href="http://itdevworld.files.wordpress.com/2009/03/workingbeanflow.jpg"><img class="size-full wp-image-167" title="JOB execution Working MDB" src="http://itdevworld.files.wordpress.com/2009/03/workingbeanflow.jpg?w=531&#038;h=424" alt="JOB execution Working MDB" width="531" height="424" /></a><p class="wp-caption-text">JOB execution Working MDB</p></div>
<p>As mentioned on the notes, you need to be aware that the <a title="Transactional Context" href="http://edocs.bea.com/wle/transact/trxejb.htm" target="_blank">Transactional Context</a> for the MDB <strong>MUST be Never</strong>, otherwise you&#8217;d avoid method timeouts but would still have transaction timeouts.</p>
<p>Another tricky part is splitting the long running task in smaller chunks that can execute under the method timeout.</p>
<p>As stated in the diagram, the LongRunningJOB code inside the run method is called inside the execution context of the MDB which is free from the method timeout limitation.</p>
<p><strong>Signalling JOB return code</strong></p>
<p>If you need to be notified that the JOB has finished its execution you&#8217;d need to have either another JOB passed as parameter to this JOB and it&#8217;ll be responsible of executing the code that would inform its return status OR have a message sent on a Temporary Queue OR the last option would be to submit a reply in another queue and have a CorrelationID link the request and the response message.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itdevworld.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itdevworld.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itdevworld.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itdevworld.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itdevworld.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itdevworld.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itdevworld.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itdevworld.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itdevworld.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itdevworld.wordpress.com/164/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itdevworld.wordpress.com&blog=4407561&post=164&subd=itdevworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://itdevworld.wordpress.com/2009/03/14/avoiding-method-timeouts-in-ejb-containers-using-command-pattern-with-a-jms-queue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/292a48d9cbe4c198ce280095a4e3fecc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rafaelri</media:title>
		</media:content>

		<media:content url="http://itdevworld.files.wordpress.com/2009/03/jobsubmissiononworkingqueue1.jpg" medium="image">
			<media:title type="html">JOB Submission on Working Queue</media:title>
		</media:content>

		<media:content url="http://itdevworld.files.wordpress.com/2009/03/workingbeanflow.jpg" medium="image">
			<media:title type="html">JOB execution Working MDB</media:title>
		</media:content>
	</item>
	</channel>
</rss>