fmq.sh -profile FioranoMQ_XA
The rest of this page shows how to adapt the supplied JMS-Spring sample (in the download) for FioranoMQ.
java.naming.factory.initial=fiorano.jms.runtime.naming.FioranoInitialContextFactory java.naming.provider.url=http://localhost:1856 java.naming.security.principal=anonymous java.naming.security.credentials=anonymous
<beans> <!-- For non-xa --> <bean id="datasource" class="com.atomikos.jdbc.nonxa.NonXADataSourceBean"> <property name="user"><value>sa</value></property> <property name="url"><value>jdbc:HypersonicSQL:SpringNonXADB</value></property> <property name="driverClassName"><value>org.hsql.jdbcDriver</value></property> <property name="poolSize"><value>1</value></property> <property name="connectionTimeout"><value>60</value></property> </bean> <!-- NOTE: for XA datasources: don't forget to call init and close ! --> <bean id="xaFactory" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName"><value>primaryXAQCF</value></property> </bean> <bean id="queue" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName"><value>primaryRDBMSQueue</value></property> </bean> <bean id="bank" class="jdbc.Bank"> <property name="dataSource"><ref bean="datasource"/></property> </bean> <bean id="messageDrivenBank" class="jms.MessageDrivenBank"> <property name="bank"><ref bean="bank"/></property> </bean> <!-- Configure the JMS connector; call init to register for recovery! --> <bean id="queueConnectionFactoryBean" class="com.atomikos.jms.QueueConnectionFactoryBean" init-method="init"> <property name="resourceName"><value>QUEUE_BROKER</value></property> <property name="xaQueueConnectionFactory"><ref bean="xaFactory" /></property> </bean> <!-- Configure the session pool for JMS. This will also manage the transactions for incoming messages. --> <bean id="queueReceiverSessionPool" class="com.atomikos.jms.QueueReceiverSessionPool" init-method="start"> <property name="queueConnectionFactoryBean"> <ref bean="queueConnectionFactoryBean"/> </property> <property name="transactionTimeout"><value>120</value></property> <property name="poolSize"><value>1</value></property> <property name="queue"><ref bean="queue"/></property> <property name="messageListener"><ref bean="messageDrivenBank"/></property> </bean> </beans>
The bank java code does not have to change - all dependencies are concentrated in the spring config file above.
You should add the Fiorano jars to your classpath - see the Fiorano documentation on what jars you need.