activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kneumei <kneu...@gmail.com>
Subject Re: Failover protocol using genericra in glassfish
Date Tue, 18 Jan 2011 20:57:10 GMT

I ended up switching to use the resource adapter provided by activemq that
comes in the lib/optional directory.

In case anyone is interested, here are the steps I followed to get it
working

asadmin create-resource-adapter-config --property
ServerUrl=failover\:(tcp\://localhost\:61616,tcp\://localhost\:61617)
activemqra

asadmin deploy --name activemqra <path to activemq-rar-5.4.2.rar>

Then to create resources:

asadmin create-connector-connection-pool --raname --connectiondefinition
javax.jms.ConnectionFactory --transactionsupport XATransaction
jms/MyQueueFactoryPool

asadmin create-connector-resource --poolname jms/MyQueueFactoryPool
jms/MyQueueQFactory

asadmin create-admin-object --raname activemqra --restype javax.jms.Queue
--property PhysicalName=MyQueue jms/MyQueue

To get an mdb hooked up, I had to add this in the sun-ejb-jar.xml

<mdb-resource-adapter>
                <resource-adapter-mid>activemqra</resource-adapter-mid>
                <activation-config>
                    <activation-config-property>
                        <activation-config-property-name>DestinationType
                        </activation-config-property-name>
                        <activation-config-property-value>javax.jms.Queue
                        </activation-config-property-value>
                    </activation-config-property>
                    <activation-config-property>
                        <activation-config-property-name>destination
                        </activation-config-property-name>
                        <activation-config-property-value>MyQueue
                        </activation-config-property-value>
                    </activation-config-property>
                </activation-config>
            </mdb-resource-adapter>

To hook this up to a spring JMSTemplate:

<bean id="ConFac" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName">
            <value>jms/MyQueueQQFactory</value>
        </property>
        <property name="resourceRef">
            <value>true</value>
        </property>
    </bean>
    <bean id="myqueue"
class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName">
            <value>jms/MyQueue</value>
        </property>
        <property name="resourceRef">
            <value>true</value>
        </property>
    </bean>
    <bean id="mdbTemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="conFac" />
        <property name="defaultDestination" ref="myqueue" />
    </bean>
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/Failover-protocol-using-genericra-in-glassfish-tp3218504p3223986.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message