我有两台Wildfly服务器在不同的机器上运行,其中一台将向另一台机器发送JMS消息。我创建了一个简单的测试应用程序,它似乎在发送消息,但另一方没有收到。事实上,它已经抱怨它无法连接:
14:17:21,188 WARN [org.hornetq.jms.server] (MSC service thread 1-6) HQ122018: Could not start recovery discovery on XARecoveryConfig [transportConfiguration = [TransportConfiguration(name=ca25380b-c270-11e4-ac81-876cdf81429b, factory=org-hornetq-core-remoting-impl-netty-NettyConnectorFactory) ?port=5545&host=192-168-179-25&local-address=127-0-0-1], discoveryConfiguration = null, username=null, password=****], we will retry every recovery scan until the server is available
14:17:21,296 INFO [org.hornetq.ra] (default-threads - 1) HQ151005: awaiting HornetQ Server availability
14:17:23,300 INFO [org.hornetq.ra] (default-threads - 1) HQ151001: Attempting to reconnect org.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@6d148215 destination=jms/queue/myqueue destinationType=javax.jms.Queue ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15)
我在配置两台服务器时尝试过很多东西。生产服务器的部分配置:
<subsystem xmlns="urn:jboss:domain:messaging:2.0">
<hornetq-server>
<connectors>
<netty-connector name="netty" socket-binding="messaging"/>
</connectors>
<acceptors>
<netty-acceptor name="netty" socket-binding="messaging"/>
</acceptors>
<jms-connection-factories>
<pooled-connection-factory name="hornetq-ra">
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="java:/JmsXA"/>
<entry name="java:jboss/DefaultJMSConnectionFactory"/>
</entries>
</pooled-connection-factory>
</jms-connection-factories>
<jms-destinations>
<jms-queue name="myQueue">
<entry name="java:jboss/exported/jms/queue/myqueue"/>
<entry name="java:/jms/queue/myqueue"/>
</jms-queue>
</jms-destinations>
</hornetq-server>
</subsystem>
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="messaging" port="5445"/>
</socket-binding-group>
和消费服务器:
<subsystem xmlns="urn:jboss:domain:messaging:2.0">
<hornetq-server>
<connectors>
<netty-connector name="netty" socket-binding="messaging-remote"/>
</connectors>
<acceptors>
<netty-acceptor name="netty" socket-binding="messaging"/>
</acceptors>
<jms-connection-factories>
<pooled-connection-factory name="hornetq-ra">
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="java:/JmsXA"/>
</entries>
</pooled-connection-factory>
</jms-connection-factories>
<jms-destinations>
<jms-queue name="myQueue">
<entry name="java:/jms/queue/myqueue"/>
</jms-queue>
</jms-destinations>
</hornetq-server>
</subsystem>
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="messaging" port="5445"/>
<outbound-socket-binding name="messaging-remote">
<remote-destination host="192.168.179.25" port="5545"/>
</outbound-socket-binding>
</socket-binding-group>
希望有人可以给我一个暗示。我觉得这应该很容易。
答案 0 :(得分:1)
我设法让它发挥作用。一些要点:
需要使用bin / add-user.sh工具创建用户。然后MDB需要两个ActivationConfigProperty:
@ActivationConfigProperty(propertyName = "user", propertyValue = "jms"),
@ActivationConfigProperty(propertyName = "password", propertyValue = "password")
非常重要的是,默认情况下standalone-full.xml配置只允许本地流量,因此您必须在生产服务器中重新配置公共接口:
<interface name="public">
<any-address/>
</interface>
或者可能稍微不那么宽容。