Support for JCA Message Endpoints - Java-Springs

Beginning with version 2.5, Spring also provides support for a JCA-based Message Listener container. The Jms Message Endpoint Manager will attempt to automatically determine the ActivationSpec class name from the provider's Resource Adapter class name. Therefore, it is typically possible to just provide Spring's generic Jms Activation Spec Config as shown in the following example.

<bean class="org.springframework.jms.listener.endpoint.JmsMessageEndpointManager">
<property name="resourceAdapter" ref="resourceAdapter"/>
<property name="activationSpecConfig">
<bean class="org.springframework.jms.listener.endpoint.JmsActivationSpecConfig">
<property name="destinationName" value="myQueue"/>
</bean>
</property>
<property name="messageListener" ref="myMessageListener"/>
</bean>

Alternatively, you may set up a JmsMessageEndpointManager with a given ActivationSpec object. The ActivationSpec object may also come from a JNDI lookup (using <jee:jndi-lookup>).

<bean class="org.springframework.jms.listener.endpoint.JmsMessageEndpointManager">
<property name="resourceAdapter" ref="resourceAdapter"/>
<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="messageListener" ref="myMessageListener"/>
</bean>

Using Spring's ResourceAdapterFactoryBean, the target ResourceAdapter may be configured locally as depicted in the following example.

<bean id="resourceAdapter" class="org.springframework.jca.support.ResourceAdapterFactoryBean">
<property name="resourceAdapter">
<bean class="org.apache.activemq.ra.ActiveMQResourceAdapter">
<property name="serverUrl" value="tcp://localhost:61616"/>
</bean>
</property>
<property name="workManager">
<bean class="org.springframework.jca.work.SimpleTaskWorkManager"/>
</property>
</bean>

The specified Work Manager may also point to an environment-specific thread pool - typically through Simple Task Work Manager's "async Task Executor" property.Consider defining a shared thread pool for all your Resource Adapter instances if you happen to use multiple adapters.

In some environments (e.g. WebLogic 9 or above), the entire ResourceAdapter object may be obtained from JNDI instead (using <jee:jndi-lookup>). The Spring-based message listeners can then interact with the server-hosted Resource Adapter, also using the server's built-in Work Manager.

Please consult the JavaDoc for Jms Message End point Manager, Jms Activation Spec Config, and Resource Adapter Factory Bean for more details.

Spring also provides a generic JCA message endpoint manager which is not tied to JMS: org. spring frame work.jca. end point.Generic Message End point Manager. This component allows for using any message listener type (e.g. a CCI MessageListener) and any provided-specific ActivationSpec object. Check out your JCA provider's documentation to find out about the actual capabilities of your connector, and consult Generic Message End point Manager's JavaDoc for the Spring-specific configuration details.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Java-Springs Topics