PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, July 12, 2022

[FIXED] How to handle situation if message will not come in queue after timeout. Is it possible with Message Broker?

 July 12, 2022     ibm-mq, message, messagebroker, queue, timeout     No comments   

Issue

I think I described almost everything I need in title. So there is some WMB flows. And one wait for the answer in queue. I need to throw exception if there will be no message in queue after timeout.

Thank you for your time


Solution

Yes it is possibe, but you will need to develop it in your flows. MQ is made for asyncronous communication, so a timeout is not something which is native to it. I can think of 2 possible solutions now:

  • Use the TimeoutControl and TimeoutNotification nodes in your flows

In the flow which sends the request, after sending the request you add a TimeoutControl node and set up the desired timeout. Create a new flow, which starts with the TimeoutNotification flow. In that flow you send your timeout error if the response has not yet been received. And to know which response has been received you can use different methods, for example the flows sending the request and receiving the response could maintain a database table, or you could store this information in a queue as well.

  • Start waiting for the response after sending the request

Set up the response handler flow to start with an MQ Input followed by an MQ Get node. You listen for the response with the MQ Get, on which you can set a wait interval, that will be your timeout threshold. The MQ Input gets technical messages sent by the request sender flow after sending the request. This is a worse solution then the first, as you will block a message flow thread while listening for the response.

Or you can just make 1 flow to send the request and receive the response, receiving the response with an MQ Get node. This is even worse as you will need to turn off transactionality for the MQ Output sending the request.



Answered By - Attila Repasi
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing