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

  • SEARCH
  • Home
  • 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 6893987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:43:36+00:00 2026-05-27T06:43:36+00:00

I am using the Spring DefaultMessageListenerContainer to gain some dynamic benefits in setting the

  • 0

I am using the Spring DefaultMessageListenerContainer to gain some dynamic benefits in setting the MessageSelector value since I am using the Glassfish OpenMQ which is not that advanced in that regards.
Let’s have a JMS message. The listener issues a specific failure that means: retry after x seconds. It tries again with failure: retry after x*y seconds, and so on the time grows exponentially. If you cannot handle it after z retries, consider it as a poison JMS message.

DefaultMessageListenerContainer dmlc;
dmlc.stop();
dmlc.setMessageSelector(String.format("retries < %d AND retryTime <= %d", z, System.currentTimeMillis()));
dmlc.start();

I am not that satisfied with this solution, especially, when the Spring docs raise warning here:-). However, for the moment things meet our needs.

Now, I have a number of EJBs message consumers on different applications. Some of them need such dynamic changes of the messageSelector. Unfortunately, and to-my-best-knowledge, EJB MDBs do not support such dynamic “features”. For example, see this.

Is that correct? is there a workaround for an EJB solution? I would appreciate any help.

  • 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-05-27T06:43:36+00:00Added an answer on May 27, 2026 at 6:43 am

    To achieve dynamic changes to the message selector, you’d need to implement it straight in JMS, e.g.

    ConnectionFactory cf;
    Connection connection = cf.createConnection();
    session = connection.createSession(transactional, acknowledgeMode);
    
    MessageConsumer messageConsumer = session.createConsumer(destination, "message selector");
    

    Additionally, you’d need to place this code some place it executes on its own, perhaps in an asynchronous task? But you’d be reinventing the wheel, as Spring DMLC does that better.

    I don’t know why you’re doing this:

    • for load balancing? The message broker should take care of this.
    • for handling temporary downtimes? The queue should be configured to be able to store appropriate number of messages, or switch delivery to other node in cluster.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Spring 2.5 tag library, I have an Integer value in a command form
I'm using Spring.net with NHiberante (HibernateTemplate) to implement my DAO's. I also have some
I've been using spring for some time, but I always wondered how does it
I Am using Spring's @ExceptionHandler annotation to catch exceptions in my controllers. Some requests
Using Spring and Java; I have a pointcut which works OK. Now I want
I'm using spring(3.0.4.RELEASE) and hibernate (3.4.0.GA) and deploying into a glassfish (web_3.1) container. I
I'm using spring 3.0.5 in JBoss and when I try to use @Value annotation
Using Spring 3.0, I wrote an interface to hide from the application which template
Using Spring mvc-3. I am writing a custom Converter which needs access to other
When using spring security, specifically with @notation; what is the proper way to access

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.