11 Replies Latest reply on Aug 15, 2014 2:43 PM by llpd

    JBoss EAP 6 and Oracle AQ

    llpd

      We migrating from Weblogic 10 to JBoss EAP 6 and we have Oracle AQ queues we need to be able to listener to on Jboss, at the moment I managed to bind the queue and  connection factory to the JNDI and I'm also able to lookup the name and put the messages into the queue.

       

      The issue comes in when I add the MDB to listen to the queue, nothing happens to the messages.

       

      this is how my MDB looks like:

       

      @MessageDriven (mappedName="jboss.test.queue", name="TestMDB",

                      activationConfig= {

                      @ActivationConfigProperty(propertyName="destinationType",propertyValue="javax.jms.Queue"),

                      @ActivationConfigProperty(propertyName="destination", propertyValue="java:/jboss.test.queue")})

      public class TestMDB implements MessageListener

      {

        @Resource

        private MessageDrivenContext context;

       

        public void onMessage(Message msg)

        {

          // TODO Auto-generated method stub

          TextMessage textMessage = (TextMessage)msg;

          System.out.println("****MDB***: Got the message " + textMessage);

        }

       

       

       

       

        public void ejbRemove() throws EJBException

        {

          // TODO Auto-generated method stub

        

        }

       

       

      }

       

      And when I start the server i can see the following message on the console:

       

       

      15:06:48,977 INFO  [org.jboss.as.ejb3] (MSC service thread 1-3) JBAS014142: Started message driven bean 'TestMDB' with 'hornetq-ra' resource adapter

       

      I need to know what need to be done to be able to consume messages.

       

      Regards

        • 1. Re: JBoss EAP 6 and Oracle AQ
          nickarls

          So what is the problem? You send messages but they are never recieved (attach message sending code)?

          • 2. Re: JBoss EAP 6 and Oracle AQ
            llpd

            I send the message and I can see the messages in my oracle AQ queue by running select from queue table, the issue is it doesnt get picked by MDB.

             

            here is code I use to put message into the queue:

            .

            .

            Context ctx = null;

                QueueSender queueSender = null;

                Properties props = new Properties();

                try

                {

                  props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

                  props.put(Context.PROVIDER_URL, "remote://localhost:4447");

             

             

                  ctx = new InitialContext(props);

                  Object obj = ctx.lookup("java:/jboss.test.ConnectionFactory");

                  System.out.println(obj);

                  XAQueueConnectionFactory xaQueueConnectionFactory = (DiscXAQueueConnectionFactory) obj;

             

             

                  XAQueueConnection xaConnection = xaQueueConnectionFactory.createXAQueueConnection();

             

             

                  XAQueueSession xaSession = xaConnection.createXAQueueSession();

             

             

                  Queue queue = (Queue) ctx.lookup("java:/jboss.test.queue");

             

             

                  QueueSession session = xaSession.getQueueSession();

                  queueSender = session.createSender(queue);

                  xaConnection.start();

             

             

                  TextMessage tm = session.createTextMessage();

             

                  tm.setText("My test message");

             

             

                  queueSender.send(tm);

                }

                catch (Exception e)

                {

                  throw new CommandException(e);

                }

                finally

                {

                  if ( ctx != null )

                  {

                    try

                    {

                      ctx.close();

                    }

                    catch (NamingException e)

                    {

                      // TODO Auto-generated catch block

                      e.printStackTrace();

                    }

                  }

                }

            • 3. Re: JBoss EAP 6 and Oracle AQ
              nickarls

              Try cranking up the related log levels and see if it leaves any traces.

              • 4. Re: JBoss EAP 6 and Oracle AQ
                llpd

                I suspect is got to do with the fact that my Jboss is using the default resource adapter(hornetq-ra) for MDB, trying to see if I can put one together and specify it on my MDB.

                • 5. Re: JBoss EAP 6 and Oracle AQ
                  jaikiran

                  You can use the @org.jboss.ejb3.annotation.ResourceAdapter to specify a custom RA. By default it uses the HornetQ RA.

                  • 6. Re: JBoss EAP 6 and Oracle AQ
                    llpd

                    Busy following instructions from https://github.com/jbertram/generic-jms-ra , will see how it goes. thanks

                    • 7. Re: JBoss EAP 6 and Oracle AQ
                      llpd

                      Managed to sort it out using generic JMS ra

                      • 8. Re: JBoss EAP 6 and Oracle AQ
                        msulliv1

                        Can you share notes/configuration on how you got this to work?

                        • 9. Re: JBoss EAP 6 and Oracle AQ
                          llpd

                          Since my queue and connection factory were already bind to the JNDI, al i had to do was to put some activation properties on my MDB like below:

                           

                          @MessageDriven(name="my-mdb",

                                activationConfig={

                              @ActivationConfigProperty(propertyName="destinationType",propertyValue="javax.jms.Queue"),

                              @ActivationConfigProperty(propertyName="destination", propertyValue="java:/queue.test"),

                              @ActivationConfigProperty(propertyName="jndiParameters", propertyValue="java.naming.factory.url.pkgs=org.jboss.ejb.client.naming"),

                              @ActivationConfigProperty(propertyName="connectionFactory", propertyValue="java:/test.connectionFactory")

                                  })

                          @ResourceAdapter("generic-jms-ra.rar")

                           

                          Hope that helps.

                          • 10. Re: JBoss EAP 6 and Oracle AQ
                            inet_gbo

                            Hi,

                             

                            How did you bind the queue and  connection factory to the JNDI?

                            It would be great if you could share it.

                             

                            Thanks

                            Günther

                            • 11. Re: JBoss EAP 6 and Oracle AQ
                              llpd

                              We wrote custom driver that have thread that keep pooling the database and feeding the messages to the MDB.