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.
You can do this efficiently in JMS by using a JCA Container like Jencks.
How to configure:
<!-- If embedded JMS broker otherwise ignore this tag-->
<bean id="broker" class="org.apache.activemq.xbean.BrokerFactoryBean" singleton="true">
<property name="config" value="classpath:broker.xml" />
</bean>
<bean id="server" class="org.logicblaze.lingo.jms.JmsServiceExporterMessageListener" depends-on="broker">
<property name="service" ref="helloImpl" />
<property name="serviceInterface" value="test.mdp.Hello" />
<property name="connectionFactory" ref="jmsFactory" />
</bean>
<bean id="helloImpl" class="test.mdp.HelloBean" singleton="true" />
<bean id="jmsFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
</bean>
<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:61616" />
</bean>
</property>
</bean>
<!-- an inbound message connector using a stateless, thread safe MessageListener -->
<bean id="inboundA" 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="MyQueue" />
<property name="destinationType" value="javax.jms.Queue" />
</bean>
</property>
<property name="ref" value="server" />
</bean>
<bean id="client" class="org.logicblaze.lingo.jms.JmsProxyFactoryBean">
<property name="serviceInterface" value="test.mdp.Hello" />
<property name="connectionFactory" ref="jmsFactory" />
<property name="destination" ref="exampleDestination" />
<!-- lets add some custom headers to the messages -->
<property name="messageProperties">
<map>
<entry key="MyHeader">
<value>Hello World</value>
</entry>
</map>
</property>
</bean>
<bean id="exampleDestination" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg index="0" value="MyQueue" />
</bean>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment