I tried to deploy a MDB to a Wildfly 28 server but I still get the same
problems (however, the logging looks a little bit different on this server).
This was added to standalone-full.xml:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:15.0">
<server name="default">
...
<remote-connector
name="remote-artemis" socket-binding="remote-artemis"/>
<pooled-connection-factory name="remote-artemis" entries="java:/RemoteJMS"
connectors="remote-artemis" ha="false" user="myUser" password="myPassword"
min-pool-size="15" max-pool-size="30" statistics-enabled="true">
<inbound-config rebalance-connections="true" setup-attempts="-1"
setup-interval="5000"/>
</pooled-connection-factory>
<socket-binding-group name="standard-sockets" default-interface="public"
port-offset="${jboss.socket.binding.port-offset:0}">
...
<outbound-socket-binding name="remote-artemis">
<remote-destination host="localhost" port="61616"/>
</outbound-socket-binding>
The MDB looks like this:
@MessageDriven(name = "MyMDB", activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "jakarta.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue =
"TEST.QUEUE.A"),
@ActivationConfigProperty(propertyName = "clientId", propertyValue =
"myMDB"),
})
public class MyMDB implements MessageListener {
@Inject
private Logger logger;
@Transactional(Transactional.TxType.REQUIRED)
public void onMessage(Message rcvMessage) {
logger.info("Received Message: {}", rcvMessage);
}
}
This was added to jboss-ejb3.xml:
<mdb:resource-adapter-binding>
<jee:ejb-name>*</jee:ejb-name>
<mdb:resource-adapter-name>remote-artemis</mdb:resource-adapter-name>
</mdb:resource-adapter-binding>
Now the following error is logged:
07:00:16,254 INFO [org.jboss.as.ejb3] (MSC service thread 1-3) WFLYEJB0042:
Started message driven bean 'MyMDB' with 'remote-artemis' resource adapter
...
07:00:17,720 WARN [org.apache.activemq.artemis.ra.ActiveMQRALogger]
(default-threads - 1) AMQ153005: Unable to retrieve "TEST.QUEUE.A" from JNDI.
Creating a new "jakarta.jms.Queue" named "jms.queue.TEST.QUEUE.A" to be used by
the MDB.
...
07:00:21,020 INFO [org.apache.activemq.artemis.ra.ActiveMQRALogger]
(default-threads - 1) AMQ151000: awaiting topic/queue creation TEST.QUEUE.A
07:00:26,023 INFO [org.apache.activemq.artemis.ra.ActiveMQRALogger]
(default-threads - 1) AMQ151001: Attempting to reconnect
org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec(ra=org.wildfly.extension.messaging.activemq.ActiveMQResourceAdapter@23e4fbb1
destination=TEST.QUEUE.A destinationType=jakarta.jms.Queue
ack=Auto-acknowledge durable=false clientID=myMDB user=null maxSession=15)
07:00:26,025 WARN [org.apache.activemq.artemis.ra.ActiveMQRALogger]
(default-threads - 1) AMQ153005: Unable to retrieve "TEST.QUEUE.A" from JNDI.
Creating a new "jakarta.jms.Queue" named "jms.queue.TEST.QUEUE.A" to be used by
the MDB.
07:00:29,539 INFO [org.apache.activemq.artemis.ra.ActiveMQRALogger]
(default-threads - 1) AMQ151000: awaiting topic/queue creation TEST.QUEUE.A
07:00:34,543 WARN [org.apache.activemq.artemis.ra.ActiveMQRALogger]
(default-threads - 1) AMQ153005: Unable to retrieve "TEST.QUEUE.A" from JNDI.
Creating a new "jakarta.jms.Queue" named "jms.queue.TEST.QUEUE.A" to be used by
the MDB.
07:00:37,813 INFO [org.apache.activemq.artemis.ra.ActiveMQRALogger]
(default-threads - 1) AMQ151000: awaiting topic/queue creation TEST.QUEUE.A
...
Since JNDI was mentioned, I tried to add this to the MDB:
@ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false")
But then I get the following problem instead:
07:04:53,411 INFO [org.jboss.as.ejb3] (MSC service thread 1-2) WFLYEJB0042:
Started message driven bean 'MyMDB' with 'remote-artemis' resource adapter
...
07:04:53,557 INFO [org.apache.activemq.artemis.ra.ActiveMQRALogger]
(default-threads - 2) AMQ151004: Instantiating jakarta.jms.Queue "TEST.QUEUE.A"
directly since UseJNDI=false.
...
07:04:57,030 INFO [org.apache.activemq.artemis.ra.ActiveMQRALogger]
(default-threads - 2) AMQ151000: awaiting topic/queue creation TEST.QUEUE.A
07:05:02,034 INFO [org.apache.activemq.artemis.ra.ActiveMQRALogger]
(default-threads - 2) AMQ151001: Attempting to reconnect
org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec(ra=org.wildfly.extension.messaging.activemq.ActiveMQResourceAdapter@23e4fbb1
destination=TEST.QUEUE.A destinationType=jakarta.jms.Queue
ack=Auto-acknowledge durable=false clientID=myMDB user=null maxSession=15)
07:05:02,036 INFO [org.apache.activemq.artemis.ra.ActiveMQRALogger]
(default-threads - 2) AMQ151004: Instantiating jakarta.jms.Queue "TEST.QUEUE.A"
directly since UseJNDI=false.
07:05:05,103 INFO [org.apache.activemq.artemis.ra.ActiveMQRALogger]
(default-threads - 2) AMQ151000: awaiting topic/queue creation TEST.QUEUE.A
07:05:10,109 INFO [org.apache.activemq.artemis.ra.ActiveMQRALogger]
(default-threads - 2) AMQ151004: Instantiating jakarta.jms.Queue "TEST.QUEUE.A"
directly since UseJNDI=false.
07:05:16,313 INFO [org.apache.activemq.artemis.ra.ActiveMQRALogger]
(default-threads - 2) AMQ151000: awaiting topic/queue creation TEST.QUEUE.A
...
However, if I adjust the Artemis broker configuration (like before) everything
works (no matter if "useJNDI" is false or not) and messages are consumed as
expected. The changes are:
<auto-create-queues>true</auto-create-queues>
<auto-create-addresses>true</auto-create-addresses>
and
<permission type="createDurableQueue" roles="amq,myRole"/>
and the addition of anycastPrefix and multicastPrefix to the acceptor.
Using Artemis Management Console, no new address or queue seems to have been
created compared to thoose I added in broker.xml.
Not really sure where/how to continue debugging.
Regards,
Calle