Wednesday, August 1, 2007

Multi threaded JMS with Lingo and Jencks

Blink It Digg! Dzone

In the previous article about Lingo JMS with Lingo we took care of a simple Lingo implementation. In that article we discussed that Lingo does not support out of the box a multi threaded server side. This article will discuss the steps to take to get your Lingo implementation to the next level.

To get the server side to process server calls on multiple threads we going to use Jencks. Jencks is a implementation of the J2EE Connector Architecture (JCA). For now we are just going to implement a simple multi threaded solution without transactions.

The client side is exactly the same as discused in JMS with Lingo, for more info about how to setup the Lingo client site I refer to this article.

The server side is also the same as discused in JMS with Lingo, but additinal to this configuration for Jecks needs some configuration to take care of multi threading part.


<!-- JCA container -->
<bean id="jencks" class="org.jencks.JCAContainer">

<!-- lets use the default configuration of work manager and transaction manager-->
<property name="bootstrapContext">
<bean class="org.jencks.factory.BootstrapContextFactoryBean">
<property name="threadPoolSize" value="25" />
</bean>
</property>


<!-- the JCA Resource Adapter -->
<property name="resourceAdapter">
<bean id="activeMQResourceAdapter"
class="org.apache.activemq.ra.ActiveMQResourceAdapter">
<property name="serverUrl" value="tcp://localhost:61626" />
</bean>
</property>
</bean>

<!-- an inbound message connector using a stateless, thread safe MessageListener -->
<bean id="inboundMessageA" class="org.jencks.JCAConnector">

<property name="jcaContainer" ref="jencks" />

<!-- subscription details -->
<property name="activationSpec">
<bean class="org.apache.activemq.ra.ActiveMQActivationSpec">
<property name="destination"
value="org.isthisjava.service.jca.ExampleService" />
<property name="destinationType" value="javax.jms.Queue" />
</bean>
</property>

<property name="ref" value="exampleService" />
</bean>


When you want more details for the multi threaded client and server, the complete source code is added at the end of this page. If you want to see it in action just drop the server end client binaries into tomcat. and point your browser to http://locahost:8080/somepathtothemultithreadedclient

TODO add source and binaries

Blink It Digg! Dzone

No comments: