1
votes

I am trying to connect a Wildfly 13 - Instance to a standalone Artemis ActiveMQ to produce and consume messages from it. Therefore I have followed the relevant parts of the Wildfly 13 Documentation and Artemis ActiveMQ Documentation. Furthermore, I tried to use this tutorial and customized it a little bit using JMS 2.0 Simplified-API.

There is no Exception thrown when I am sending a payload to /produce. So I believe there is an issue with JNDI. I already monitored the ongoing network activity with Wireshark and was able to see the package exchange between the Wildfly and the Artemis ActiveMQ. Wildfly constantly tries to access the remote queue but ends with

AMQ11901 7: Queue does not exist

Up until now, I could not figure out why this happens.

Here is what I have until now:

Wildfly Configuration (standalone-full-ha.xml)

//...
<outbound-socket-binding name="ImportantMessages-remote">
    <remote-destination host="127.0.0.1" port="61616"/>
</outbound-socket-binding>
//...
<subsystem xmlns="urn:jboss:domain:messaging-activemq:3.0">
    <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" redistribution-delay="1000"/>
        <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="ImportantMessages-remote" socket-binding="ImportantMessages-remote"/>
        <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>
        <broadcast-group name="bg-group1" jgroups-cluster="activemq-cluster" connectors="http-connector"/>
        <discovery-group name="dg-group1" jgroups-cluster="activemq-cluster"/>
        <cluster-connection name="my-cluster" address="jms" connector-name="http-connector" discovery-group="dg-group1"/>
        <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" ha="true" block-on-acknowledge="true" reconnect-attempts="-1"/>
        <pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
        <pooled-connection-factory name="ImportantMessages-remote" entries="java:/jms/remoteIM" connectors="ImportantMessages-remote"/>
    </server>
</subsystem>
<subsystem xmlns="urn:jboss:domain:naming:2.0">
    <bindings>
        <external-context name="java:global/remoteContext" module="org.apache.activemq.artemis" class="javax.naming.InitialContext">
            <environment>
                <property name="java.naming.factory.initial" value="org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"/>
                <property name="java.naming.provider.url" value="tcp://127.0.0.1:61616"/>
                <property name="queue.ImportantMessages" value="ImportantMessages"/>
            </environment>
        </external-context>
        <lookup name="java:/ImportantMessages" lookup="java:global/remoteContext/ImportantMessages"/>
    </bindings>
    <remote-naming/>
</subsystem>

MessageProducerRessource

@Stateless
@Path("produce")
public class MessageProducerResource {

    private static final Logger LOG = Logger.getLogger(MessageProducerResource.class.getName());

    @Inject
    @JMSConnectionFactory("java:/jms/remoteIM")
    private JMSContext jmsContext;

    @Resource(lookup = "java:global/remoteContext/ImportantMessages")
    private Queue queue;

    @POST
    public void sendMessage(String txt) {
        jmsContext.createProducer().send(queue, txt);
        LOG.info("Sent message containing \"" + txt + "\" to " + queue);
    }
}

I believe these are the relevant code snippets. If you need any further information, please do not hesitate to ask. Has anybody faced a similar issue and can help me out?

1
Please share the broker.xml from Artemis as well as the version of Artemis you're using.Justin Bertram
Here is the broker.xml! I am using version 2.6.2.jerrypuchta

1 Answers

-1
votes

Probably u need to set security credentials on your artemis broker and add user/password to pooled-connection-factory.

<pooled-connection-factory name="ImportantMessages-remote" entries="java:/jms/remoteIM" connectors="ImportantMessages-remote" user="user123" password="Password123"/>