1

我无法配置 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 进行配置,但得到了相同的结果。

4

1 回答 1

1

我在这里查看文档:https ://docs.wildfly.org/14/Admin_Guide.html#Messaging_Connect_a_pooled-connection-factory_to_a_Remote_Artemis_Server

假设您remote-artemis定义了套接字绑定(您没有显示),您似乎必须通过使用@org.jboss.ejb3.annotation.ResourceAdapter("remote-artemis").

如果 MDB 未通过此注解或其他方式配置为使用特定资源适配器,ejb3则将使用子系统中配置的默认资源适配器。

您的其余配置看起来不错(根据文档,我不是消息传递专家:-))。

于 2019-08-15T06:22:04.313 回答