我无法配置 Wildfly 14.0.1.Final 以连接到远程 Artemis 服务器。这是我的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>
这是我的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 {}
我在 Artemis 服务器上的 DMSQueue 地址中有 DMSQueue。这就是我在 Wildfly 控制台中得到的: 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)
和
AMQ151004: Instantiating javax.jms.Queue "DMSQueue" directly since UseJNDI=false.
我在 Artemis Web 控制台中看到的是,Wildfly 有两个连接和一个会话,还有一个注册的生产者,但没有消费者。我也尝试使用 Thorntail 进行配置,但得到了相同的结果。