|
|||||
|
|||||
Using JCA
When implementing the server side with Lingo you probably want high performance JMS subscription - to use a thread pool and to support parallel processing of inbound messages as well as pooling JMS connections, sessions and handling transactions and XA. The way to do this efficiently with JMS is to use a JCA Container such as Jencks. Here is an example configuration of using the service exporter. Its pretty similar to the previous Example apart from its just a MessageListener <!-- the server side --> <bean id="server" class="org.logicblaze.lingo.jms.JmsServiceExporterMessageListener" depends-on="broker"> <property name="service" ref="serverImpl" /> <property name="serviceInterface" value="org.logicblaze.lingo.example.ExampleService" /> <property name="connectionFactory" ref="jmsFactory" /> </bean> <!-- the actual implementation of the service - which is only made public for testing purposes --> <bean id="serverImpl" class="org.logicblaze.lingo.example.ExampleServiceImpl" singleton="true" /> Then we need to configure a JCA container and add a JCA connector to perform the subscriptions. Notice the use of the work manager thread pools to define how much parallelism there should be. <!-- 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="test.org.logicblaze.lingo.jca.example" /> <property name="destinationType" value="javax.jms.Queue" /> </bean> </property> <property name="ref" value="server" /> </bean> |
|||||
|
Copyright 2003-2006 - The Codehaus. All rights reserved unless otherwise noted.
Powered by Atlassian Confluence
|
|||||