Skip to content

Instantly share code, notes, and snippets.

@skhatri
Last active December 30, 2015 23:49
Show Gist options
  • Save skhatri/7903671 to your computer and use it in GitHub Desktop.
Save skhatri/7903671 to your computer and use it in GitHub Desktop.
activemq ra.xml and ironjacamar.xml for activemq 5.9.0 integration with jboss eap 6.1

get activemqrar from http://mvnrepository.com/artifact/org.apache.activemq/activemq-rar/5.9.0

unzip activemq-rar-5.9.0.rar into a folder C:\jboss-eap-6.1\standalone\deployments\activemq-rar-5.9.0.rar

overwrite ra.xml into activemq-rar-5.9.0/META-INF

copy ironjacamar.xml into activemq-rar-5.9.0/META-INF

touch activemq-rar-5.9.0.rar.dodeploy in the deployments folder

all should work.

If you get [tcp] classcast exception, either use ra.xml to indicate you are running in inmemory mode (vm://jboss-activemq-broker) or ensure the activemq version that is running is same version as activemq rar

drop jboss-deployment-structure.xml into the WEB-INF/ folder of the application that is going to use JMS

<?xml version="1.0" encoding="UTF-8"?>
<ironjacamar>
<!-- This defines the ConnectionFactory bindings for JNDI -->
<!-- You HAVE to use ManagedConnectionFactories here and you HAVE to disable
the definitions in the ra.xml except the basic ConnectionFactory -->
<connection-definitions>
<connection-definition
class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory"
jndi-name="java:jboss/jms/ActiveTopicConnectionFactory" pool-name="TopicConnectionFactory">
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>200</max-pool-size>
<prefill>false</prefill>
</pool>
<security>
<application />
</security>
<timeout>
<blocking-timeout-millis>30000</blocking-timeout-millis>
<idle-timeout-minutes>3</idle-timeout-minutes>
</timeout>
<validation>
<background-validation>false</background-validation>
<use-fast-fail>false</use-fast-fail>
</validation>
</connection-definition>
<connection-definition
class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory"
jndi-name="java:jboss/jms/ActiveConnectionFactory" pool-name="QueueConnectionFactory">
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>200</max-pool-size>
<prefill>false</prefill>
</pool>
<security>
<application />
</security>
<timeout>
<blocking-timeout-millis>30000</blocking-timeout-millis>
<idle-timeout-minutes>3</idle-timeout-minutes>
</timeout>
<validation>
<background-validation>false</background-validation>
<use-fast-fail>false</use-fast-fail>
</validation>
</connection-definition>
</connection-definitions>
<!-- Define your Topics/Queues here and specify a PhysicalName and a JNDI
name -->
<admin-objects>
<admin-object class-name="org.apache.activemq.command.ActiveMQTopic"
jndi-name="java:jboss/jms/ActiveTestTopic">
<config-property name="PhysicalName">activemq/topic/TestTopic
</config-property>
</admin-object>
<admin-object class-name="org.apache.activemq.command.ActiveMQQueue"
jndi-name="java:jboss/jms/ActiveRequestQueue">
<config-property name="PhysicalName">activemq/queue/RequestQueue
</config-property>
</admin-object>
<admin-object class-name="org.apache.activemq.command.ActiveMQQueue"
jndi-name="java:jboss/jms/ActiveResponseQueue">
<config-property name="PhysicalName">activemq/queue/ResponseQueue
</config-property>
</admin-object>
</admin-objects>
</ironjacamar>
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="deployment.activemq-rar-5.9.0.rar" export="true" />
</dependencies>
</deployment>
</jboss-deployment-structure>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. The ASF licenses this file to
You under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of
the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License. -->
<connector xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
version="1.5">
<description>ActiveMQ inbound and outbound JMS ResourceAdapter</description>
<display-name>ActiveMQ JMS Resource Adapter</display-name>
<vendor-name>activemq.org</vendor-name>
<eis-type>JMS 1.1</eis-type>
<resourceadapter-version>1.0</resourceadapter-version>
<resourceadapter>
<resourceadapter-class>org.apache.activemq.ra.ActiveMQResourceAdapter</resourceadapter-class>
<config-property>
<description>
tcp://localhost:61616
The URL to the ActiveMQ server that you want this connection to connect to. If using
an embedded broker, this value should be 'vm://jboss-activemq-broker'.
</description>
<config-property-name>ServerUrl</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>tcp://localhost:61616</config-property-value>
</config-property>
<config-property>
<description>The default user name that will be used to establish connections to the ActiveMQ server.</description>
<config-property-name>UserName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>sa</config-property-value>
</config-property>
<config-property>
<description>The default password that will be used to log the default user into the ActiveMQ server.</description>
<config-property-name>Password</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>undefined</config-property-value>
</config-property>
<config-property>
<description>The client id that will be set on the connection that is established to the ActiveMQ server.</description>
<config-property-name>Clientid</config-property-name>
<config-property-type>java.lang.String</config-property-type>
</config-property>
<config-property>
<description>Boolean to configure if outbound connections should reuse the inbound connection's session for sending messages.</description>
<config-property-name>UseInboundSession</config-property-name>
<config-property-type>java.lang.Boolean</config-property-type>
<config-property-value>false</config-property-value>
</config-property>
<outbound-resourceadapter>
<connection-definition>
<managedconnectionfactory-class>org.apache.activemq.ra.ActiveMQManagedConnectionFactory</managedconnectionfactory-class>
<connectionfactory-interface>javax.jms.ConnectionFactory</connectionfactory-interface>
<connectionfactory-impl-class>org.apache.activemq.ra.ActiveMQConnectionFactory</connectionfactory-impl-class>
<connection-interface>javax.jms.Connection</connection-interface>
<connection-impl-class>org.apache.activemq.ra.ManagedConnectionProxy</connection-impl-class>
</connection-definition>
<transaction-support>NoTransaction</transaction-support>
<reauthentication-support>false</reauthentication-support>
</outbound-resourceadapter>
<inbound-resourceadapter>
<messageadapter>
<messagelistener>
<messagelistener-type>javax.jms.MessageListener</messagelistener-type>
<activationspec>
<activationspec-class>org.apache.activemq.ra.ActiveMQActivationSpec</activationspec-class>
<required-config-property>
<config-property-name>destination</config-property-name>
</required-config-property>
<required-config-property>
<config-property-name>destinationType</config-property-name>
</required-config-property>
</activationspec>
</messagelistener>
</messageadapter>
</inbound-resourceadapter>
<adminobject>
<adminobject-interface>javax.jms.Queue</adminobject-interface>
<adminobject-class>org.apache.activemq.command.ActiveMQQueue</adminobject-class>
<config-property>
<config-property-name>PhysicalName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
</config-property>
</adminobject>
<adminobject>
<adminobject-interface>javax.jms.Topic</adminobject-interface>
<adminobject-class>org.apache.activemq.command.ActiveMQTopic</adminobject-class>
<config-property>
<config-property-name>PhysicalName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
</config-property>
</adminobject>
</resourceadapter>
</connector>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment