6 Replies Latest reply on Mar 9, 2011 1:17 PM by wolfc

    Creating a JMS queue?

    wolfc

      How do I create a HornetQ queue from within my Arquillian junit test case?

        • 1. Re: Creating a JMS queue?
          kpiwko

          Hi Carlo,

           

          In upcoming Arquillian Release there will be ability to multiple bits and to deploy Descriptors, which are DSL specified XML files. You could be able to create a *-hornetq-jms.xml file which would be deployed/undeployed from/to AS by Arquillian.

           

          I would suggest filling a JIRA in SHRINKDESC project https://issues.jboss.org/browse/SHRINKDESC/ so the need of HornetQ descriptor can be tracked.

           

          It would look similar to:

           

          @Deployment(order = 1)
          public static Descriptor createHQQueue() {
               return Descriptors.(HornetQDescriptor.class)
                         .queue("MyQueue")
                             .entry("foo/bar");
          
          @Deployment(order = 2)
          public static Archive<?> createWar() {
               return ShrinkWrap.create(WebArchive.class)
                    ...;
          }
          
          

           

          If you want to, you can build arquillian/next and try it on your own using instructions at ARQ-370.

          1 of 1 people found this helpful
          • 2. Re: Creating a JMS queue?
            wolfc

            Minor typo in the createHQQueue method:

            @Deployment(order = 1)
            public static Descriptor createHQQueue() {
                 return Descriptors.create(HornetQDescriptor.class)
                           .queue("MyQueue")
                               .entry("foo/bar");
            }
            
            
            • 3. Creating a JMS queue?
              wolfc

              Opened up https://issues.jboss.org/browse/SHRINKDESC-35

               

              And put up some code here https://github.com/wolfc/descriptors-hornetq

               

              I've named the descriptor HornetQJMSDescriptor, because HornetQ also has a configuration descriptor.

              • 4. Creating a JMS queue?
                kpiwko

                Great work! Thanks.

                Carlo de Wolf wrote:

                 

                Opened up https://issues.jboss.org/browse/SHRINKDESC-35

                 

                And put up some code here https://github.com/wolfc/descriptors-hornetq

                 

                I've named the descriptor HornetQJMSDescriptor, because HornetQ also has a configuration descriptor.

                • 5. Creating a JMS queue?
                  aslak

                  I do wonder if we should add a JMS abstraction on top of this, some what like the Persistence XML that knows about vendor specifics.

                   

                  The user/arq 'plugin' only has to swap the type to deploy to JBoss 5(JBoss Messaging), JBoss 6(HornetQ) or GlassFish(OpenMQ).

                   

                  e.g.

                   

                  @Deployment(order = 1)
                  public static Descriptor createHQQueue() {
                       return Descriptors.create(MessagingDescriptor.class)

                                 .type(JBoss_HornetQ)
                                 .queue("MyQueue")
                                     .entry("foo/bar");
                  }


                  • 6. Creating a JMS queue?
                    wolfc

                    For reference, here is the old bridge from the old test tools:

                    http://anonsvn.jboss.org/repos/jbossas/projects/test/trunk/src/main/java/org/jboss/test/jms/

                     

                    It does both JBoss Messaging and HornetQ.