我在域模式下使用 Wildfly 9.1。
我有三个主机: A , B 和 C 。
所有节点都有一个具有相同 test.ear 的测试服务器。
启动三个节点后,ClusterConnectionBridge
在它们之间都正确创建。
每个节点在 上发送消息commonTopic
,MDB 记录收到的消息。
问题是我看到节点A上记录的只是他自己发送的消息。在其他节点上,我看到记录了 A 、 B 、 C 发送的所有消息。这很奇怪,因为在节点 A 上使用 tcpdump 我会在端口 8080 上看到来自其他节点的传入消息。
使用 cli 获取节点 A 上的指标:
[domain@MASTER:19990 /] /host=SLAVE.A/server=test/subsystem=messaging/hornetq-server=default/jms-topic=commonTopic:read-resource(recursive=true,proxies=false,include-runtime=true,include-defaults=true)
{
"outcome" => "success",
"result" => {
"delivering-count" => 0,
"durable-message-count" => 0,
"durable-subscription-count" => 1,
"entries" => [
"java:/jms/commonTopic",
"java:jboss/exported/jms/commonTopic"
],
"message-count" => 0L,
"messages-added" => 150L,
"non-durable-message-count" => 0,
"non-durable-subscription-count" => 3,
"subscription-count" => 4,
"temporary" => false,
"topic-address" => "jms.topic.commonTopic"
}
}
我看到添加消息的数量是一个节点发送的消息的3倍。因此,似乎消息是通过网桥接收的,但没有被 MDB 消费。
有人可以告诉我在哪里寻找这个问题。
主机位于同一 LAN 上的虚拟机上。
如果我在我的 PC 上启动节点 D 并将其加入集群,也会发生同样的情况。节点 D 记录来自其他 3 个节点的所有消息,但在其他节点上没有记录 D 消息。
以下是我的domain.xml中有关 HornetQ 配置的片段:
<subsystem xmlns="urn:jboss:domain:messaging:3.0">
<hornetq-server>
<security-enabled>false</security-enabled>
<jmx-management-enabled>true</jmx-management-enabled>
<journal-file-size>102400</journal-file-size>
<connectors>
<http-connector name="http-connector" socket-binding="http">
<param key="http-upgrade-endpoint" value="http-acceptor"/>
</http-connector>
<http-connector name="http-connector-throughput" socket-binding="http">
<param key="http-upgrade-endpoint" value="http-acceptor-throughput"/>
<param key="batch-delay" value="50"/>
</http-connector>
<netty-connector name="netty" socket-binding="messaging"/>
<netty-connector name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
</netty-connector>
<in-vm-connector name="in-vm" server-id="0"/>
</connectors>
<acceptors>
<http-acceptor http-listener="default" name="http-acceptor"/>
<http-acceptor http-listener="default" name="http-acceptor-throughput">
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</http-acceptor>
<netty-acceptor name="netty" socket-binding="messaging"/>
<netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</netty-acceptor>
<in-vm-acceptor name="in-vm" server-id="0"/>
</acceptors>
<broadcast-groups>
<broadcast-group name="bg-group">
<jgroups-stack>udp</jgroups-stack>
<jgroups-channel>hq-cluster</jgroups-channel>
<connector-ref>
http-connector
</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="dg-group">
<jgroups-stack>udp</jgroups-stack>
<jgroups-channel>hq-cluster</jgroups-channel>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<address>jms</address>
<connector-ref>http-connector</connector-ref>
<use-duplicate-detection>true</use-duplicate-detection>
<forward-when-no-consumers>false</forward-when-no-consumers>
<max-hops>1</max-hops>
<discovery-group-ref discovery-group-name="dg-group"/>
</cluster-connection>
</cluster-connections>
<security-settings>
<security-setting match="#">
<permission type="send" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
</security-setting>
</security-settings>
<address-settings>
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<max-size-bytes>10485760</max-size-bytes>
<page-size-bytes>2097152</page-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
<redistribution-delay>1000</redistribution-delay>
</address-setting>
</address-settings>
<jms-connection-factories>
<connection-factory name="InVmConnectionFactory">
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/jms/MessageConnectionFactory"/>
<entry name="java:jboss/jms/MessageConnectionFactory"/>
<entry name="java:/ConnectionFactory"/>
</entries>
<reconnect-attempts>-1</reconnect-attempts>
</connection-factory>
<connection-factory name="RemoteConnectionFactory">
<connectors>
<connector-ref connector-name="http-connector"/>
</connectors>
<entries>
<entry name="java:jboss/exported/jms/MessageConnectionFactory"/>
<entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
</entries>
<ha>true</ha>
<block-on-acknowledge>true</block-on-acknowledge>
<reconnect-attempts>-1</reconnect-attempts>
</connection-factory>
<pooled-connection-factory name="hornetq-ra">
<transaction mode="xa"/>
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/JmsXA"/>
<entry name="java:jboss/DefaultJMSConnectionFactory"/>
</entries>
</pooled-connection-factory>
</jms-connection-factories>
<jms-destinations>
<jms-queue name="ExpiryQueue">
<entry name="jms/queue/ExpiryQueue"/>
<entry name="java:jboss/exported/jms/queue/ExpiryQueue"/>
<durable>true</durable>
</jms-queue>
<jms-queue name="DLQ">
<entry name="jms/queue/DLQ"/>
<entry name="java:jboss/exported/jms/queue/DLQ"/>
<durable>true</durable>
</jms-queue>
<jms-topic name="commonTopic">
<entry name="java:/jms/commonTopic"/>
<entry name="java:jboss/exported/jms/commonTopic"/>
</jms-topic>
</jms-topic>
</jms-destinations>
</hornetq-server>
</subsystem>
我发现问题是由消息持久性引起的。5 秒的生存时间不足以让节点 A 消费消息。我在 expiredQueue 上找到了过期的消息。每个节点每 10 秒发送一条消息,所以我不明白消息在节点 A 上过期的原因。