2 Replies Latest reply on Jul 25, 2008 3:16 PM by busrider2008

    ActiveMQ as JMS-Provider in HelloWorld example

    lex-raven

      Hey everyone,

      I am new to the community and am currently using the JBoss ESB 4.3 in the JBoss AS 4.2.2. I want to add an ActiveMQ as a JMS-Provider in the HelloWorld example.

      I downloaded the ActiveMQ Version 4.1.0 and installed the two JAR files in the following directory:

      jboss-4.2.2.GA\server\default\lib

      Then I added the following code jboss-esb.xml

       <jms-provider name="ActiveMQ"
       connection-factory="ConnectionFactory"
       jndi-context-factory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
       jndi-URL="tcp://localhost:61616">
      
       <jms-bus busid="AMQ">
       <jms-message-filter dest-type="QUEUE" dest-name="AMQ-Test" />
       </jms-bus>
      
       </jms-provider>
      


      I have also inserted the following code into jbmq-queue-service.xml

      
       <mbean code="org.jboss.mq.server.jmx.Queue"
       name="jboss.esb.quickstart.destination:service=Queue,name=AMQ">
       <depends optional-attribute-name="DestinationManager">
       jboss.mq:service=DestinationManager
       </depends>
       </mbean>
      


      The running terminal shows:

      
      23:02:06,296 INFO [JBoss4ESBDeployer] create esb service, Quickstart_helloworld.esb
      23:02:06,312 INFO [quickstart_helloworld_Request_esb] Bound to JNDI name: queue/quickstart_helloworld_Request_esb
      23:02:06,328 INFO [quickstart_helloworld_Request_gw] Bound to JNDI name: queue/quickstart_helloworld_Request_gw
      23:02:06,453 INFO [JDBCDataStore] Generated token 'authToken:4CBCBA50-448C-11DD-BA50-F6D2BB1C6B97' for user: 'jbossesb/JBoss ESB User'
      23:02:06,625 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
      23:02:06,625 INFO [AMQ] Bound to JNDI name: queue/AMQ
      


      My problem is that I cannot connect to the ActiveMQ-queue through a small Java-Client.
      I am not quite sure how I can use ActiveMQ in the JBoss ESB.
      On the ActiveMQ website I found a "HowTo" that shows you how to switch completely from the default JMS to ActiveMQ, but I do not want to completely switch, I only want to provide a second queue in addition to my default queues.

      I could not find a configuration solution for my problem by searching the internet that is why it would be great if you guys could help me.

      I read the administration guide but unfortunately it could not help me solve my problem at all.

      Thanks in advance for your answers.

      Best regards,
      Lex



        • 1. Re: ActiveMQ as JMS-Provider in HelloWorld example
          kurtstam

          Hi Lex,

          The jbmq-queue-service.xml is to bring up a Queue using JBossMessaging.

          It's up to you to bring up the ActiveMQ provider/producer. JBossESB will connect to it, using the settings mentioned in the Admin Guide.

          Hope this helps.

          Cheers,

          --Kurt

          • 2. Re: ActiveMQ as JMS-Provider in HelloWorld example
            busrider2008

            Actually the config file you are using is for JBossMQ not JBoss Messaging as mentioned previously.

            I had the same issues trying to get a client working so here were the steps that I followed to get it to work:

            -I downloaded the ActiveMQ 5.0 package off the Apache site.
            -Exploded that package into my file system to c:\activemq-5.1.0\
            -Took the c:\activemq-5.1.0\lib\optional\activemq-rar-5.1.0.rar and played with the configuration in the ra.xml and broker-config.xml to match my local instance of the ESB
            -Deployed that rar file into the JBOSS_HOME\server\default\deploy directory
            -This should startup a message if inbound/outbound queues in the std out log and you should see the name of the broker you configured come up as "broker started"

            In my project
            -Changed the main line of the jboss-esb.xml to the following:
            <jms-provider name="ActiveMQ" connection-factory="ConnectionFactory" jndi-context-factory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndi-URL="tcp://localhost:61616">

            Note - you can also use vm://localhost instead of TCP but I have had out of memory PermGen errors when I do so

            -Deployed my .esb file into ESB and then ran my test harness from another command prompt.

            I noticed it is finicky (probably because I am truly missing a step somewhere) and restarting the AS usually turns off the listener so you either need to go into the activemq-rar-5.1.0.rar and touch the file/redeploy it so it can start again or configure it to be an mbean for automagic starting....