wildflywildfly-8message-driven-beanapplication-shutdownjboss-mdb

In Wildfly 9 is there a way to suspend only certain MDB


I am able to call :suspend and :resume from the cli, however, this suspends all beans (EJB, MDB). Is there a way to only suspend message driven beans MDBs?

In my application all the work comes in via messages. If I can suspend the message consumers, I can be sure that rest of the system will continue to work until all the work in progress is finished. For example if an EJB was trying to put a message on the queue it will be able to do so.


Solution

  • You can use the following CLI operations on the MDB. For details see https://docs.jboss.org/author/display/WFLY10/Message+Driven+Beans+Controlled+Delivery. Though the documentation is for WildFly 10; it also works with WildFly 9.x

    For standalone mode:

    [standalone@localhost:9990 /] cd deployment=jboss-helloworld-mdb.war/subsystem=ejb3/message-driven-bean=HelloWorldMDB
    
    [standalone@localhost:9990 message-driven-bean=HelloWorldMDB] :stop-delivery
    {"outcome" => "success"}
    
    [standalone@localhost:9990 message-driven-bean=HelloWorldMDB] :start-delivery
    {"outcome" => "success"}
    

    For domain mode:

    Stop delivery

     /host=master/server=default/deployment=helloworld.app.war/subsystem=ejb3/message-driven-bean=HelloWorldMDB:stop-delivery
    

    Start delivery:

     /host=master/server=default/deployment=helloworld.app.war/subsystem=ejb3/message-driven-bean=HelloWorldMDB:start-delivery
    

    If the MDB resides in an EJB jar inside an EAR file:

     /host=master/server=default/deployment=helloworld.app.ear/subdeployment=helloworld.core.impl.jar/subsystem=ejb3/message-driven-bean=HelloWorldMDB:start-delivery