-
1. Re: Wildfly restricts number of consumers with ActiveMQ Resource Adapter
jbertram Dec 7, 2016 8:47 AM (in response to cennore)I'm not sure how or why Wildfly would be restricting the number of sessions/consumers created by the ActiveMQ JCA RA. Could you work up a test-case so I could reproduce what you're seeing?
It may ultimately be an issue with the JCA RA itself so you may also want to ask your question on the ActiveMQ user mailing list.
-
2. Re: Wildfly restricts number of consumers with ActiveMQ Resource Adapter
cennore Dec 7, 2016 2:35 PM (in response to jbertram)Hi Justin and thanks for responding.
It's actually quite funny but I'm really not doing anything in particular with which I could work up a test case.
For example, today I downloaded a fresh Wildfly 10.0.0 AS and an ActiveMQ 5.14 RA.
I configured the resource adapter in the standalone-full-ha.xml and dropped the activemq rar in the deployment folder of Wildfly.
<subsystem xmlns="urn:jboss:domain:resource-adapters:4.0"> <resource-adapters> <resource-adapter id="activemq"> <archive> activemq-rar-5.14.0.rar </archive> <transaction-support>XATransaction</transaction-support> <config-property name="ServerUrl"> tcp://localhost:51616?jms.rmIdFromConnectionId=true </config-property> <config-property name="UserName"> admin </config-property> <config-property name="QueuePrefetch"> 2000 </config-property> <config-property name="UseInboundSession"> false </config-property> <config-property name="Password"> admin </config-property> <connection-definitions> <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/AmqConnectionFactory" enabled="true" use-java-context="true" pool-name="ConnectionFactory"> <xa-pool> <min-pool-size>1</min-pool-size> <max-pool-size>100</max-pool-size> <prefill>false</prefill> <flush-strategy>InvalidIdleConnections</flush-strategy> <is-same-rm-override>false</is-same-rm-override> <pad-xid>true</pad-xid> <wrap-xa-resource>true</wrap-xa-resource> </xa-pool> <recovery no-recovery="false"> <recover-credential> <user-name>asdf</user-name> <password>fdsa</password> </recover-credential> <recover-plugin class-name="org.jboss.jca.core.recovery.DefaultRecoveryPlugin"/> </recovery> </connection-definition> </connection-definitions> <admin-objects> <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/jms/queue/VouData" use-java-context="true" pool-name="VouDataQueue"> <config-property name="PhysicalName"> vouData </config-property> </admin-object> <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/jms/queue/AgileRas" use-java-context="true" pool-name="AgileRasPool"> <config-property name="PhysicalName"> agileRasQueue </config-property> </admin-object> <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/jms/queue/Vou" use-java-context="true" pool-name="VouQueue"> <config-property name="PhysicalName"> queue/Vou </config-property> </admin-object> </admin-objects> </resource-adapter> </resource-adapters> </subsystem>
My MDB listener looks like this
@ResourceAdapter(value = "activemq") @MessageDriven(mappedName = "queue/Vou", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName="destination", propertyValue="queue/Vou"), @ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "100"), @ActivationConfigProperty(propertyName = "maxMessagesPerBatch", propertyValue = "500"), @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")}) public class VouListener implements MessageListener { private Logger log = Logger.getLogger(getClass()); @Inject private DataExecutorManager dataExecutorManager ; @Override public void onMessage(Message message) { //implement some logic } }
Bearing in mind this is a fresh Wildfly which I have not done any other tweaks, plus a recent RA download from ActiveMQ repository, I expect that viewing the number of consumers listening on my Queue (queue/Vou) should atleast be 10 which is the default. However I see just 1.
I'm wondering if I'm meant to do some tweaks to the ironjacamar subsystem also? Or am I meant to tweak the ra.xml of the deployed activemq rar?
I feel I'm missing something. Every post I've seen on this issue appears this is just meant to work seamlessly so I'm wondering what I might have done wrong?
I'm also not convinced the issue is with the resource adapter cause I have a different project running on a different application server which connects to the same ActiveMq server and has the appropriate number of consumers.
I'm open to any suggestions.
Much appreciated.
-
3. Re: Wildfly restricts number of consumers with ActiveMQ Resource Adapter
cennore Dec 8, 2016 9:14 AM (in response to jbertram)Hi Justin,
Today I tried installing the activemq as a module instead of just deploying via the deployment folder. Made no difference; it's still just a single consumer listening on the queue.
Any word from you yet?...
-
4. Re: Wildfly restricts number of consumers with ActiveMQ Resource Adapter
jbertram Dec 8, 2016 9:35 AM (in response to cennore)I've been busy with other tasks so I haven't been able to set anything up. If you could write a script for Linux to set all this up, build the MDB, deploy the MDB, send a message, etc. that would go a long way in helping me have the time to give this a closer look.
As far as I'm aware this really is supposed to work seamlessly. I wouldn't expect you would need to configure anything else in the JCA subsystem or in the ActiveMQ ra.xml.
One thing that seems a bit odd to me about your configuration is that the MDB is using "queue/Vou" for the "destination", but the corresponding configuration for that queue is using "java:/jms/queue/Vou" for the "jndi-name". Does the MDB receive messages from the appropriate queue when they are sent?
-
5. Re: Wildfly restricts number of consumers with ActiveMQ Resource Adapter
cennore Dec 8, 2016 10:22 AM (in response to jbertram)Hi Justin,
'queue/Vou' is the physical name of the name of the queue (see my standalone.xml), I believe there's a config somewhere that specifies whether the physical name or JNDI should be used in the MDB (I'm sure I stumbled on this sometime).
Anyway the answer is YES! I'm successfully pushing to the queue and the MDB is successfully polling from the queue. Remember I said this is a LIVE project. I'm just desperate to increase performance and speed.
For sake of curiosity, I refactored my MDB to this
@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName="destination", propertyValue="java:/jms/queue/Vou"), @ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "50"), @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")}) public class VouListener implements MessageListener { private Logger log = Logger.getLogger(getClass()); @Inject private DataExecutorManager dataExecutorManager ; @Override public void onMessage(Message message) { //implement some logic } }
Made no difference.
By the way, during my search for a solution I stumbled on a Jboss tutorial. See Integrate ActiveMQ with WildFly
From the screenshots on this tutorial the number of consumers listening on the queue in the example is also 1
Shouldn't this be 10 (if that's the default number as others have hinted in other posts I've seen)?
-
6. Re: Wildfly restricts number of consumers with ActiveMQ Resource Adapter
cennore Dec 8, 2016 10:35 AM (in response to jbertram)Hi Justin,
I just read this on ActiveMQ tutorial. See Apache ActiveMQ ™ -- Multiple consumers on a queue
If you want to consume concurrently from a queue, then you must use a different session for each consumer.
This is because you must have a session per thread. The JMS contract is that only 1 session is used by one thread at once - which if you're using consumers means that only 1 consumer can receive messages at once if using the same session. So if you want concurrent consumption of messages, you need to use different sessions for each consumer.
However its your call on how many connections you have. In a normal network based mode, sharing the same connection across sessions will essentially multiplex traffic across a single socket (and so reduce resource usage at the cost of more synchronization). So sometimes there's a need to use more connections, as typically using different sockets concurrently tends to be a bit faster than using a single one).
Incidentally in the JCA specifications in J2EE 1.4, Resource Adapters will typically create 1 connection for each session, so there's a 1-1 mapping between the two.
In a JTA environment with CMT, is it possible to specify connections per MDB instance? Do I even have any control over this?
I might be wrong but this seems to be the root of the challenge and why the maxSessions property is ineffective.
I just feel I'm missing something!
-
7. Re: Wildfly restricts number of consumers with ActiveMQ Resource Adapter
jbertram Dec 8, 2016 12:05 PM (in response to cennore)1 of 1 people found this helpfulIn a JTA environment with CMT, is it possible to specify connections per MDB instance? Do I even have any control over this?
The only way you'd have control over that is if the JCA RA you're using exposed that as a configuration property. I don't believe the ActiveMQ JCA RA exposes this functionality.
I might be wrong but this seems to be the root of the challenge and why the maxSessions property is ineffective.
I wouldn't expect that to be a problem necessarily. A single connection can support lots of sessions.
I just feel I'm missing something!
As I noted previously, I recommend you post about your issue on the ActiveMQ user mailing list as they'll be more familiar with the design and behavior of the ActiveMQ JCA RA since it comes from their code-base.
-
8. Re: Wildfly restricts number of consumers with ActiveMQ Resource Adapter
cennore Dec 8, 2016 2:29 PM (in response to jbertram)Hi Justin,
I hope I'm not growing into a nuisance on you. I have indeed posted the question on an ActiveMQ forum.
Anyway, I decided to take a look at things from the jboss cli interface and I noticed the following properties for the MDB inquestion:
- pool-available-count ~ 50
- pool-create-count ~ 50
- pool-current-size ~ 50
- pool-max-size = 100
Where my mdb-pool size in standalone.xml is set to 100 and maxSessions property on my MDB is 100. I'm guessing this means 50 MDB instances within the allocated pool are active and in use.
If this is correct and each mdb instance is a consumer listening on the queue then I'm still puzzled why the ActiveMQ console still indicates just 1 consumer.
See screenshot below
-
9. Re: Wildfly restricts number of consumers with ActiveMQ Resource Adapter
jbertram Dec 8, 2016 2:44 PM (in response to cennore)I have indeed posted the question on an ActiveMQ forum.
To which forum did you post your question? I'm subscribed to the official ActiveMQ mailing list where questions like this are typically asked and answered by the developers, but I haven't seen a question about the JCA RA recently.
In any event, I'm not familiar enough with the operational semantics of the ejb instance pools to give you any reliable guidance on that question. It's certainly possible that you're hunch is correct. It's possible that the ActiveMQ JCA RA creates sessions lazily. I really have no idea since I don't work on that code-base. An ActiveMQ developer could help you more with that.
-
10. Re: Wildfly restricts number of consumers with ActiveMQ Resource Adapter
kunal_ransing Sep 26, 2018 10:40 AM (in response to cennore)Hi Oluwasegun,
Have you solved this ? I am facing same. I can see number of mdb instances like 25 but in activemq console it shows no. of consumer is 1.
-
11. Re: Wildfly restricts number of consumers with ActiveMQ Resource Adapter
marcoben73 Jun 6, 2019 6:29 AM (in response to kunal_ransing)Hi,
a note from my experience.
The number of consumer in ActiveMQ is always the number of JBoss instances connected through resource adapter, so it is the number of TCP connections; resource adapter multiplex sessions on a single connection.
The number of mdb consumers is set by the ActivationConfigProperty "maxSessions".
The concurrency of mdb consumers depends on mdb-strict-max-pool in standalone.xml.
mdb-strict-max-pool