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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:19:16+00:00 2026-05-26T10:19:16+00:00

I have a simple spring jms tutorial.A lender is acting as receiver. A borrower

  • 0

I have a simple spring jms tutorial.A lender is acting as receiver. A borrower is action as sender. borrower sends salary and loan amount, and waits for response. The lender runs a decision and sends back “accept” or “decline”.

on the borrower side, i am doing the following.

Message sentMessage = (Message)jmsTemplate.execute(new MyProducerCallBack(messageMap, "lenderResponseQueue"));

String filter = "JMSCorrelationID = '" + sentMessage.getJMSMessageID() + "'";
TextMessage tmsg = (TextMessage) jmsTemplate.receiveSelected("lenderResponseQueue", filter);

This is the code in MyProducerCallBack

public Object doInJms(Session session, MessageProducer producer) throws JMSException {
    System.out.println("inside doInJms");

    //create queue to receive accept or decline from lender
    Queue queue = session.createQueue(lenderResponseQueue);

    MapMessage jmsMapMsg = session.createMapMessage();
    populateJMSMapMsg(jmsMapMsg, mapMessage);
    jmsMapMsg.setJMSReplyTo(queue);

    //send salary and loan amount to lender
    producer.send(jmsMapMsg);

    //get the accept or decline from lender
    Message msg = session.createConsumer(queue).receive();

    if(msg instanceof TextMessage){
        System.out.println(((TextMessage)msg).getText());
    }

    return msg;
}

When Message msg = session.createConsumer(queue).receive(); is encountered The logs throw the following exception

2011-10-19 20:21:03,458 WARN [org.apache.activemq.ActiveMQSessionExecutor] - Received a message on a connection which is not yet started. 
Have you forgotten to call Connection.start()? Connection: ActiveMQConnection {id=ID:Reverb0253-PC-54217-1319070060323-0:1,clientId=ID:Reverb0253-PC-54217-1319070060323-1:1,started=false} 
Received: MessageDispatch {commandId = 0, responseRequired = false, consumerId = ID:Reverb0253-PC-54217-1319070060323-0:1:1:1, destination = queue://lenderResponseQueue, message = 
ActiveMQTextMessage {commandId = 7, responseRequired = true, messageId = ID:Reverb0253-PC-52978-1319058441747-0:1:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:Reverb0253-PC-52978-1319058441747-0:1:1:1, destination = queue://lenderResponseQueue, transactionId = null, expiration = 0, timestamp = 1319058485680, arrival = 0, brokerInTime = 1319058485706, brokerOutTime = 1319070063443, correlationId = ID:Reverb0253-PC-53001-1319058485443-0:1:1:1:1, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 5, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, text = Accepted!}, redeliveryCounter = 5}

The receiving queue is lenderResponseQueue is not present in the spring config file. Do I need to specify it there. This is my jmsTemplate from config file

<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="queueConnectionFactory"/>
    <property name="destinationResolver" ref="destinationResolver"/>
    <!-- name of destination -->
    <property name="defaultDestinationName" value="lenderRequestQueue"/>
    <!-- amount of time to wait before getting a message -->
    <property name="receiveTimeout" value="0"/>
    <!-- indicate weather queue or topic is used. false = queue or p2p -->
    <property name="pubSubDomain" value="false"/>
</bean>
  • 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-26T10:19:17+00:00Added an answer on May 26, 2026 at 10:19 am

    Is there any specific reason you have both send and receive in the execute callback right after one another:

    //send salary and loan amount to lender
    producer.send(jmsMapMsg);
    
    //get the accept or decline from lender
    Message msg = session.createConsumer(queue).receive();
    

    You would usually receive in a separate JmsTemplate.receive() call ( not within a callback ). That would decouple / unsync your callback, as well as most likely would solve your:

    Received a message on a connection which is not yet started.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following class (from a simple Spring tutorial) public class CarValidator implements
I am working on a simple tutorial. I have a publisher that sends message
I have an extremely simple web application running in Tomcat using Spring 3.0.2, Hibernate
I have what seems like a simple problem. I have a Spring web app,
I have a simple Spring config for unit tests that includes ActiveMQ embedded broker,
I'm trying to create a simple Spring 3 application and have the following files.
Just getting the hang of Spring Webflow. I have some simple forms working and
Hello all I have a simple Spring application which will not end as there
I was working with spring-ehcache-annotations and came across following scenario: I have a simple
I have my web application written in Spring MVC. It is quite simple app

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.