Still unclear of which provider/connectionfactory to use with Hornet/ESB combo
billy.sjoberg Feb 21, 2012 7:30 AMHi guys,
I've scoured the net trying to come to senses with how to setup a best-practice transactional JMS routing system using the ESB.
In my current project I'm only using local JMS (local Hornet in AS 6.1 Final), but I can't find any good explanation on the different types of transaction settings.
I.e. Hornet comes by default bundled with 2 separate connection factories:
ConnectionFactory
XAConnectionFactory
The appserver (6.1) also has a JCA adaptor ConnectionFactory, wrapping either of the two above
java:/JmsXA
Now, if I read what the HornetQ guys tells me I should always use the JCA adaptor internally as the other ones are for external usage, meaning as an external JMS broker. Is this correct?
I have laborated a bit with transactional rollbacks and found that the only way I can guarantee a rollback is by using the esb jms-jca-provider, not the regular jms-provider.
However....
* You can specify transactions in multiple places in the jboss-esb.xml file. The ones I've found yet are both on the jms-jca-provider element as well as for your jms-message-filters inside your bus. How does these correlate?
* Also, do I really need the jms-jca-provider if I'm only interested in local transactions? My local jms impl is the only transaction participant so it seems a bit heavy to start an XA transaction when a local one would do. I've had clients that seen performance problems with regards to XA during heavy load.
* Which one of the ConnectionFactories should I actually use for my usecase? And which provider type? And with which transactional setting? As mentioned my use case is to only guarantee message delivery without any DB participants etc.
Best regards
/Billy
As of now, my ESB files looks something like this (with added actions of course):
<providers>
<jms-jca-provider adapter="jms-ra.rar"
connection-factory="/ConnectionFactory"
jndi-context-factory="org.jnp.interfaces.NamingContextFactory" name="HornetQ"
transacted="true">
<property name="jcaActivationMapper" value="org.jboss.soa.esb.listeners.jca.JBossActivationMapper"/>
<jms-bus busid="esb_jms_gateway">
<jms-message-filter dest-name="queue/in.gw"
dest-type="QUEUE" transacted="true"/>
</jms-bus>
<jms-bus busid="esb_jms_master_bus">
<jms-message-filter dest-name="queue/in"
dest-type="QUEUE" transacted="true"/>
</jms-bus>
<activation-config>
<property name="useJNDI" value="true" />
<property name="dLQMaxResent" value="1"/>
</activation-config>
</jms-jca-provider>
</providers>
<services>
<service category="TEST" name="local-transaction-test" description="">
<listeners>
<jms-listener busidref="esb_jms_gateway" is-gateway="true"
name="gwListener"/>
<jms-listener busidref="esb_jms_master_bus" is-gateway="false"
name="internalListener"/>
</listeners>
<actions mep="OneWay" webservice="false">
<action name="debug-incoming" class="org.jboss.soa.esb.actions.SystemPrintln">
<property name="printfull" value="false"/>
<property name="message" value="Received message"/>
</action>
<action name="threadSleep" class="org.rl.esb.ThreadSleeper"/>
<action name="debug-outgoing" class="org.jboss.soa.esb.actions.SystemPrintln">
<property name="printfull" value="false"/>
<property name="message" value="About to send message"/>
</action>
<action class="org.jboss.soa.esb.actions.routing.JMSRouter" name="routeToJms">
<property name="jndiName" value="queue/out"/>
<property name="persistent" value="true"/>
<property name="unwrap" value="true"/>
</action>
</actions>
</service>
</services>