Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8939659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:52:04+00:00 2026-06-15T10:52:04+00:00

I would like someone to point me to the right direction for some requirements:

  • 0

I would like someone to point me to the right direction for some requirements:
We need to have asynchronous reliable notification sent across our server
The consumers of the messages will subscribe/unsubscribe at will
The consumers will be large at number
The producer will be one
The notifications, even if server goes down, will not be lost and if server goes up again will be sent.
The number of notifications is expected to be high
The number of threads used should be as low as possible.

Given the above (crazy) requirements, i tried to solve this problem using activemq/jms. Does this seem like the proper direction?

Given the above:
1. i used durable subscribers and jms messages and kahadb.
2 For jms producer, the solution seems straight forward.
3. For the consumer side, i am in trouble.

a. Although i have spring, i could not use jms:listener-container since i need to have dynamic subscription and unsubscription of consumers and this seemed imposible so i create for every listener that i have, a SimpleListenerContainer. This sounds ok?
b. In SimpleListenerContainer, i set clientId (since this is what is needed for durable)

    super.setSubscriptionDurable(durable);
    if (durable ) super.setClientId(clientId);

Here, i have the following. Given the following configuration:

    <bean id="messageBusReceiverConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" destroy-method="stop">
        <property name="maxConnections" value="10"/>
        <property name="maximumActive" value="500"/>
        <property name="connectionFactory" ref="jmsConnectionFactory"/>
        <property name="idleTimeout" value="0"/>
    </bean>

I expected to have 10*500=5000 parallel consumers possible. This is true if consumers are not durable. But, for durable consumers, where super.setClientId(clientId) (super is SimpleMessageListenerContainer) is used, after 10th connection, i get:
org.springframework.jms.IllegalStateException: Setting clientID on a used Connection is not allowed; nested exception is javax.jms.IllegalStateException: Setting clientID on a used Connection is not allowed

So it seems i cannot use durable subscribers using SimpleMessageListenerContainer for sessions, only for the connections. Is this true? Does it sound reasonable to have maxConnections=500 and maximumActive=1? This solves my problem, but… although new to JMS, this seems like overkill for the broker.

Ok, considering i am still in the right track, i need to unsubscribe now my consumer/listenr, dynamically so i do

container.stop();
container.destroy();

where container is SimpleMessageListenerContainer. container.destroy(); throws some exceptions when called. Is it necessary to call it or stop method is enough?

Ok, i know these questions are arbitary and perhaps difficult to answer even for someone who knows jms (if jms is the right solution) and have given next to nothing from my code. I expect someone to give me some guidance on wheather i am in the right track, give me from input as much as he can on the questions raised, and then i can give code in the places needed so as to solve my remaining problems.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:52:05+00:00Added an answer on June 15, 2026 at 10:52 am

    I am lacking the knowledge about spring to answer your question about the IllegalStateException, though I would guess it is related to maxConnections being set to 10.

    Do you need spring? In any case, make sure that you have persistence enabled in your JMS Broker’s configuration, make sure to use a durable queue/topic and make sure to use setDurable(true) on the message.

    I think you generally made the right decision to use a powerful JMS provider if you want reliable messaging. You can test various products with the SPECjms2007 benchmark, depending on how important performance is for you, there are also some results available.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please would someone point me in the right direction? I am working on a
I am hoping someone can point me in the right direction. I have a
I would highly appreciate it if someone can point me in the right direction
I have a confusion regarding DataContext which i would like someone to confirm or
I have a search form. I would like when someone type the term, first
Hope someone could help me with this: I would like to have a column
Can someone point me in the right direction in regards to making an api
I was wondering if someone could point me in the right direction with this
Can someone point me in the right direction here? Suprisingly, I cannot find any
Is it possible and if so can someone point me in the right direction

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.