Sunday, March 19, 2017

Suspending a MDB

It's easy to suspend consumption of JMS messages from a MDB with WLST (this code is from an Oracle Support document):
connect("username", "password", "t3://host:port")
domainRuntime()
cd("/ServerRuntimes/TargetServerName/ApplicationRuntimes/ApplicationDeploymentName/ComponentRuntimes/ApplicationDeploymentName/EJBRuntimes/MDBName_JNDINameoftheQueue")
cmo.suspend()


The Java JMX version is horrendously more complicated.

Here http://middlewaremagic.com/weblogic/?p=5099 they say:

“NOTE:Suspending One individual MDB from an EAR file is not possible so if your EAR application Contains multiple MDBs then you will have to suspend all the MDBs present in that EAR like above.”

but I am not really sure this is true, since there is a JMX method for this:

http://docs.oracle.com/cd/E23943_01/apirefs.1111/e13945/weblogic/management/runtime/MessageDrivenEJBRuntimeMBean.html#suspend()

However if you restart WLS, the MDB will resume consumption.

If you use native WLS JMS, you can disable consumption on the JMS queue itself. This feature doesn't seem to be available for foreign JMS destinations (like MQ). In this case, you can simply comment out the destination in the JMS WLS configuration XML.... the MDB at startup will complain that it can't connect to the destination, but the application will still deploy. It's a horrible hack but it works



No comments: