MetaHnet
MetaHnet

Reputation: 125

How to connect to WildFly 10 embedded Active-MQ Artemis Broker without using jboss-client.jar

How can I connect to WildFly 10 embedded ActiveMQ-Artemis Broker without using jboss-client.jar? I understand it has something to do with acceptors/connectors in standalone.xml. Can you provide an example?

Upvotes: 2

Views: 2861

Answers (2)

stefan.m
stefan.m

Reputation: 2012

There are examples on how to do that for the following protocols:

  • AMQP
  • MQTT
  • Openwire
  • Stomp

Simply download the artemis Zip file from the homepage. In the examples\protocols folder (of Artemis 1.3), you'll find example code.

Note that this does not explain how to setup the protocols in Artemis running on Wildfly. You'll need to add an acceptor to standalone-full.xml. In my case, I needed the following acceptors (for Stomp and JMS):

            <acceptor name="stomp-acceptor" factory-class="org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory">
                <param name="protocols" value="STOMP"/>
                <param name="port" value="61613"/>
                <param name="host" value="10.xx.yyy.zzz,127.0.0.1"/>
            </acceptor>

            <acceptor name="jms-acceptor" factory-class="org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory">
                <param name="port" value="61616"/>
                <param name="host" value="10.xx.yyy.zzz,127.0.0.1"/>
            </acceptor>                

(replace 10.xx.yyy.zzz with your server's IP address).

As pointed out by MetaHnet, you may need to manually add Jars for some protocols. For Stomp, you find instructions here: How update WildFly 10.1.0Final Apache Artemis 1.1.0 to Apache Artemis 1.3

Upvotes: 2

MetaHnet
MetaHnet

Reputation: 125

Got it figured out:

Step 1: make sure you have all the required protocols. For example, unfortunately the default download of WildFly10-Final (the version from 2016-01-29) doesn't contain the necessary modules for the OPENWIRE protocol.

If you look at /modules/system/layers/base/org/apache/activemq/artemis/protocol you will see there is no openwire directory. So, create one, and add a "main" directory inside it as well. Put these jars in there: activemq-client-5.12.0.jar, artemis-openwire-protocol-1.2.0.jar, hawtbuf-1.11.jar and this module.xml:

<resources>
    <resource-root path="hawtbuf-1.11.jar"/>
    <resource-root path="activemq-client-5.12.0.jar"/>
    <resource-root path="artemis-openwire-protocol-1.2.0.jar"/>
</resources>

<dependencies>
<module name="javax.jms.api"/>
<module name="javax.api"/>
<module name="io.netty"/>
<module name="org.slf4j"/>
<module name="org.apache.activemq.artemis"/>
<module name="org.jboss.logging"/>
</dependencies>

Next, go to /modules/system/layers/base/org/apache/activemq/artemis/main, edit the module.xml file and add this line in the dependencies section:

module name="org.apache.activemq.artemis.protocol.openwire" services="import" optional="true"

Step 2: you can add a custom (e.g. Netty) acceptor in the urn:jboss:domain:messaging-activemq:1.0 section of standalone.xml. Look here: https://stackoverflow.com/a/32755989/4516921

Upvotes: 0

Related Questions