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 7031687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:50:10+00:00 2026-05-28T00:50:10+00:00

I have a client that receives messages from a Queue. I currently have a

  • 0

I have a client that receives messages from a Queue. I currently have a MessageListener that implements onMessage().

Once the message is received, it is processed further then saved to a Database on the onMessage() method; the client then acknowledges the message receipt.

As long as the database is up there is no problem. But if the DB is down, the client will not acknowledge.

To cater for this, I want the client to be sending scheduled requests to the queue for any unacknowledged messages at scheduled intervals.

As it is, the only way I have of doing this is to restart the client which is not Ideal. Is there a way to trigger the queue to resend an unacknowledged message without a restart?

What i have in onMessage():

//code to connect to  queue
try {
if (DB is available){
        //process message
        //save required details to DB
        msg.acknowledge();
    }
    else{
        //schedule to request same message later from queue
    }
} catch (Exception e) {}
  • 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-28T00:50:11+00:00Added an answer on May 28, 2026 at 12:50 am

    After some more research, I have stumbled on the session.recover() which I can use to trigger redelivery. I have seen there is the RedeliveryPolicy class which I can use to set message resend options. Now my code looks like:

    ConnectionFactory factory = new ActiveMQConnectionFactory(url);
    RedeliveryPolicy policy = new RedeliveryPolicy();
    policy.setBackOffMultiplier((short) 2);
    policy.setRedeliveryDelay(30000);
    policy.setInitialRedeliveryDelay(60000);
    policy.setUseExponentialBackOff(true);
    ((ActiveMQConnectionFactory)factory).setRedeliveryPolicy(policy);
    
    final Session session = connection.createSession(false,
                    Session.CLIENT_ACKNOWLEDGE);
    ...
    ...
    ...
    ..
    
    
    //inside onMessage()
    try {
        if (DB is available){
            //process message
            //save required details to DB
            msg.acknowledge();
        }
        else{
            session.recover();
        }
        } catch (Exception e) {}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’m writing a client that receives messages from an external Websphere MQ Queue and
I have an application that receives messages from devices every few minutes. I also
We have received a WSDL from our client that we use to communicate with
Currently I have an application that receives an uploaded file from my web application.
I have a small program that sends and receives data from server and client
I have a WCF service that receive query from a silverlight client and send
I have a client software (on Android) that listens to incoming messages. The messages
I have a server that waits for incoming client messages and uses UDP. When
I have a AJAX client which must receive messages from server. Some messages from
I have seen two examples that illustrate how the client socket can receive messages

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.