Mike
Mike

Reputation: 942

How to configure Wildfly to connect to remote Artemis server?

I cannot configure Wildfly 14.0.1.Final to connect to the remote Artemis server. Here is my standalone.xml:

      <server name="default">
            <security-setting name="#">
                <role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
            </security-setting>
            <address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>
            <http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
            <http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
                <param name="batch-delay" value="50"/>
            </http-connector>
            <remote-connector name="remote-artemis" socket-binding="remote-artemis"/>
            <in-vm-connector name="in-vm" server-id="0">
                <param name="buffer-pooling" value="false"/>
            </in-vm-connector>
            <http-acceptor name="http-acceptor" http-listener="default"/>
            <http-acceptor name="http-acceptor-throughput" http-listener="default">
                <param name="batch-delay" value="50"/>
                <param name="direct-deliver" value="false"/>
            </http-acceptor>
            <in-vm-acceptor name="in-vm" server-id="0">
                <param name="buffer-pooling" value="false"/>
            </in-vm-acceptor>
            <jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
            <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
            <connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
            <connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
            <pooled-connection-factory name="activemq-ra" entries="java:/JmsXA" connectors="in-vm" transaction="xa"/>
            <pooled-connection-factory name="remote-artemis" entries="java:/jms/remoteCF" connectors="remote-artemis" user="admin" password="admin"/>
        </server>

And here is my MDB:

@ResourceAdapter("remote-artemis")
@MessageDriven(name = "ExampleMdb", activationConfig = {
        @ActivationConfigProperty(propertyName = "destination", propertyValue = "DMSQueue"),
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
        @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false"),
        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") })
    public class ExampleMdb implements MessageListener {}

I have DMSQueue in DMSQueue address on Artemis server. This is what I get in Wildfly console: AMQ151001: Attempting to reconnect org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec(ra=org.wildfly.extension.messaging.activemq.ActiveMQResourceAdapter@9382da9c destination=queues/DMSQueue destinationType=javax.jms.Queue ack=Auto-acknowledge durable=false clientID=null user=admin password=**** maxSession=15)
and
AMQ151004: Instantiating javax.jms.Queue "DMSQueue" directly since UseJNDI=false.

What I can see in Artemis web console is that there are two connections and one session from Wildfly and one registered producer, but no consumers. I also tried configuring this with Thorntail but got the same results.

Upvotes: 1

Views: 2823

Answers (1)

Ladicek
Ladicek

Reputation: 6607

I'm looking at the documentation here: https://docs.wildfly.org/14/Admin_Guide.html#Messaging_Connect_a_pooled-connection-factory_to_a_Remote_Artemis_Server

Assuming you have the remote-artemis socket binding defined (you don't show that), it seems you have to configure the MDB to use the specific resource adapter by annotating it with @org.jboss.ejb3.annotation.ResourceAdapter("remote-artemis").

If the MDB isn't configured to use a specific resource adapter, either by this annotation or by some other means, the default resource adapter configured in the ejb3 subsystem will be used.

The rest of your configuration looks good (according to the docs, I'm no expert on messaging :-) ).

Upvotes: 1

Related Questions