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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:56:38+00:00 2026-06-10T02:56:38+00:00

I recently started learning JMS and so far understood some of the concepts. However

  • 0

I recently started learning JMS and so far understood some of the concepts. However I would like to know how IBM MQ or any queue provider handles request from a multithreaded application. for example

Consider a application which is mutithreaded and configured to send messages to Mainframe host using MQ. This application has one Put queue and get queue configured. Imagine 10 requests are getting processed each wanting to get data from the host. Since Queue is just one, all these 10 messages are placed in the queue simultaneously.The host processes the messages and sends the reply to the client i.e. the application. How does the reply messages don’t get mixed up and every thread gets its own correct reply message?

Some id is used while communicating and is it specific to a particular thread of message sent? Does a JMS session needs to be established for each new thread of execution.? What is same session is used for all 10 requests? Will appreciate any examples or links which explains this concept in detail.

  • 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-10T02:56:38+00:00Added an answer on June 10, 2026 at 2:56 am

    JMS supports this with a couple of features:

    First, the JMSCorrelationId is a JMS header that is used to correlate a request with a response. I.e. each message contains a globally unique (GUUID) JMSMessageId. The mainframe app should simply copy the message id from the request to the JMSCorrelationId on the response message and send back to the shared response queue.

    So, simply send a request by:

    (psuedo code - in one thread, do the following when you need to request data over JMS)
    myMessage = session.createTextMessage("My nice request");
    messageProducer.send(myMessage); // using some previously setup producer
    // commit if needed
    
    mc = session.createConsumer(queue,"JMSCorrelationId='"+myMessage.getMessageId()+"'");
    responseMessage = mc.receive(TIMEOUT);
    if( responseMessage != null){
      //got OUR response data
    }
    // close down consumer here.
    

    The trick to allow multiple consumer threads (or applications) is the Selector in the consumer. A JMS selector is similar to a sub set of SQL or similar query languages. In this case just select messages where the JMSCorrelationId is the same as the id in the request send some time back.

    This is the only “safe” setup that you can do with the contraints that you have one fixed, shared queue and that a request must come back to the very same thread it was requested from.

    To avoid the overhead of JMS Selectors you could otherwise use temporary queues for the replies, one temp queue per request, then there will be no other thread listening for a specific response. Another option to gain performance is to make the application more asynchronous. JMS actually promotes this, fire off a request, and let a pool of consumer threads deal with any asyncrhonous responses – each thread is equally capable of dealing with any reponse – usch as processing the data and putting it into a database (or similar). I don’t know if this design paradigm is applicable to your case, but you should be aware of it at least.

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

Sidebar

Related Questions

I just recently started learning the Scala language and would like to do it
I recently started learning backbone and was wondering what would be the best way
I recently started learning JavaFX. At the moment I can't build any JavaFX project
I have only started learning python recently. I would still be considered a beginner.
I recently started learning ruby, and I understood that you coud use code blocks
I recently started learning Objective-C 2.0, with a book, and I want to know
I recently started learning Emacs . I went through the tutorial, read some introductory
I recently started learning about IPC and I have some issues. I wrote a
I just recently started learning Ember (so far with a lot of trouble). I'm
I recently started learning Objective-C, and I am working on an iOS app as

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.