目前我正在使用WildFly 9,我们正在尝试用HornetQ配置基于TCP的负载共享.我们使用JGroups进行动态发现,并且在独立配置文件中添加了以下设置。
<broadcast-groups>
<broadcast-group name="my-broadcast-group">
<jgroups-file>jgroups-stacks.xml</jgroups-file>
<jgroups-channel>hornetq_broadcast_channel</jgroups-channel>
<broadcast-period>2000</broadcast-period>
<connector-ref connector-name="netty-connector"/>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="dg-group1">
<jgroups-file>jgroups-stacks.xml</jgroups-file>
<jgroups-channel>hornetq_broadcast_channel</jgroups-channel>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="tcp-based-cluster-node1-to-node2">
<address>jms</address>
<connector-ref>netty</connector-ref>
<retry-interval>500</retry-interval>
<use-duplicate-detection>true</use-duplicate-detection>
<forward-when-no-consumers>true</forward-when-no-consumers>
<max-hops>1</max-hops>
<discovery-group-ref discovery-group-name="dg-group1"/>
</cluster-connection>
</cluster-connections>
我做了来自这份文件的配置,但在这里我仍然面临着jgroup-file
的问题。它给出了以下错误:
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[393,21]
Message: WFLYCTL0198: Unexpected element '{urn:jboss:domain:messaging:3.0}jgroups-file' encountered
at org.jboss.as.controller.parsing.ParseUtils.unexpectedElement(ParseUtils.java:89)
at org.jboss.as.messaging.MessagingSubsystemParser.handleUnknownBroadcastGroupAttribute(MessagingSubsystemParser.java:739)
at org.jboss.as.messaging.Messaging13SubsystemParser.handleUnknownBroadcastGroupAttribute(Messaging13SubsystemParser.java:182)
这里的问题是在服务器运行时找不到文件。根据文档,我们必须在资源文件夹中进行设置,但是在HornetQ中,WildFly服务器没有资源文件夹,所以我们可以在哪里设置文件并与多个队列共享负载?
因此,我的问题是,首先,我们是在正确的道路上,还是我们需要做任何其他配置的相同?
发布于 2022-05-11 06:35:36
您所看到的文档是HornetQ,而不是WildFly。WildFly有一个独特的XML格式,它100%独立于HornetQ的格式,尽管它们在早期版本的WildFly中非常相似。但是,WildFly不支持您试图使用的jgroups-file
配置元素。只有独立的HornetQ支持这一点。
您应该查看standalone-full-ha.xml
9附带的WildFly文件。它有一个JGroups配置示例,例如:
...
<subsystem xmlns="urn:jboss:domain:jgroups:3.0">
<channels default="ee">
<channel name="ee"/>
</channels>
<stacks default="udp">
<stack name="udp">
<transport type="UDP" socket-binding="jgroups-udp"/>
<protocol type="PING"/>
<protocol type="MERGE3"/>
<protocol type="FD_SOCK" socket-binding="jgroups-udp-fd"/>
<protocol type="FD_ALL"/>
<protocol type="VERIFY_SUSPECT"/>
<protocol type="pbcast.NAKACK2"/>
<protocol type="UNICAST3"/>
<protocol type="pbcast.STABLE"/>
<protocol type="pbcast.GMS"/>
<protocol type="UFC"/>
<protocol type="MFC"/>
<protocol type="FRAG2"/>
<protocol type="RSVP"/>
</stack>
<stack name="tcp">
<transport type="TCP" socket-binding="jgroups-tcp"/>
<protocol type="MPING" socket-binding="jgroups-mping"/>
<protocol type="MERGE3"/>
<protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>
<protocol type="FD"/>
<protocol type="VERIFY_SUSPECT"/>
<protocol type="pbcast.NAKACK2"/>
<protocol type="UNICAST3"/>
<protocol type="pbcast.STABLE"/>
<protocol type="pbcast.GMS"/>
<protocol type="MFC"/>
<protocol type="FRAG2"/>
<protocol type="RSVP"/>
</stack>
</stacks>
</subsystem>
...
<subsystem xmlns="urn:jboss:domain:messaging:3.0">
<hornetq-server>
...
<broadcast-groups>
<broadcast-group name="bg-group1">
<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-group1">
<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>
<discovery-group-ref discovery-group-name="dg-group1"/>
</cluster-connection>
</cluster-connections>
...
</hornetq-server>
</subsystem>
...
值得注意的是,WildFly 9是在2015年7月发布的,大约7年前的今天。当前版本为26.1.0。I强烈鼓励您升级到更新的版本。
https://stackoverflow.com/questions/72124957
复制相似问题