New servicemix-jms Endpoints
These newer JMS endpoints reuse some of the Spring JMS features including the message listener container, JMS transactions and the JMS template. Using these new endpoints can be achieved by using the jms:consumer
and jms:provider
in the xbean.xml file for the servicemix-jms component.
Consumer endpoints
Simple examples
<jms:consumer service="my:ConsumerService" endpoint="jbi" destinationName="my.queue" connectionFactory="#connectionFactory" concurrentConsumers="8" />
<jms:soap-consumer wsdl="classpath:service.wsdl" destinationName="my.queue" connectionFactory="#connectionFactory" concurrentConsumers="8" />
<jms:jca-consumer service="my:ConsumerService" endpoint="jbi" destinationName="my.queue" connectionFactory="#connectionFactory" resourceAdapter="#ra" activationSpec="#as" />
Connection Factory
ActiveMQ
We recommend jencks specific ActiveMQ connection pool if you use ActiveMQ.
Just add jencks-amqpool to your classpath. Then you can define a connection pool the following way:
<beans xmlns:amqpool="http://jencks.org/amqpool/2.0"> <amqpool:xa-pool id="connectionFactory" url="tcp://localhost:61616" transactionManager="#transactionManager" /> </beans>
Take a look at the documentation from the Jencks project for more informations
Other JMS providers
For other JMS providers, the ConnectionFactory is usually retrieved using JNDI.
<beans xmlns:jee="http://www.springframework.org/schema/jee"> <jee:jndi-lookup id="connectionFactory" jndi-name="weblogic.jms.XAConnectionFactory"> <jee:environment> java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory java.naming.provider.url=t3://localhost:7001 </jee:environment> </jee:jndi-lookup> <beans>
<bean id="connectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory"> <property name="transportType"> <util:constant static-field="com.ibm.mq.jms.JMSC.MQJMS_TP_CLIENT_MQ_TCPIP" /> </property> <property name="queueManager" value="foo.queue.mgr" /> <property name="hostName" value="hostname" /> <property name="channel" value="channelname" /> <property name="port" value="12345" /> </bean>
Check your JMS provider for the specific configuration needed.
Tips
Using a marshaler
The org.apache.servicemix.jms.endpoints.JmsConsumerMarshaler interface defines the way the incoming JMS message is transformed. There are two implementations:
- DefaultConsumerMarshaler for
<jms:consumer/>
and<jms:jca-consumer/>
endpoints - JmsSoapConsumerMarshaler for
<jms:soap-consumer/>
endpoints
For soap enabled endpoints, there is not particular need to modify the way the marshaling is done. But the DefaultConsumerMarshaler does not support the whole range of messages. So from time to time, you will need to process JMS properties or receive a Map based message. In such a case, you would create your own class implementing the JmsConsumerMarshaler
interface and configure it on the endpoint:
<jms:consumer service="my:ConsumerService" endpoint="jbi" destinationName="my.queue" connectionFactory="#connectionFactory" marshaler="#marshaler" /> <bean id="marshaler" class="my.package.MyMarshaler" />
Reference
ServiceMix uses JMS support from the Spring Framework, hence most of the following properties are fully documented at the following locations:
- http://static.springframework.org/spring/docs/2.0.x/reference/jms.html
- http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/jms/listener/package-summary.html
Common properties
Name |
Type |
Description |
Required |
---|---|---|---|
service |
QName |
the service name of the proxied endpoint |
yes |
endpoint |
String |
the endpoint name of the proxied endpoint |
yes |
interfaceName |
QName |
the interface name of the proxied endpoint |
|
|
|
|
|
targetService |
QName |
the service name of the target endpoint |
no (defaults to the service attribute) |
targetEndpoint |
String |
the endpoint name of the target endpoint |
no (defaults to the endpoint attribute) |
targetInterface |
QName |
the interface name of the target endpoint |
no |
targetUri |
String |
the URI of the target endpoint |
no |
|
|
|
|
marshaler |
|
|
|
synchronous |
|
|
|
destinationChooser |
|
|
|
destinationResolver |
|
|
|
pubSubDomaom |
|
|
|
connectionFactory |
|
|
|
|
|
|
|
useMessageIdInResponse |
Boolean |
|
|
replyDestination |
Destination |
|
|
replyDestinationName |
String |
|
|
replyExplicitQosEnabled |
boolean |
|
|
replyDeliveryMode |
int |
|
|
replyPriority |
int |
|
|
replyTimeToLive |
long |
|
|
replyProperties |
Map |
|
|
|
|
|
|
stateless |
boolean |
|
|
storeFactory |
StoreFactory |
|
|
store |
Store |
|
|
<jms:consumer/>
and <jms:soap-consumer/>
Name |
Type |
Description |
Required |
---|---|---|---|
listenerType |
String |
|
|
jms102 |
boolean |
|
no (defaults to |
transacted |
String |
|
|
Name |
Type |
Simple |
Default |
Server |
Description |
Required |
---|---|---|---|---|---|---|
clientId |
String |
X |
X |
X |
|
|
destination |
Destination |
X |
X |
X |
|
|
destinationName |
String |
X |
X |
X |
|
|
durableSubscriptionName |
String |
X |
X |
X |
|
|
exceptionListener |
ExceptionListener |
X |
X |
X |
|
|
messageSelector |
String |
X |
X |
X |
|
|
sessionAcknowlegeMode |
int |
X |
X |
X |
|
|
subscriptionDurable |
boolean |
X |
X |
X |
|
|
pubSubNoLocal |
boolean |
X |
X |
|
|
|
concurrentConsumers |
int |
X |
X |
|
|
|
cacheLevel |
int |
|
X |
|
|
|
receiveTimeout |
long |
|
X |
|
|
|
recoveryInterval |
long |
|
X |
|
|
|
maxMessagesPerTask |
int |
|
X |
X |
|
|
serverSessionFactory |
ServerSessionFactory |
|
|
X |
|
|
Soap specific properties
Note that when deploying a soap consumer, the service and endpoint name are optional and can be inferred from the given WSDL (if the WSDL only contains a single port definition). If the service and/or endpoint attributes are given, they must match the service and port name of the WSDL.
wsdl |
Resource |
|
yes |
useJbiWrapper |
boolean |
|
no (defaults to true) |
validateWsdl |
boolan |
check WSI-BP compliance |
no (defaults to true) |
policies |
Policy[] |
|
no |
<jms:jca-consumer/>
Name |
Type |
Description |
Required |
---|---|---|---|
resourceAdapter |
ResourceAdapter |
|
yes |
activationSpec |
ActivationSpec |
|
yes |
bootstrapContext |
BootstrapContext |
|
no (a default one will be created) |
Provider endpoints
These still need to be documented.