1 2 3 Previous Next 31 Replies Latest reply on Oct 15, 2009 11:03 AM by jmesnil

    HornetQ: Consuming messages from a remote JMS Topic

    robertjlee

      We have the following bridge, which pulls messages from a remote topic correctly, but does not then place them into a local queue - the messages simply disappear. At first we thought this was because there was no subscriber on the queue, but having added an MDB to log each message, it didn't pick up. Is this a bug or are we doing something wrong?

      We have also had no luck trying to get the MDBean to connect directly to the topic (which we'd rather not do anyway since the connection may be unreliable so we'd like to guarantee that as messages are pulled across as quickly as possible and cached in a queue before processing).

      The topic resides on a machine named "pinnet" and both servers are using HornetQ 2.0Beta5 under JBoss 5.

      Aside: We are trying to evaluate HornetQ as a possible replacement for JBoss MQ for use in a messaging system over the Internet (we have had significant problems with JBoss Messaging 1.x through firewalls). All the examples, including the JMS Bridge, seem to be moving messages between local queues. Is there any chance of a more useful example? (I'm not sure why you'd ever want to use a JMS Bridge on a local machine). It makes developing more complex situations quite hard.


      jms-bridge-jboss-beans.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <deployment xmlns="urn:jboss:bean-deployer:2.0">
      
       <bean name="PinnacleProIncomingDataHighPriorityQueueBridge" class="org.hornetq.jms.bridge.impl.JMSBridgeImpl">
       <!-- HornetQ must be started before the bridge -->
       <depends>HornetQServer</depends>
       <constructor>
       <!-- Source ConnectionFactory Factory -->
       <parameter>
       <inject bean="SourceCFF"/>
       </parameter>
       <!-- Target ConnectionFactory Factory -->
       <parameter>
       <inject bean="TargetCFF"/>
       </parameter>
       <!-- Source DestinationFactory -->
       <parameter>
       <inject bean="SourceDestinationFactory"/>
       </parameter>
       <!-- Target DestinationFactory -->
       <parameter>
       <inject bean="TargetDestinationFactory"/>
       </parameter>
       <!-- Source User Name (no username here) -->
       <parameter><null /></parameter>
       <!-- Source Password (no password here)-->
       <parameter><null /></parameter>
       <!-- Target User Name (no username here)-->
       <parameter><null /></parameter>
       <!-- Target Password (no password here)-->
       <parameter><null /></parameter>
       <!-- Selector -->
       <parameter>messagedestination is null or messagedestination='ALL' or messagedestination like '%,team3,%'</parameter>
       <!-- Failure Retry Interval (in ms) -->
       <parameter>5000</parameter>
       <!-- Max Retries -->
       <parameter>10</parameter>
       <!-- Quality Of Service -->
       <parameter>DUPLICATES_OK</parameter>
       <!-- Max Batch Size -->
       <parameter>500</parameter>
       <!-- Max Batch Time (-1 means infinite) -->
       <parameter>30000</parameter>
       <!-- Subscription name (no subscription name here)-->
       <parameter>PinnacleNetTopicProcessor</parameter>
       <!-- Client ID (no client ID here)-->
       <parameter>team3TopicClient</parameter>
       <!-- Add MessageID In Header -->
       <parameter>false</parameter>
       </constructor>
       <property name="transactionManager">
       <inject bean="RealTransactionManager"/>
       </property>
       </bean>
      
       <!-- SourceCFF describes the ConnectionFactory used to connect to the
       source destination -->
       <bean name="SourceCFF"
       class="org.hornetq.jms.bridge.impl.JNDIConnectionFactoryFactory">
       <constructor>
       <parameter>
       <inject bean="LocalJNDI" />
       </parameter>
       <parameter>/ConnectionFactory</parameter>
       </constructor>
       </bean>
      
       <!-- TargetCFF describes the ConnectionFactory used to connect to the
       target destination -->
       <bean name="TargetCFF"
       class="org.hornetq.jms.bridge.impl.JNDIConnectionFactoryFactory">
       <constructor>
       <parameter>
       <inject bean="LocalJNDI" />
       </parameter>
       <parameter>/ConnectionFactory</parameter>
       </constructor>
       </bean>
      
       <!-- SourceDestinationFactory describes the Destination used as the source -->
       <bean name="SourceDestinationFactory"
       class="org.hornetq.jms.bridge.impl.JNDIDestinationFactory">
       <constructor>
       <parameter>
       <inject bean="RemoteJNDI" />
       </parameter>
       <parameter>/topic/PinnacleNetTopic</parameter>
       </constructor>
       </bean>
      
       <!-- TargetDestinationFactory describes the Destination used as the target -->
       <bean name="TargetDestinationFactory"
       class="org.hornetq.jms.bridge.impl.JNDIDestinationFactory">
       <constructor>
       <parameter>
       <inject bean="LocalJNDI" />
       </parameter>
       <parameter>/queue/PinnacleNetIncomingDataHighPriorityQueue</parameter>
       </constructor>
       </bean>
      
       <!-- JNDI is a Hashtable containing the JNDI properties required -->
       <!-- to connect to the sources and targets JMS resrouces -->
       <bean name="LocalJNDI" class="java.util.Hashtable">
       <constructor class="java.util.Map">
       <map class="java.util.Hashtable" keyClass="java.lang.String"
       valueClass="java.lang.String">
       <entry>
       <key>java.naming.factory.initial</key>
       <value>org.jnp.interfaces.NamingContextFactory</value>
       </entry>
       <entry>
       <key>java.naming.provider.url</key>
       <value>jnp://localhost:1099</value>
       </entry>
       <entry>
       <key>java.naming.factory.url.pkgs</key>
       <value>org.jboss.naming:org.jnp.interfaces"</value>
       </entry>
       </map>
       </constructor>
       </bean>
      
       <!-- JNDI is a Hashtable containing the JNDI properties required -->
       <!-- to connect to the sources and targets JMS resrouces -->
       <bean name="RemoteJNDI" class="java.util.Hashtable">
       <constructor class="java.util.Map">
       <map class="java.util.Hashtable" keyClass="java.lang.String"
       valueClass="java.lang.String">
       <entry>
       <key>java.naming.factory.initial</key>
       <value>org.jnp.interfaces.NamingContextFactory</value>
       </entry>
       <entry>
       <key>java.naming.provider.url</key>
       <value>jnp://pinnet:1099</value>
       </entry>
       <entry>
       <key>java.naming.factory.url.pkgs</key>
       <value>org.jboss.naming:org.jnp.interfaces"</value>
       </entry>
       </map>
       </constructor>
       </bean>
      
      </deployment>


        • 1. Re: HornetQ: Consuming messages from a remote JMS Topic
          jmesnil

           

          "robertjlee" wrote:


          jms-bridge-jboss-beans.xml:
          
          ...
           <!-- SourceCFF describes the ConnectionFactory used to connect to the
           source destination -->
           <bean name="SourceCFF"
           class="org.hornetq.jms.bridge.impl.JNDIConnectionFactoryFactory">
           <constructor>
           <parameter>
           <inject bean="LocalJNDI" />
           </parameter>
           <parameter>/ConnectionFactory</parameter>
           </constructor>
           </bean>
          ...
          
           <!-- SourceDestinationFactory describes the Destination used as the source -->
           <bean name="SourceDestinationFactory"
           class="org.hornetq.jms.bridge.impl.JNDIDestinationFactory">
           <constructor>
           <parameter>
           <inject bean="RemoteJNDI" />
           </parameter>
           <parameter>/topic/PinnacleNetTopic</parameter>
           </constructor>
           </bean>
          



          From your use case, it seems the source ConnectionFactory should use the same JNDI environment than the source destination.
          Did you try to inject the RemoteJNDI bean into the SourceCFF instead?


          • 2. Re: HornetQ: Consuming messages from a remote JMS Topic
            robertjlee

            Yes, we tried it every way around. With both source connection factory and source destination set to RemoteJNDI, we get the below error on deploy, and no subscriber is created on the topic (and no messages are picked up). The combination we originally posted was the only one that let us pick up messages.

            Setting them both to be the same JNDI would make more sense to me, but I'm unclear about why we need both JNDI and the ConnectionFactory at all.

            17:21:02,388 WARNING [JMSBridgeImpl] Failed to set up bridge connections
            javax.jms.InvalidDestinationException: Topic PinnacleNetTopic does not exist
             at org.hornetq.jms.client.HornetQSession.createConsumer(HornetQSession.java:729)
             at org.hornetq.jms.client.HornetQSession.createDurableSubscriber(HornetQSession.java:673)
             at org.hornetq.jms.bridge.impl.JMSBridgeImpl.setupJMSObjects(JMSBridgeImpl.java:946)
             at org.hornetq.jms.bridge.impl.JMSBridgeImpl.start(JMSBridgeImpl.java:242)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
             at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
             at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
             at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:243)
             at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
             at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:111)
             at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72)
             at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
             at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
             at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
             at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
             at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
             at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
             at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
             at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1632)
             at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)
             at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)
             at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)
             at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:775)
             at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
             at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
             at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
             at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
             at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
             at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
             at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1440)
             at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1158)
             at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1179)
             at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1099)
             at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
             at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1632)
             at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)
             at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)
             at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)
             at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823)
             at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
             at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:782)
             at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
             at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
             at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
             at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
             at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:403)
             at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
             at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1632)
             at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)
             at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)
             at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)
             at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:775)
             at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
             at org.jboss.system.server.profileservice.repository.AbstractProfileService.registerProfile(AbstractProfileService.java:308)
             at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:256)
             at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
             at org.jboss.Main.boot(Main.java:221)
             at org.jboss.Main$1.run(Main.java:556)
             at java.lang.Thread.run(Thread.java:619)
            17:21:02,412 WARNING [JMSBridgeImpl] Failed to start bridge
            17:21:02,416 WARNING [JMSBridgeImpl] Will retry after a pause of 5000 ms
            
            ....
            
            17:21:07,276 INFO [ServerImpl] JBoss (Microcontainer) [5.0.0.BETA (build: SVNTag=JBPAPP_5_0_0_BETA date=200907301429)] Started in 32s:302ms
            Connected to server
            17:21:07,518 WARNING [JMSBridgeImpl] Failed to set up bridge connections
            javax.jms.InvalidDestinationException: Topic PinnacleNetTopic does not exist
             at org.hornetq.jms.client.HornetQSession.createConsumer(HornetQSession.java:729)
             at org.hornetq.jms.client.HornetQSession.createDurableSubscriber(HornetQSession.java:673)
             at org.hornetq.jms.bridge.impl.JMSBridgeImpl.setupJMSObjects(JMSBridgeImpl.java:946)
             at org.hornetq.jms.bridge.impl.JMSBridgeImpl.setupJMSObjectsWithRetry(JMSBridgeImpl.java:1086)
             at org.hornetq.jms.bridge.impl.JMSBridgeImpl.access$1500(JMSBridgeImpl.java:61)
             at org.hornetq.jms.bridge.impl.JMSBridgeImpl$FailureHandler.run(JMSBridgeImpl.java:1440)
             at java.lang.Thread.run(Thread.java:619)
            17:21:07,532 WARNING [JMSBridgeImpl] Failed to set up connections, will retry after a pause of 5000 ms
            



            • 3. Re: HornetQ: Consuming messages from a remote JMS Topic
              timfox

              I am curious as to why you are using a JMS bridge as opposed to a core bridge.

              • 4. Re: HornetQ: Consuming messages from a remote JMS Topic
                timfox

                From your posts it is unclear what you have installed on what machines.

                Please can you clarify what topics and queues you have on what machines, and on what machine you have installed the JMSBridge (btw the HornetQ JMS bridge is not an MBean, it is a POJO).

                As I mentioned in my previous post I am curious why you are using a JMS bridge for this. As the user manual describes, core bridges are faster and easier to configure than core bridges.

                We really only recommend JMS bridges for bridging between different messaging providers.

                • 5. Re: HornetQ: Consuming messages from a remote JMS Topic
                  robertjlee

                  Looking at the documentation, it reads as if a core bridge can only connect to a local queue (as the source).

                  We have a large (and, in practice, variable) number of consumers connecting to one central server, so to set up core bridges to send messages out, we'd need to maintain a set of bridges on the central server, which could be something of a headache, so we'd rather connect to a remote source topic than a local queue if possible (especially if adding a local queue would mean restarting the central server). I know that core bridges would be faster, but to be honest it's reliability we're after more than performance.


                  We are testing with two machines: "pinnet" just has a topic (/topic/PinnacleNetTopic), no bridge (plus the default DLQ and ExpiryQueue queues).

                  "team3" has the queue (/queue/PinnacleNetIncomingDataHighPriorityQueue), and also the bridge (plus the default DLQ and ExpiryQueue queues).

                  We are trying to copy any messages that match the selector from the topic on pinnet to the queue on team3.

                  • 6. Re: HornetQ: Consuming messages from a remote JMS Topic
                    jmesnil

                     

                    "robertjlee" wrote:
                    Yes, we tried it every way around. With both source connection factory and source destination set to RemoteJNDI, we get the below error on deploy, and no subscriber is created on the topic (and no messages are picked up). The combination we originally posted was the only one that let us pick up messages.

                    Setting them both to be the same JNDI would make more sense to me, but I'm unclear about why we need both JNDI and the ConnectionFactory at all.


                    Could you post your configuration files for your 2 machines (hornetq-beans.xml & hornetq-configuration.xml)? It seems there is an issue with your configuration (I suspect something related to localhost resolution)

                    • 7. Re: HornetQ: Consuming messages from a remote JMS Topic
                      timfox

                      Also please post your jms-ds.xml from both machines (saying which one is which)

                      • 8. Re: HornetQ: Consuming messages from a remote JMS Topic
                        robertjlee

                        On team3, if I ping localhost I get ::1 - pinnet is an older machine and resolves localhost to 127.0.0.1. Is this a problem with mixing IPv4 and IPv6 on the same network?

                        The configuration files are as follows:

                        pinnet/hornetq-jboss-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="org.jboss.mx.util.MBeanServerLocator"
                         factoryMethod="locateJBoss"/>
                         </bean>
                        
                         <!-- The core configuration -->
                         <bean name="Configuration" class="org.hornetq.core.config.impl.FileConfiguration"/>
                        
                         <!-- The security manager -->
                         <bean name="HornetQSecurityManager" class="org.hornetq.integration.security.JBossASSecurityManager">
                         <depends>JBossSecurityJNDIContextEstablishment</depends>
                         <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 JMS server -->
                         <bean name="JMSServerManager" class="org.hornetq.jms.server.impl.JMSServerManagerImpl">
                         <constructor>
                         <parameter>
                         <inject bean="HornetQServer"/>
                         </parameter>
                         </constructor>
                         </bean>
                        
                        </deployment>



                        pinnet/hornetq-configuration.xml:
                        - we set hornetq.remoting.netty.host=0.0.0.0, others undefined

                        <configuration xmlns="urn:hornetq"
                         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                         xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
                        
                         <bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>
                        
                         <journal-directory>${jboss.server.data.dir}/hornetq/journal</journal-directory>
                        
                         <large-messages-directory>${jboss.server.data.dir}/hornetq/largemessages</large-messages-directory>
                        
                         <paging-directory>${jboss.server.data.dir}/hornetq/paging</paging-directory>
                        
                         <security-enabled>false</security-enabled>
                        
                         <connectors>
                         <connector name="netty">
                         <factory-class>org.hornetq.integration.transports.netty.NettyConnectorFactory</factory-class>
                         <param key="hornetq.remoting.netty.host" value="${hornetq.remoting.netty.host:localhost}" type="String"/>
                         <param key="hornetq.remoting.netty.port" value="${hornetq.remoting.netty.port:5445}" type="Integer"/>
                         </connector>
                        
                         <connector name="in-vm">
                         <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
                         </connector>
                        
                         </connectors>
                        
                         <acceptors>
                         <acceptor name="netty">
                         <factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class>
                         <param key="hornetq.remoting.netty.host" value="${hornetq.remoting.netty.host:localhost}" type="String"/>
                         <param key="hornetq.remoting.netty.port" value="${hornetq.remoting.netty.port:5445}" type="Integer"/>
                         </acceptor>
                        
                         <acceptor name="in-vm">
                         <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
                         <param key="hornetq.remoting.invm.serverid" value="0" type="Integer"/>
                         </acceptor>
                        
                         </acceptors>
                        
                         <security-settings>
                         <security-setting match="#">
                         <permission type="createDurableQueue" roles="guest"/>
                         <permission type="deleteDurableQueue" roles="guest"/>
                         <permission type="consume" roles="guest"/>
                         <permission type="send" roles="guest"/>
                         </security-setting>
                         </security-settings>
                        
                         <address-settings>
                         <!--default for catch all-->
                         <address-setting match="#">
                         <clustered>false</clustered>
                         <dead-letter-address>jms.queue.DLQ</dead-letter-address>
                         <expiry-address>jms.queue.ExpiryQueue</expiry-address>
                         <redelivery-delay>0</redelivery-delay>
                         <max-size-bytes>-1</max-size-bytes>
                         <page-size-bytes>10485760</page-size-bytes>
                         <distribution-policy-class>org.hornetq.core.server.impl.RoundRobinDistributor</distribution-policy-class>
                         <message-counter-history-day-limit>10</message-counter-history-day-limit>
                         </address-setting>
                         </address-settings>
                        
                        </configuration>


                        pinnet/jms-ds.xml:
                        <connection-factories>
                         <!--
                         JMS Stuff
                         -->
                        
                         <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="hornetq:service=JMSProviderLoader,name=JMSProvider">
                         <attribute name="ProviderName">DefaultJMSProvider</attribute>
                         <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
                         <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>
                         <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
                         <attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>
                         </mbean>
                         <!--
                         JMS XA Resource adapter, use this to get transacted JMS in beans
                         -->
                         <tx-connection-factory>
                         <jndi-name>JmsXA</jndi-name>
                         <xa-transaction/>
                         <rar-name>jms-ra.rar</rar-name>
                         <connection-definition>org.hornetq.ra.HornetQRAConnectionFactory</connection-definition>
                         <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
                         <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
                         <max-pool-size>20</max-pool-size>
                         <security-domain-and-application>JmsXARealm</security-domain-and-application>
                         </tx-connection-factory>
                        </connection-factories>



                        team3/hornetq-jboss-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="org.jboss.mx.util.MBeanServerLocator"
                         factoryMethod="locateJBoss"/>
                         </bean>
                        
                         <!-- The core configuration -->
                         <bean name="Configuration" class="org.hornetq.core.config.impl.FileConfiguration"/>
                        
                         <!-- The security manager -->
                         <bean name="HornetQSecurityManager" class="org.hornetq.integration.security.JBossASSecurityManager">
                         <depends>JBossSecurityJNDIContextEstablishment</depends>
                         <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 JMS server -->
                         <bean name="JMSServerManager" class="org.hornetq.jms.server.impl.JMSServerManagerImpl">
                         <constructor>
                         <parameter>
                         <inject bean="HornetQServer"/>
                         </parameter>
                         </constructor>
                         </bean>
                        
                        </deployment>



                        team3/hornetq-configuration.xml:
                        <configuration xmlns="urn:hornetq"
                         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                         xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
                        
                         <bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>
                        
                         <journal-directory>${jboss.server.data.dir}/hornetq/journal</journal-directory>
                        
                         <large-messages-directory>${jboss.server.data.dir}/hornetq/largemessages</large-messages-directory>
                        
                         <paging-directory>${jboss.server.data.dir}/hornetq/paging</paging-directory>
                        
                         <security-enabled>false</security-enabled>
                        
                         <connectors>
                         <connector name="netty">
                         <factory-class>org.hornetq.integration.transports.netty.NettyConnectorFactory</factory-class>
                         <param key="hornetq.remoting.netty.host" value="${hornetq.remoting.netty.connectorhost:localhost}" type="String"/>
                         <param key="hornetq.remoting.netty.port" value="${hornetq.remoting.netty.port:5445}" type="Integer"/>
                         </connector>
                        
                         <connector name="in-vm">
                         <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
                         </connector>
                        
                         </connectors>
                        
                         <acceptors>
                         <acceptor name="netty">
                         <factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class>
                         <param key="hornetq.remoting.netty.host" value="${hornetq.remoting.netty.acceptorhost:localhost}" type="String"/>
                         <param key="hornetq.remoting.netty.port" value="${hornetq.remoting.netty.port:5445}" type="Integer"/>
                         </acceptor>
                        
                         <acceptor name="in-vm">
                         <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
                         <param key="hornetq.remoting.invm.serverid" value="0" type="Integer"/>
                         </acceptor>
                        
                         </acceptors>
                        
                         <security-settings>
                         <security-setting match="#">
                         <permission type="createDurableQueue" roles="guest"/>
                         <permission type="deleteDurableQueue" roles="guest"/>
                         <permission type="createTempQueue" roles="guest"/>
                         <permission type="deleteTempQueue" roles="guest"/>
                         <permission type="consume" roles="guest"/>
                         <permission type="send" roles="guest"/>
                         </security-setting>
                         </security-settings>
                        
                         <address-settings>
                         <!--default for catch all-->
                         <address-setting match="#">
                         <clustered>false</clustered>
                         <dead-letter-address>jms.queue.DLQ</dead-letter-address>
                         <expiry-address>jms.queue.ExpiryQueue</expiry-address>
                         <redelivery-delay>0</redelivery-delay>
                         <max-size-bytes>-1</max-size-bytes>
                         <page-size-bytes>10485760</page-size-bytes>
                         <distribution-policy-class>org.hornetq.core.server.impl.RoundRobinDistributor</distribution-policy-class>
                         <message-counter-history-day-limit>10</message-counter-history-day-limit>
                         </address-setting>
                         </address-settings>
                        
                        </configuration>


                        team3/jms-ds.xml:
                        <connection-factories>
                         <!--
                         JMS Stuff
                         -->
                        
                         <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="hornetq:service=JMSProviderLoader,name=JMSProvider">
                         <attribute name="ProviderName">DefaultJMSProvider</attribute>
                         <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
                         <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>
                         <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
                         <attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>
                         </mbean>
                         <!--
                         JMS XA Resource adapter, use this to get transacted JMS in beans
                         -->
                         <tx-connection-factory>
                         <jndi-name>JmsXA</jndi-name>
                         <xa-transaction/>
                         <rar-name>jms-ra.rar</rar-name>
                         <connection-definition>org.hornetq.ra.HornetQRAConnectionFactory</connection-definition>
                         <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
                         <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
                         <max-pool-size>20</max-pool-size>
                         <security-domain-and-application>JmsXARealm</security-domain-and-application>
                         </tx-connection-factory>
                        </connection-factories>


                        • 9. Re: HornetQ: Consuming messages from a remote JMS Topic
                          timfox

                          A few observations-

                          You are telling the acceptors on both machines to listen for incoming connections on the address localhost.

                          localhost won't be visible from other machines, so they won't be able to connect.

                          Same with your connectors.

                          • 10. Re: HornetQ: Consuming messages from a remote JMS Topic
                            timfox

                            Probably a good place to start is to learn a bit about what acceptors and connectors mean, there's a chapter in the user manual on this:

                            http://hornetq.sourceforge.net/docs/hornetq-2.0.0.BETA5/user-manual/en/html/configuring-transports.html

                            • 11. Re: HornetQ: Consuming messages from a remote JMS Topic
                              timfox

                              Other observations:

                              You're bridge config also looks wrong.

                              You've described that your bridge is on team3 and your source topic is on remote machine pinnet, however your bridge config is using *localJNDI* to lookup the source connection factory - but this is on pinnet - which is remote.

                              • 12. Re: HornetQ: Consuming messages from a remote JMS Topic
                                robertjlee

                                 

                                "timfox" wrote:
                                A few observations-

                                You are telling the acceptors on both machines to listen for incoming connections on the address localhost.


                                As stated, we set hornetq.remoting.netty.host=0.0.0.0, so pinnet is listening for incoming connections on any address, port 5445 (verified by netstat).

                                I also forgot to mention that we set set hornetq.remoting.netty.connectorhost=pinnet on the team3 machine, and hornetq.remoting.netty.acceptorhost=0.0.0.0. Again, we can see with netstat that the java is listening on the port.

                                When the bridge starts up, we can see with netstat the an "ESTABLISHED" connection is made from team3 to pinnet.


                                • 13. Re: HornetQ: Consuming messages from a remote JMS Topic
                                  timfox

                                   

                                  "robertjlee" wrote:
                                  "timfox" wrote:
                                  A few observations-

                                  You are telling the acceptors on both machines to listen for incoming connections on the address localhost.


                                  As stated, we set hornetq.remoting.netty.host=0.0.0.0, so pinnet is listening for incoming connections on any address, port 5445 (verified by netstat).

                                  I also forgot to mention that we set set hornetq.remoting.netty.connectorhost=pinnet on the team3 machine, and hornetq.remoting.netty.acceptorhost=0.0.0.0. Again, we can see with netstat that the java is listening on the port.

                                  When the bridge starts up, we can see with netstat the an "ESTABLISHED" connection is made from team3 to pinnet.


                                  0.0.0.0 is not a valid address for an acceptor. If you want to bind to all addresses you need to specify them all in a comma separated form.

                                  Also you're specifying 0.0.0.0 for the connector on pinnet. 0.0.0.0 is also not a valid address for a connector. You need to specify the actual address (or host) that you wish team3 to connect to on pinnet.

                                  • 14. Re: HornetQ: Consuming messages from a remote JMS Topic
                                    robertjlee

                                     

                                    "timfox" wrote:
                                    0.0.0.0 is not a valid address for an acceptor. If you want to bind to all addresses you need to specify them all in a comma separated form.

                                    Also you're specifying 0.0.0.0 for the connector on pinnet. 0.0.0.0 is also not a valid address for a connector. You need to specify the actual address (or host) that you wish team3 to connect to on pinnet.


                                    Okay, we've taken out 0.0.0.0 everywhere and replaced with the appropriate IP addresses. (By the way, the documentation doesn't seem to mention a comma-separated list).

                                    At first, changing the IP addresses doesn't seem to have changed the behaviour at all. When we use "RemoteJNDI" for both the SourceCFF and SourceDestinationFactory, we get the error message "Topic not bound". When we use "LocalJNDI" for SourceCFF then it DOES connect to the server and create a consumer (and a queue named team3TopicClient.PinnacleNetTopicProcessor), and consumes messages, but does not republish them to the queue.

                                    After some messing around, we have it working. (Incidentally, we got a core bridge working on a single machine between two queues in different HornetQ servers yesterday, and the JMS Bridge seems faster for some reason!)

                                    To get it to work, we had to set SourceCFF to "LocalJNDI" and TargetCFF to "RemoteJNDI" - I have no idea why this works, since the source is on the remote server and the target is on the local server.

                                    However, we have now found and run the example for the JMS Bridge, and we get this error:

                                    Exception in thread "main" javax.naming.NameNotFoundException: source not bound
                                     at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
                                     at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
                                     at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
                                     at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
                                     at org.jnp.server.NamingServer.lookup(NamingServer.java:399)
                                     at sun.reflect.GeneratedMethodAccessor122.invoke(Unknown Source)
                                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                     at java.lang.reflect.Method.invoke(Method.java:597)
                                     at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
                                     at sun.rmi.transport.Transport$1.run(Transport.java:159)
                                     at java.security.AccessController.doPrivileged(Native Method)
                                     at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
                                     at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
                                     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
                                     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
                                     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
                                     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
                                     at java.lang.Thread.run(Thread.java:619)
                                     at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
                                     at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
                                     at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
                                     at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
                                     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
                                     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
                                     at javax.naming.InitialContext.lookup(InitialContext.java:392)
                                     at org.hornetq.javaee.example.JMSBridgeExample.main(JMSBridgeExample.java:46)
                                    



                                    Our working configuration:
                                    ...
                                    
                                     <!-- SourceCFF describes the ConnectionFactory used to connect to the
                                     source destination -->
                                     <bean name="SourceCFF"
                                     class="org.hornetq.jms.bridge.impl.JNDIConnectionFactoryFactory">
                                     <constructor>
                                     <parameter>
                                     <inject bean="LocalJNDI" />
                                     </parameter>
                                     <parameter>/ConnectionFactory</parameter>
                                     </constructor>
                                     </bean>
                                    
                                     <!-- TargetCFF describes the ConnectionFactory used to connect to the
                                     target destination -->
                                     <bean name="TargetCFF"
                                     class="org.hornetq.jms.bridge.impl.JNDIConnectionFactoryFactory">
                                     <constructor>
                                     <parameter>
                                     <inject bean="RemoteJNDI" />
                                     </parameter>
                                     <parameter>/ConnectionFactory</parameter>
                                     </constructor>
                                     </bean>
                                    
                                     <!-- SourceDestinationFactory describes the Destination used as the source -->
                                     <bean name="SourceDestinationFactory"
                                     class="org.hornetq.jms.bridge.impl.JNDIDestinationFactory">
                                     <constructor>
                                     <parameter>
                                     <inject bean="RemoteJNDI" />
                                     </parameter>
                                     <parameter>/topic/PinnacleNetTopic</parameter>
                                     </constructor>
                                     </bean>
                                    
                                     <!-- TargetDestinationFactory describes the Destination used as the target -->
                                     <bean name="TargetDestinationFactory"
                                     class="org.hornetq.jms.bridge.impl.JNDIDestinationFactory">
                                     <constructor>
                                     <parameter>
                                     <inject bean="LocalJNDI" />
                                     </parameter>
                                     <parameter>/queue/PinnacleNetIncomingDataHighPriorityQueue</parameter>
                                     </constructor>
                                     </bean>
                                    
                                    ...
                                    
                                    


                                    team3/hornetq-configuration.xml:

                                    ...
                                    
                                     <connectors>
                                     <connector name="netty-connector">
                                     <factory-class>org.hornetq.integration.transports.netty.NettyConnectorFactory</factory-class>
                                     <param key="hornetq.remoting.netty.host" value="192.168.1.19" type="String"/>
                                     <param key="hornetq.remoting.netty.port" value="${hornetq.remoting.netty.port:5445}" type="Integer"/>
                                     </connector>
                                    
                                     <connector name="in-vm">
                                     <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
                                     </connector>
                                     </connectors>
                                    
                                     <acceptors>
                                     <acceptor name="netty-acceptor">
                                     <factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class>
                                     <param key="hornetq.remoting.netty.host" value="192.168.1.178,127.0.0.1" type="String"/>
                                     <param key="hornetq.remoting.netty.port" value="${hornetq.remoting.netty.port:5445}" type="Integer"/>
                                     </acceptor>
                                    
                                     <acceptor name="in-vm">
                                     <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
                                     <param key="hornetq.remoting.invm.serverid" value="0" type="Integer"/>
                                     </acceptor>
                                    
                                     </acceptors>
                                    
                                    ...
                                    
                                    


                                    pinnet/hornetq-configuration.xml:

                                    
                                    ...
                                    
                                     <connectors>
                                     <connector name="netty-connector">
                                     <factory-class>org.hornetq.integration.transports.netty.NettyConnectorFactory</factory-class>
                                     <param key="hornetq.remoting.netty.host" value="localhost" type="String"/>
                                     <param key="hornetq.remoting.netty.port" value="5445" type="Integer"/>
                                     </connector>
                                    
                                     <connector name="pinnet-Team3">
                                     <factory-class>org.hornetq.integration.transports.netty.NettyConnectorFactory</factory-class>
                                     <param key="hornetq.remoting.netty.host" value="192.168.1.178" type="String"/>
                                     <param key="hornetq.remoting.netty.port" value="5445" type="Integer"/>
                                     </connector>
                                    
                                     <connector name="in-vm">
                                     <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
                                     </connector>
                                     </connectors>
                                    
                                     <acceptors>
                                     <acceptor name="netty-acceptor">
                                     <factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class>
                                     <param key="hornetq.remoting.netty.host" value="localhost,192.168.1.19" type="String"/>
                                     <param key="hornetq.remoting.netty.port" value="5445" type="Integer"/>
                                     </acceptor>
                                    
                                     <acceptor name="in-vm">
                                     <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
                                     <param key="hornetq.remoting.invm.serverid" value="0" type="Integer"/>
                                     </acceptor>
                                    
                                     </acceptors>
                                    
                                    ...
                                    
                                    


                                    1 2 3 Previous Next