RayLeo
RayLeo

Reputation: 11

How to Stop MDB pragmatically in wildfly

I know a way to stop MDB in wildly by command line, which is setup the DeliveryActive status to be ture, then

[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"}

According to this way, I think there must be a pragmatically way to invoke the MDB inside the EJB container, then do stop-delivery and start-delivery from MDB instance. But my issue is I cant find MDB by context.lookup(properties). Is this a possible way to do this?

Upvotes: 1

Views: 1212

Answers (1)

highstakes
highstakes

Reputation: 1519

You can do it through the JMX support of HornetQ locally or remotely. Here is a pretty good example: JEE7 + WildFly (HornetQ) - Pause queue from application

You can do this from within your app as well of course.

Upvotes: 1

Related Questions