-
1. Re: Restrict consumer connection per queue
jbertram Jun 8, 2016 9:30 AM (in response to ronyjhn)You can prevent a user from consuming from a queue by enforcing security authorization, but there is no way to limit the number of consumers on a queue.
-
2. Re: Restrict consumer connection per queue
ronyjhn Jun 10, 2016 12:53 AM (in response to jbertram)Thank you so mush for your reply.
We are facing a problem of multiple connection exists at HornetQ server side for single queue when we stop and start our consumer/listener program.
Normally it happen when we close consumer program without proper resource release. I don't want unused connection at server that can cause currently connected listener to lose messages from queue.
Is it possible to check using some HornetQ API to detect the number of consumers, when I connect next time?
-
3. Re: Restrict consumer connection per queue
jbertram Jun 10, 2016 10:13 AM (in response to ronyjhn)Typically if you close an application without closing your resources then HornetQ will detect the dead connection and remove it automatically. What connection factory are your clients using and how is that connection factory configured?
And yes, there is a way to determine the number of consumers on a given queue via the management API. The relevant property is called "consumerCount" and it's available on the QueueControl. Check out the HornetQ management documentation as well as the "management" example shipped with HornetQ for a working demonstration of how to retrieve a management property for a queue.
-
4. Re: Restrict consumer connection per queue
ronyjhn Jun 13, 2016 12:43 AM (in response to jbertram)I configured JNDI based connection factory in hornetq-configuration.xml using NettyConnectionFactory. I agreed with your point on dead connection handling of HornetQ.
Sometimes in our test environment, we faced with connection break issues. So I went with connection-ttl=-1 and client-failure-check-period to a maximum value approach.
Definitely I will check the documentation and will try out the API which you mentioned for consumerCount. Thanks again for your prompt responses.
-
5. Re: Restrict consumer connection per queue
jbertram Jun 13, 2016 10:16 AM (in response to ronyjhn)As you've observed, the problem with setting connection-ttl=-1 and client-failure-check-period to a maximum value is that dead connections will just leak instead of being cleaned up.