使用两个不同主机的核心桥配置:hornetq HQ119013

时间:2014-07-16 11:54:52

标签: java networking jms hornetq jboss-messaging

我们面对core-bridge和hornetq的以下问题,并希望得到任何帮助。

情况:

我们有独立的hornetq服务器,比如说QSA,还有另一个hornetq服务器,比如QSB。 目标是让qeues以消息的形式桥接到QSA /队列

上的队列

Hornetq服务器都是hornetq-2.4.0.Final和运行standalon,非群集。

在QSA,我们有两个相关的队列:

  • 队列/ datahub /切换

  • 队列/ datahub / switchedinquiry-发送

在QSA,我们还有两个相关的队列:

  • 队列/的SmartControl / switchedinquiry

  • 队列/的SmartControl /开关发送

Bridge现在应该如下工作:

  • QSA:/ queue / datahub / switchedinquiry-send - > Bridge - > QSB:队列/的SmartControl / switchedinquiry

  • QSB:queue / smartcontrol / switched-send - > Bridge - > QSA:qeue / datahub /切换

问题:

当QSA和QSA在同一主机上运行并使用IP或Loopback(localhost)进行配置时,一切正常。

**但我们想要的是,QSA和QSB使用不同的ips在不同的主机上运行。继承人问题出现的地方:**

HornetQConnectionTimedOutException[errorType=CONNECTION_TIMEDOUT message=HQ119013: Timed out waiting to receive cluster topology. Group:null]


16 Jul 2014 12:09:16,622 DEBUG [Thread-20 (HornetQ-server-HornetQServerImpl::serverUUID=6cdc0a86-083b-11e4-84ef-c3d4fbb03c17-103207534)] org.hornetq.core.server.cluster.impl.BridgeImpl:977 - Bridge BridgeImpl@65719a42 [name=inquiry.bridge, queue=QueueImpl[name=jms.queue.datahub.switchedinquiry-send, postOffice=PostOfficeImpl [server=HornetQServerImpl::serverUUID=6cdc0a86-083b-11e4-84ef-c3d4fbb03c17]]@7c25984b targetConnector=ServerLocatorImpl (identity=Bridge inquiry.bridge) [initialConnectors=[TransportConfiguration(name=remote-connector, factory=org-hornetq-core-remoting-impl-netty-NettyConnectorFactory) ?port=5446&host=10-254-8-1], discoveryGroupConfiguration=null]] is unable to connect to destination. Retrying: HornetQConnectionTimedOutException[errorType=CONNECTION_TIMEDOUT message=HQ119013: Timed out waiting to receive cluster topology. Group:null]
    at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:950) [hornetq-core-client.jar:]
    at org.hornetq.core.server.cluster.impl.BridgeImpl.createSessionFactory(BridgeImpl.java:820) [hornetq-server.jar:]
    at org.hornetq.core.server.cluster.impl.BridgeImpl.connect(BridgeImpl.java:890) [hornetq-server.jar:]
    at org.hornetq.core.server.cluster.impl.BridgeImpl$ConnectRunnable.run(BridgeImpl.java:1108) [hornetq-server.jar:]
    at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:107) [hornetq-core-client.jar:]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]

使用标准的jms-bridge会发生或多或少相同的异常,即使stacktrac有点长:

使用标准jms-bridge似乎存在同样的问题。 堆栈跟踪有点长,但总的来说它是基本的例外:

HornetQConnectionTimedOutException[errorType=CONNECTION_TIMEDOUT message=HQ119013: Timed out waiting to receive cluster topology. Group:null]

16 Jul 2014 16:51:25,179 WARN  [main] org.hornetq.jms.bridge.impl.JMSBridgeImpl:1357 - HQ122010: Failed to connect JMS Bridge: javax.jms.JMSException: Failed to create session factory
    at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:676) [hornetq-jms-client.jar:]
    at org.hornetq.jms.client.HornetQConnectionFactory.createXAConnection(HornetQConnectionFactory.java:208) [hornetq-jms-client.jar:]
    at org.hornetq.jms.client.HornetQConnectionFactory.createXAConnection(HornetQConnectionFactory.java:203) [hornetq-jms-client.jar:]
    at org.hornetq.jms.bridge.impl.JMSBridgeImpl.createConnection(JMSBridgeImpl.java:1104) [hornetq-jms-server.jar:]
    at org.hornetq.jms.bridge.impl.JMSBridgeImpl.setupJMSObjects(JMSBridgeImpl.java:1310) [hornetq-jms-server.jar:]
    at org.hornetq.jms.bridge.impl.JMSBridgeImpl.start(JMSBridgeImpl.java:415) [hornetq-jms-server.jar:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
    at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
    at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59) [jboss-mc.jar:]
    at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150) [jboss-mc.jar:]
    at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:319) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:297) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:130) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.deploy(BeanXMLDeployer.java:96) [jboss-mc.jar:]
    at org.hornetq.integration.bootstrap.HornetQBootstrapServer.deploy(HornetQBootstrapServer.java:236) [hornetq-bootstrap.jar:]
    at org.hornetq.integration.bootstrap.HornetQBootstrapServer.deploy(HornetQBootstrapServer.java:206) [hornetq-bootstrap.jar:]
    at org.hornetq.integration.bootstrap.HornetQBootstrapServer.bootstrap(HornetQBootstrapServer.java:154) [hornetq-bootstrap.jar:]
    at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:83) [jboss-mc.jar:]
    at org.hornetq.integration.bootstrap.HornetQBootstrapServer.run(HornetQBootstrapServer.java:115) [hornetq-bootstrap.jar:]
    at org.hornetq.integration.bootstrap.HornetQBootstrapServer.main(HornetQBootstrapServer.java:69) [hornetq-bootstrap.jar:]
Caused by: HornetQConnectionTimedOutException[errorType=CONNECTION_TIMEDOUT message=HQ119013: Timed out waiting to receive cluster topology. Group:null]
    at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:950) [hornetq-core-client.jar:]
    at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:672) [hornetq-jms-client.jar:]
    ... 39 more

问题

1。)如果两个hornetq服务器在同一台机器上运行,但在不同机器上运行时,为什么会运行此配置。 2.)我们如何用hornetq实现期望的行为(在情境中描述)。

配置:

使用以下配置文件。如果两个hornetq在同一台机器上运行,则此处提供的配置有效。但是,如果我们将一个服务器的ip调整到另一台机器。出现所述问题。

QSA

将hornetq-beans.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="urn:jboss:bean-deployer:2.0">
        <!-- MBean server -->
        <bean name="MBeanServer" class="javax.management.MBeanServer">
                <constructor factoryClass="java.lang.management.ManagementFactory"
                        factoryMethod="getPlatformMBeanServer" />
        </bean>
        <!-- The core configuration -->
        <bean name="Configuration" class="org.hornetq.core.config.impl.FileConfiguration">
        </bean>
        <!-- The security manager -->
        <bean name="HornetQSecurityManager"
                class="org.hornetq.spi.core.security.HornetQSecurityManagerImpl">
                <start ignored="true" />
                <stop ignored="true" />
        </bean>
        <!-- The core server -->
        <bean name="HornetQServer" class="org.hornetq.core.server.impl.HornetQServerImpl">
                <constructor>
                        <parameter>
                                <inject bean="Configuration" />
                        </parameter>
                        <parameter>
                                <inject bean="MBeanServer" />
                        </parameter>
                        <parameter>
                                <inject bean="HornetQSecurityManager" />
                        </parameter>
                </constructor>
                <start ignored="true" />
                <stop ignored="true" />
        </bean>
        <!-- The Stand alone server that controls the jndi server -->
        <bean name="StandaloneServer" class="org.hornetq.jms.server.impl.StandaloneNamingServer">
                <constructor>
                        <parameter>
                                <inject bean="HornetQServer" />
                        </parameter>
                </constructor>
                <property name="port">${jnp.port:41099}</property>
                <property name="bindAddress">${jnp.host:159.232.217.119}</property>
                <property name="rmiPort">${jnp.rmiPort:41098}</property>
                <property name="rmiBindAddress">${jnp.host:159.232.217.119}</property>
        </bean>
        <!-- The JMS server -->
        <bean name="JMSServerManager" class="org.hornetq.jms.server.impl.JMSServerManagerImpl">
                <constructor>
                        <parameter>
                                <inject bean="HornetQServer" />
                        </parameter>
                </constructor>
        </bean>
</deployment>

hornetq-configuration.xml文件

<configuration xmlns="urn:hornetq"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="urn:hornetq/schema/hornetq-configuration.xsd">
        <paging-directory>${data.dir:../data}/paging_dh</paging-directory>
        <bindings-directory>${data.dir:../data}/bindings_dh
        </bindings-directory>
        <journal-directory>${data.dir:../data}/journal_dh</journal-directory>
        <journal-min-files>10</journal-min-files>
        <large-messages-directory>${data.dir:../data}/large-messages_dh
        </large-messages-directory>
        <!-- Connectors -->
        <connectors>
                <connector name="netty-connector">
                        <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory
                        </factory-class>
                        <param key="port" value="5445" />
                        <param key="host" value="159.232.217.119" />
                </connector>
                <!-- Connector to the other node -->
                <connector name="remote-connector">
                        <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory
                        </factory-class>
                        <param key="port" value="5446" />
                        <param key="host" value="159.232.217.119" />
                        <!-- <param key="host" value="10.254.8.1"/> -->
                </connector>
        </connectors>
        <!-- Acceptors -->
        <acceptors>
                <acceptor name="netty-acceptor">
                        <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory
                        </factory-class>
                        <param key="port" value="5445" />
                        <param key="host" value="159.232.217.119" />
                </acceptor>
        </acceptors>
        <queues>
                <queue name="jms.queue.smartcontrol.switchedinquiry">
                        <address>jms.queue.smartcontrol.switchedinquiry</address>
                        <durable>true</durable>
                </queue>
                <queue name="jms.queue.datahub.switchedinquiry-send">
                        <address>jms.queue.datahub.switchedinquiry-send</address>
                        <durable>true</durable>
                </queue>
        </queues>
        <!-- We set-up a bridge that forwards from a queue on this node to an address
                on another node. We specify a filter with the bridge, and a transformer too.
                The filter and transformer are optional -->
        <bridges>
                <bridge name="inquiry.bridge">
                        <queue-name>jms.queue.datahub.switchedinquiry-send</queue-name>
                        <forwarding-address>jms.queue.smartcontrol.switchedinquiry
                        </forwarding-address>
                        <reconnect-attempts>-1</reconnect-attempts>
                        <static-connectors>
                                <connector-ref>remote-connector</connector-ref>
                        </static-connectors>
                </bridge>
        </bridges>
        <security-settings>
                <!--security for example queue -->
                <security-setting match="jms.queue.#">
                        <permission type="createDurableQueue" roles="guest" />
                        <permission type="deleteDurableQueue" roles="guest" />
                        <permission type="createNonDurableQueue" roles="guest" />
                        <permission type="deleteNonDurableQueue" roles="guest" />
                        <permission type="consume" roles="guest" />
                        <permission type="send" roles="guest" />
                </security-setting>
        </security-settings>
        <address-settings>
                <address-setting match="jms.queue.smartcontrol.switchedinquiry">
                        <dead-letter-address>jms.queue.smartcontrol.switchedinquiryDLQ
                        </dead-letter-address>
                        <max-size-bytes>262144000</max-size-bytes>
                        <page-size-bytes>10485760</page-size-bytes>
                        <address-full-policy>PAGE</address-full-policy>
                </address-setting>
        </address-settings>
</configuration>

将hornetq-jms.xml文件

<configuration xmlns="urn:hornetq"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
        <connection-factory name="ConnectionFactory">
                <connectors>
                        <connector-ref connector-name="netty-connector" />
                </connectors>
                <entries>
                        <entry name="ConnectionFactory" />
                </entries>
        </connection-factory>
        <queue name="datahub.switched">
                <entry name="queue/datahub/switched" />
        </queue>
        <queue name="datahub.switchedinquiry-send">
                <entry name="queue/datahub/switchedinquiry-send" />
        </queue>
</configuration>

QSB

将hornetq-beans.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="urn:jboss:bean-deployer:2.0">
        <!-- MBean server -->
        <bean name="MBeanServer" class="javax.management.MBeanServer">
                <constructor factoryClass="java.lang.management.ManagementFactory"
                        factoryMethod="getPlatformMBeanServer" />
        </bean>
        <!-- The core configuration -->
        <bean name="Configuration" class="org.hornetq.core.config.impl.FileConfiguration">
        </bean>
        <!-- The security manager -->
        <bean name="HornetQSecurityManager"
                class="org.hornetq.spi.core.security.HornetQSecurityManagerImpl">
                <start ignored="true" />
                <stop ignored="true" />
        </bean>
        <!-- The core server -->
        <bean name="HornetQServer" class="org.hornetq.core.server.impl.HornetQServerImpl">
                <constructor>
                        <parameter>
                                <inject bean="Configuration" />
                        </parameter>
                        <parameter>
                                <inject bean="MBeanServer" />
                        </parameter>
                        <parameter>
                                <inject bean="HornetQSecurityManager" />
                        </parameter>
                </constructor>
                <start ignored="true" />
                <stop ignored="true" />
        </bean>
        <!-- The Stand alone server that controls the jndi server -->
        <bean name="StandaloneServer" class="org.hornetq.jms.server.impl.StandaloneNamingServer">
                <constructor>
                        <parameter>
                                <inject bean="HornetQServer" />
                        </parameter>
                </constructor>
                <property name="port">${jnp.port:1099}</property>
                <property name="bindAddress">${jnp.host:159.232.217.119}</property>
                <property name="rmiPort">${jnp.rmiPort:1098}</property>
                <property name="rmiBindAddress">${jnp.host:159.232.217.119}</property>
        </bean>
        <!-- The JMS server -->
        <bean name="JMSServerManager" class="org.hornetq.jms.server.impl.JMSServerManagerImpl">
                <constructor>
                        <parameter>
                                <inject bean="HornetQServer" />
                        </parameter>
                </constructor>
        </bean>
</deployment>

hornetq-configuration.xml文件

<configuration xmlns="urn:hornetq"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
        <paging-directory>${data.dir:../data}/paging_rsa</paging-directory>
        <bindings-directory>${data.dir:../data}/bindings_rsa
        </bindings-directory>
        <journal-directory>${data.dir:../data}/journal_rsa</journal-directory>
        <journal-min-files>10</journal-min-files>
        <large-messages-directory>${data.dir:../data}/large-messages_rsa
        </large-messages-directory>
        <connectors>
                <connector name="netty-connector">
                        <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory
                        </factory-class>
                        <param key="port" value="5446" />
                        <param key="host" value="159.232.217.119" />
                </connector>
                <!-- Connector to the other node -->
                <connector name="remote-connector-bridge">
                        <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory
                        </factory-class>
                        <param key="port" value="5445" />
                        <!-- <param key="host" value="159.232.3.62" /> -->
                        <param key="host" value="159.232.217.119" />
                </connector>
        </connectors>
        <!-- Acceptors -->
        <acceptors>
                <acceptor name="netty-acceptor">
                        <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory
                        </factory-class>
                        <param key="port" value="5446" />
                        <param key="host" value="159.232.217.119" />
                </acceptor>
        </acceptors>
        <queues>
                <!-- rsa queues -->
                <queue name="jms.queue.smartcontrol.switched-send">
                        <address>jms.queue.smartcontrol.switched-send</address>
                        <durable>true</durable>
                </queue>
                <!-- datahub queues -->
                <queue name="jms.queue.datahub.switched">
                        <address>jms.queue.datahub.switched</address>
                        <durable>true</durable>
                </queue>
        </queues>
        <!-- We set-up a bridge that forwards from a queue on this node to an address
                on another node. We specify a filter with the bridge, and a transformer too.
                The filter and transformer are optional -->
        <bridges>
                <bridge name="switched.bridge">
                        <queue-name>jms.queue.smartcontrol.switched-send</queue-name>
                        <forwarding-address>jms.queue.datahub.switched</forwarding-address>
                        <reconnect-attempts>-1</reconnect-attempts>
                        <static-connectors>
                                <connector-ref>remote-connector-bridge</connector-ref>
                        </static-connectors>
                </bridge>
        </bridges>
        <security-settings>
                <!--security for example queue -->
                <security-setting match="jms.queue.#">
                        <permission type="createDurableQueue" roles="guest" />
                        <permission type="deleteDurableQueue" roles="guest" />
                        <permission type="createNonDurableQueue" roles="guest" />
                        <permission type="deleteNonDurableQueue" roles="guest" />
                        <permission type="consume" roles="guest" />
                        <permission type="send" roles="guest" />
                </security-setting>
        </security-settings>
        <address-settings>
                <address-setting match="jms.queue.datahub.switched">
                        <dead-letter-address>jms.queue.datahub.switchedDLQ
                        </dead-letter-address>
                        <max-size-bytes>262144000</max-size-bytes>
                        <page-size-bytes>10485760</page-size-bytes>
                        <address-full-policy>PAGE</address-full-policy>
                </address-setting>
        </address-settings>
</configuration>

将hornetq-jms.xml文件

<configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
        <connection-factory name="ConnectionFactory">
                <connectors>
                        <connector-ref connector-name="netty-connector" />
                </connectors>
                <entries>
                        <entry name="ConnectionFactory" />
                </entries>
        </connection-factory>
        <queue name="smartcontrol.switched-send">
                <entry name="queue/smartcontrol/switched-send" />
        </queue>
        <queue name="smartcontrol.switchedinquiry">
                <entry name="queue/smartcontrol/switchedinquiry" />
        </queue>
</configuration>

0 个答案:

没有答案