1 Reply Latest reply on Apr 2, 2012 5:15 AM by ayushgupta

    Invoke stopdelivery on consumer of a queue

    ayushgupta

      I have a situation where I am monitoring the traffic on a queue,, and if it exceeds to a certain limit, then stopdelivery of consumer is to be invoked. can anybody help me, how can we invoke this method. Below is the code for my consumer.

       

      @Consumer(

                          activationConfig = {

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

                                    @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/SMMAlarmServer"),

                                    @ActivationConfigProperty(propertyName = "maxSession", propertyValue = RT.MAX_MDB_SESSION)

                          }

                )

                @Pool(value = PoolDefaults.POOL_IMPLEMENTATION_STRICTMAX, maxSize = RT.POOL_SIZE, timeout = 1000)

      public class AlarmServerMailBox  implements SMMAlarmServerQueue{

       

       

      @Remote

      @Producer

      public interface SMMAlarmServerQueue extends ModuleQueue{

       

      }

        • 1. Re: Invoke stopdelivery on consumer of a queue
          ayushgupta

          Yeah I found the answer.

           

          Context cntx = new InitialContext();

          rmiAdaptor = (RMIAdaptor) cntx.lookup("jmx/invoker/RMIAdaptor");

          String consumer = "jboss.j2ee:*,name=MyConsumer,service=EJB3";

          Set<ObjectName> queueMbeanObjects = rmiAdaptor.queryNames(new ObjectName(consumer ), null);

          for (ObjectName object : queueMbeanObjects){

                     

               rmiAdaptor.invoke(object, "stopDelivery", null, null);

          }