2

I am working with WildFly 10.1 which ships with Artemis as the new JMS provider but I am unable to find how to dynamically change the number of consumer threads for a specific MDB.

I have a queue, and a message listener (MDB) consuming messages from the queue, now I want to dynamically control the maximum number of consumers threads the domain must start.

How can I do it using CLI?

TT.
  • 15,774
  • 6
  • 47
  • 88
Evandro Pomatti
  • 13,341
  • 16
  • 97
  • 165
  • May I ask why you want to configure this **dynamically**? – Rémi Bantos Nov 25 '16 at 17:57
  • @RémiBantos Good question. The main reason is that pushing new versions for QA and Production is a pain within some customer's change processes. Whole process may take weeks, it must be manual, and executed by a 3rd party (no I am not kidding). I rather keep fine tuning flexible, so we are able to react quickly without dealing with the change department and get things done. I had good experiences in the past with this approach (using WebLogic's work managers). – Evandro Pomatti Nov 28 '16 at 13:42

1 Answers1

1

As you want to do this configuration for a specific MDB you could firstly assign it to a dedicated pool. See this answer.

Then to dynamically update your pool attributes you could take a look at this article which describes how to configure or add ejb3 pools using jboss-cli or standalone.xml configuration. (with JBOSS 7, but it should not be so different with Wildfly 10)

The following jboss-cli command could then be used to modify your pool size dynamycally as it defaults to 20 for MDBs:

/subsystem=ejb3/strict-max-bean-instance-pool=myPool:write-attribute(name=max-pool-size)

Finally, it seems you also have to configure the 'maxSession' activation configuration property accordingly in your MDB. See this thread and also this question for contextual configuration.

Community
  • 1
  • 1
Rémi Bantos
  • 1,899
  • 14
  • 27
  • I was able to create the pool with max pool 50 and associate it with the MDB, but when I add 50 messages to queue only 15 are consumed at any time (previous default value). I used this command to create the pool `/subsystem=ejb3/strict-max-bean-instance-pool=dummyPool/:add(max-pool-size=50,timeout=5,timeout-unit=MINUTES)` and used `@Pool` annotation and even `jboss-ejb3.xml` on the MDB, but the server still limits it to 15 instances. The `maxSession` activation is static. Do you know what it could be? I also tried restarting the server but it didn't work. – Evandro Pomatti Nov 29 '16 at 00:19
  • I also found [this article](http://www.mastertheboss.com/javaee/ejb-3/custom-pool-configuration-for-your-ejbs-on-jboss-as-7-wildfly), but following those steps didn't get my MDB to work using my custom pool. – Evandro Pomatti Nov 29 '16 at 00:38
  • Have you tried to set the maxSession activation configuration property? See this question and related answer for maxSession contextual configuration: http://stackoverflow.com/questions/34030422/how-to-make-mdb-activation-spec-contextual-properties-configurable – Rémi Bantos Dec 01 '16 at 21:02