Monday, December 19, 2016

Active MQ Resource Adapter Config with Wildfly 10.1

Active MQ v 5.15.9 Config with Wildfly 10.1
----------------------------------------
Do the Config on WildFly Server

1. cd /opt

2. sudo wget https://repository.apache.org/content/repositories/releases/org/apache/activemq/activemq-rar/5.14.3/activemq-rar-5.15.9.rar


3. cd /opt/wildfly/modules/system/layers/base/org/apache/activemq
4. mkdir main
5.  sudo chown -R wildfly:wildfly main
6. cd main
7. sudo unzip /opt/activemq-rar-5.15.9.rar
8.  sudo chown -R wildfly:wildfly .
9.  sudo vi META-INF/ra.xml


 <resourceadapter>
        <resourceadapter-class>org.apache.activemq.ra.ActiveMQResourceAdapter</resourceadapter-class>
        <config-property>
            <description>
              The URL to the ActiveMQ server that you want this connection to connect to.  If using
              an embedded broker, this value should be 'vm://localhost'.
            </description>
            <config-property-name>ServerUrl</config-property-name>
            <config-property-type>java.lang.String</config-property-type>
            <config-property-value>tcp://1.2.3.4:61616</config-property-value>
            <!-- <config-property-value>vm://localhost</config-property-value> -->
        </config-property>
8. sudo vi broker-config.xml

 <transportConnectors>
      <transportConnector name="openwire" uri="tcp://1.2.3.4:61616"/>
    </transportConnectors>


9. sudo vi module.xml [create new file]

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="org.apache.activemq">
    <resources>
        <resource-root path="." />
                <resource-root path="activemq-broker-5.15.9.jar" />
                <resource-root path="activemq-client-5.15.9.jar" />
                <resource-root path="activemq-jms-pool-5.15.9.jar" />
                <resource-root path="activemq-kahadb-store-5.15.9.jar" />
                <resource-root path="activemq-openwire-legacy-5.15.9.jar" />
                <resource-root path="activemq-pool-5.15.9.jar" />
                <resource-root path="activemq-protobuf-1.1.jar" />
                <resource-root path="activemq-ra-5.15.9.jar" />
                <resource-root path="activemq-spring-5.15.9.jar" />
                <resource-root path="guava-18.0.jar"/>
                <resource-root path="commons-net-3.6.jar"/>
                <resource-root path="commons-pool2-2.4.2.jar"/>
                <resource-root path="commons-logging-1.2.jar"/>
                <resource-root path="hawtbuf-1.11.jar"/>
                <resource-root path="spring-aop-4.3.18.RELEASE.jar"/>
                <resource-root path="spring-beans-4.3.18.RELEASE.jar"/>
                <resource-root path="spring-context-4.3.18.RELEASE.jar"/>
                <resource-root path="spring-core-4.3.18.RELEASE.jar"/>
                <resource-root path="spring-expression-4.3.18.RELEASE.jar"/>
                <resource-root path="xbean-spring-4.2.jar"/>
    </resources>

    <dependencies>
                <module name="javax.api"/>
                <module name="org.slf4j"/>
                <module name="javax.resource.api" slot="main"/>
                <module name="javax.jms.api" slot="main"/>
                <module name="javax.management.j2ee.api" slot="main"/>
    </dependencies>
</module>


10. sudo chown -R wildfly:wildfly module.xml

11. Add the following on standalone-full.xml under
        

  1. <subsystem xmlns="urn:jboss:domain:resource-adapters:4.0">
  2.             <resource-adapters>
  3.                 <resource-adapter id="activemq-remote.rar">
  4.                     <module slot="main" id="org.apache.activemq"/>
  5.                     <transaction-support>XATransaction</transaction-support>
  6.                     <config-property name="ServerUrl">
  7.                         tcp://<hostname>:61616?jms.rmIdFromConnectionId=true
  8.                     </config-property>
  9.                     <config-property name="UserName">
  10.                         xxxxx
  11.                     </config-property>
  12.                     <config-property name="UseInboundSession">
  13.                         false
  14.                     </config-property>
  15.                     <config-property name="Password">
  16.                         xxxxx
  17.                     </config-property>
  18.                     <connection-definitions>
  19.                         <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/AMQConnectionFactory" enabled="true" pool-name="AMQConnectionFactory">
  20.                             <xa-pool>
  21.                                 <min-pool-size>20</min-pool-size>
  22.                                 <max-pool-size>50</max-pool-size>
  23.                                 <prefill>false</prefill>
  24.                                 <is-same-rm-override>false</is-same-rm-override>
  25.                             </xa-pool>
  26.                         </connection-definition>
  27.                     </connection-definitions>
  28.                     <admin-objects>
  29.                         <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:jboss/activemq/topic/TestTopic" use-java-context="true" pool-name="TestTopic">
  30.                             <config-property name="PhysicalName">
  31.                                 activemq/topic/TestTopic
  32.                             </config-property>
  33.                         </admin-object>
  34.                         <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:jboss/activemq/queue/TestQueue" use-java-context="true" pool-name="TestQueue">
  35.                             <config-property name="PhysicalName">
  36.                                 activemq/queue/TestQueue
  37.                             </config-property>
  38.                         </admin-object>
  39.                         <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:jboss/activemq/queue/nswpf_hip_log_queue" pool-name="log_queue">
  40.                             <config-property name="PhysicalName">
  41.                                 activemq/queue/log_queue
  42.                             </config-property>
  43.                         </admin-object>
  44.                         <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:jboss/activemq/queue/nswpf_hip_error_queue" pool-name="error_queue">
  45.                             <config-property name="PhysicalName">
  46.                                 activemq/queue/error_queue
  47.                             </config-property>
  48.                         </admin-object>
  49.                     </admin-objects>
  50.                 </resource-adapter>
  51.             </resource-adapters>
  52.         </subsystem>


  53. Change Below for ejb3
  54. ------------------------------


  55.  <mdb>
  56.              <resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:activemq-remote.rar}"/>
  57.            <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
  58.  </mdb>

2 comments: