5 Replies Latest reply on Oct 7, 2013 4:19 AM by marcanthony

    Wildfly HornetQ control

    marcanthony

      Hi

       

      I am attempting to pause and resume HornetQ from within a servlet or EJB but I am running around in circles. Cannot find anything of helpful.

       

      Can someone please point me in the right direction.

       

      That is for a given queue not the entire broker.

       

      Thanks

       

      Marc

        • 1. Re: Wildfly HornetQ control
          jbertram

          Are you talking about pausing and resuming a particular queue or the entire broker?

           

          Have you read this?

          • 2. Re: Wildfly HornetQ control
            marcanthony

            That is for a given queue not the entire broker.

             

            MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();

                      

            SimpleString queueId = new SimpleString("org.hornetq:module=JMS,type=Queue,name=my queue");

             

            ObjectName on = ObjectNameBuilder.DEFAULT.getQueueObjectName(queueId, queueId);

             

            JMSQueueControl queueControl =

                 MBeanServerInvocationHandler.newProxyInstance(mbeanServer, on, JMSQueueControl.class, false)

             

             

            I am doing this in the right way?

            • 3. Re: Wildfly HornetQ control
              clebert.suconic

              First things first.. what version of HOrnetQ and Wildfly / JBoss?

              • 4. Re: Wildfly HornetQ control
                marcanthony

                Hi Clebert

                Wildfly alpha4, regarding hornetq I am not sure what version is bundled

                Thanks

                Marc

                • 5. Re: Wildfly HornetQ control
                  marcanthony

                  Hi Clebert / Justin

                   

                  I had not enabled JMX....

                   

                  is now working.

                   

                  But the pause method doesn't behave as i would of expected, the consumers continue to process the messages eve after i have invoked pause() on jmsqueuecontrol.

                   

                  Queue queue = (Queue)new InitialContext().lookup("jms/queue/MyQueue");

                             

                  ObjectName on = ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queue.getQueueName());

                   

                  MBeanServerConnection mbsc = ManagementFactory.getPlatformMBeanServer();

                   

                  JMSQueueControl queueControl = MBeanServerInvocationHandler.newProxyInstance(mbsc, on, JMSQueueControl.class, false);

                   

                  queueControl.pause();

                   

                  I guess that this could be related to consumer-window-size.

                   

                  Considering that the producer and consumers all reside on the server would it be alright to setr the value to 0 to avoid buffering

                   

                  thanks

                   

                  Marc