0 Replies Latest reply on May 15, 2014 9:25 AM by Janice Alvares

    How to programmatically stop running MDB?

    Janice Alvares Newbie

      Hi everybody,

       

      I had a query regarding stopping and starting MDB.

      I have tried the following code :

       

      1. ObjectName objectName; 
      2. try
      3. objectName = new ObjectName( 
      4. "jboss.j2ee:binding=message-driven-bean, jndiName=jms/SSMListener, plugin=invoker,service=EJB"); 
      5. MBeanServer server = MBeanServerLocator.locateJBoss(); 
      6. server.invoke(objectName, "stopDelivery", new Object[] {}, null); 
      7. } catch (MalformedObjectNameException e1) { 
      8. // TODO Auto-generated catch block 
      9. e1.printStackTrace(); 
      10. } catch (NullPointerException e1) { 
      11. // TODO Auto-generated catch block 
      12. e1.printStackTrace(); 
      13. } catch (InstanceNotFoundException e) { 
      14. // TODO Auto-generated catch block 
      15. e.printStackTrace(); 
      16. } catch (MBeanException e) { 
      17. // TODO Auto-generated catch block 
      18. e.printStackTrace(); 
      19. } catch (ReflectionException e) { 
      20. // TODO Auto-generated catch block 
      21. e.printStackTrace(); 

       

       

      But this does't seem to work.There is no exception thrown and the status of the deliveryActive() flag for the MDB on JMX console remains true?

      Any pointers on this will be greatly appreciated.

       

      Thanks!