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

The Archive Base Latest Questions

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

Scenario I am consuming messages from a WebLogic Queue by implementing messageListener. The onMessage()

  • 0

Scenario

I am consuming messages from a WebLogic Queue by implementing messageListener.
The onMessage() call is successful and the message received can be printed from within the onMessage function.

Requirement

To process this msgText as soon as it received and return the processed result to a calling method.

Code

@Override

public void onMessage(Message msg) {

try {
    String msgText;
    if (msg instanceof TextMessage) {
        msgText = ((TextMessage) msg).getText();
    } else {
        msgText = msg.toString();
    }
    System.out.println(msgText);

} catch (JMSException ex) {
    ex.printStackTrace();
}

}

  • 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-15T12:29:05+00:00Added an answer on June 15, 2026 at 12:29 pm

    It is not possible directly because your message-driven bean doesn’t have a clue which method posted the message on a message queue and generally there’s no callback mechanism in MDBs.

    But, there is a trick that can help. It is called TemporaryQueue and it should be used as follows. In the message producer add this portion of code:

    // OPEN CONNECTION AND CREATE SESSION
    ..
    TemporaryQueue tempQueue = session.createTemporaryQueue();
    msg.setJMSReplyTo(tempQueue);
    // SEND MESSAGE
    ..
    MessageConsumer mc = session.createConsumer(tempQueue);
    Message retMsg = mc.receive(); //WAITING FOR A RESPONSE..
    

    In consumer (your message-driven bean) use this temporary queue:

    Queue destination = (Queue) message.getJMSReplyTo();
    // CREATE PRODUCER, CREATE MESSAGE AND SEND THE MESSAGE
    

    This way you will simulate callback mechanism. Object retMsg should contain processed result and you are done.

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

Sidebar

Related Questions

I have configured Spring DefaultMessageListenerContainer as ActiveMQ consumer consuming messages from a queue. Let's
Scenario I am consuming an RSS feed that looks, in part, like this: <item>
Scenario : I'll try to put an analogy with the loan broker example from
I received a long Fiddler trace (with a complicated scenario) and need to correlate
I have this scenario where a webservice method I'm consuming in C# returns a
I have the following scenario: Program P (can take upto 30 minutes to complete)
I'm new to BizTalk, can anyone help me to work out the following scenario
Scenario: A WCF service receives an XDocument from clients, processes it and inserts a
I'm trying to implement a producer-consumer scenario using multiprocessing and a queue; the main
This is in C# I'm consuming data from an RSS feed and want to

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.