我有两个源服务器 server#0 和 server#1,以及一个目标服务器 server#2。每个源服务器都有一个核心网桥连接到服务器#2。(所有服务器都是独立的,2.2.14)
- server#0 有一个队列 q#0 (source)
- server#1 有一个队列 q#1 (source)
- server#2 有一个队列 q#2 (target)
考虑这种情况:
- 客户端向 q#0 发送消息
- q#2 成功接收所有消息(通过网桥)
- 客户端向 q#1 发送消息
- server#2 说:检测到重复消息(对于每条消息)并且没有从 q#1 添加到 q#2
服务器#2 收到消息表单 q#1 时的消息:
[Old I/O server worker (parentId: 2184190, [id: 0x002153fe, localhost/127.0.0.1:6445])]
14-Nov 13:38:27,300 WARNING [PostOfficeImpl] Duplicate message detected through the bridge - message will not be routed.
Message information: ServerMessage[messageID=25769805298,priority=4, bodySize=302,expiration=0, durable=true, address=jms.queue.target, properties=TypedProperties[{_HQ_BRIDGE_DUP=[B@1ff447b}]]@32041289
请注意,当客户端开始向 q#1 而不是 q#0 发送消息,然后向 q#0 发送消息时,再次出现此问题!(对于 q#1 消息)
它是一个错误吗?我该怎么办?
服务器#0(hornetq 配置):
<queues>
<queue name="jms.queue.source">
<address>jms.queue.source</address>
</queue>
</queues>
<bridges>
<bridge name="bridge-to-server2">
<queue-name>jms.queue.source</queue-name>
<forwarding-address>jms.queue.target</forwarding-address>
<reconnect-attempts>-1</reconnect-attempts>
<static-connectors>
<connector-ref>remote-connector</connector-ref>
</static-connectors>
</bridge>
</bridges>
<!-- connector to server#2 -->
<connector name="remote-connector">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory
</factory-class>
<param key="host" value="localhost" />
<param key="port" value="6445" />
</connector>
服务器#1(hornetq 配置):
<queues>
<queue name="jms.queue.source">
<address>jms.queue.source</address>
</queue>
</queues>
<bridges>
<bridge name="bridge-to-server2">
<queue-name>jms.queue.source</queue-name>
<forwarding-address>jms.queue.target</forwarding-address>
<reconnect-attempts>-1</reconnect-attempts>
<static-connectors>
<connector-ref>remote-connector</connector-ref>
</static-connectors>
</bridge>
</bridges>
<!-- connector to server#2 -->
<connector name="remote-connector">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory
</factory-class>
<param key="host" value="localhost" />
<param key="port" value="6445" />
</connector>
服务器#2(hornetq 配置):
<connectors>
<connector name="netty-connector">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory
</factory-class>
<param key="host" value="localhost" />
<param key="port" value="6445" />
</connector>
</connectors>
<acceptors>
<acceptor name="netty-acceptor">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory
</factory-class>
<param key="host" value="localhost" />
<param key="port" value="6445" />
</acceptor>
</acceptors>
服务器#2 (hornetq-jms):
<queue name="target">
<entry name="/queue/target" />
</queue>