The messaging-activemq subsystem allows to configure a pooled-connection-factory resource to let a local client deployed in WildFly connect to a remote Artemis server.
The configuration of such a pooled-connection-factory is done in 3 steps:
1. create an outbound-socket-binding pointing to the remote messaging server:
2. create a remote-connector referencing the outbound-socket-binding created at step (1).
3. create a pooled-connection-factory referencing the remote-connector created at step (2).
When a pooled-connection-factory is configured to connect to a remote Artemis, it is possible to configure Message-Driven Beans (MDB) to have them consume messages from this remote server.
The MDB must be annotated with the @ResourceAdapter annotation using the name of the pooled-connection-factory resource
If the MDB needs to produce messages to the remote server, it must inject the pooled-connection-factory by looking it up in JNDI using one of its entries.
A MDB must also specify which destination it will consume messages from.
The standard way is to define a destinationLookup activation config property that corresponds to a JNDI lookup on the local server.
When the MDB is consuming from a remote Artemis server, there may not have such a JNDI binding in the local WildFly.
It is possible to use the naming subsystem to configure external context federation to have local JNDI bindings delegating to external bindings.
However there is a simpler solution to configure the destination when using the Artemis Resource Adapter.
Instead of using JDNI to lookup the JMS Destination resource, you can just specify the name of the destination (as configured in the remote Artemis server) using the destination activation config property and set the useJNDI activation config property to false to let the Artemis Resource Adapter create automatically the JMS destination without requiring any JNDI lookup.
These properties configure the MDB to consume messages from the JMS Queue named myQueue hosted on the remote Artemis server.
In most cases, such a MDB does not need to lookup other destinations to process the consumed messages and it can use the JMSReplyTo destination if it is defined on the message.
If the MDB needs any other JMS destinations defined on the remote server, it must use client-side JNDI by following the Artemis documentation or configure external configuration context in the naming subsystem (which allows to inject the JMS resources using the @Resource annotation).