PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label messagebroker. Show all posts
Showing posts with label messagebroker. Show all posts

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)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Monday, July 11, 2022

[FIXED] How to write CHARACTER variable to file in ESQL?

 July 11, 2022     extended-sql, ibm-integration-bus, message, messagebroker     No comments   

Issue

I'm trying to implement simple message flow, which reads text file (SWIFT message) and replaces one field value, then I need to put it back to file. Flow reads file as blob, then I cast message as CHARACTER and doing replacement. As result I get a CHARACTER variable, which I want write to file.


Solution

Cast the variable back to BLOB, make it the message root, then send it into a FileOutput node with default settings. Assuming that you are doing the character replacement with ESQL in a Compute node (with its Compute Mode set to change Message), then the subsequent ESQL would be:

SET OutputRoot.BLOB.BLOB = CAST(yourCharVar AS BLOB);



Answered By - Steve Parsons
Answer Checked By - David Goodson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home

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
All Comments
Atom
All Comments

Copyright © PHPFixing