Written by

Developer at Healthy Reply
Question Pietro Di Leo · Jul 24, 2023

How to automatically resend an HTTP message from a Business Operation

Hi everyone,

I'm trying to figure out how to automatically resend a message using a business operation.

I'm working on a production where HTTP messages are sent from a Business Component to the URL of a Postman Mock Service and I'd like to understand what I can do when the server doesn't respond within a certain timeout. To test this situation, I created a Business Operation component called "Sender", with an "EnsLib.HTTP.OutboundAdapter", which is sending an HTTP message via a POST request to the Mock Server. To create the message, I defined a %Net.HttpRequest object with a certain Timeout value and set my Postman Mock Server with a fixed network delay longer than the timeout time. 

Is there a way to automatically resend the HTTP message a second time (and then a third time) if the mock server doesn't respond within 10 seconds (consider a global timeout of 60 seconds) without having to explicitly program it inside the BO? I've read in the documentation something about the Reply Code Actions, but I can't figure out how I can use them. 

Thanks 

Product version: IRIS 2021.1

Comments

Pietro Di Leo  Jul 27, 2023 to Luis Angel Pérez Ramos

Thank you! Is it possible to set these parameters by code? I need to include many similar Business Operations to contact different entities, and I would like to set default parameters so that I don't have to change them every time I add a new BO.

0
Luis Angel Pérez Ramos  Jul 27, 2023 to Pietro Di Leo

Have you tried in OnInit method something like this? :

Set..Adapter.ConnectTimeout = 15
0
Pietro Di Leo  Jul 27, 2023 to Luis Angel Pérez Ramos

Thanks for the feedback. I tried setting Connect Timeout and Response Timeout as adapter's properties and Reply Code Actions, Retry Interval, and Failure Timeout as Business Operations' properties, in this way: 

Set..Adapter.ConnectTimeout = 15Set..Adapter.ResponseTimeout = 10Set..RetryInterval = 5Set..FailureTimeout = 60Set..ReplyCodeActions = "E=R"

But nothing changes if I modify the parameters, as the BO uses only the values defined in the Production Settings (even if they are all blank).

0
Eduard Lebedyuk · Jul 25, 2023

Try something like this:

  • Response Timeout: 10 (Timeout for getting a response from the server (the timeout for opening the connection to the server is always 5 seconds). Setting the timeout to -1 means wait forever.)
  • Reply Code Actions: E=R (R - Retry the message according to the configured RetryInterval and FailureTimeout; finally Fail unless a different action is also specified.)
  • Retry Interval: 1 (How frequently to retry access to the output system)
  • Failure Timeout: 60 (Total number of seconds to keep trying to deliver the message. After this number of seconds has elapsed, the business operation discards the message data and returns an error code. To ensure that no message is ever skipped, enter a Failure Timeout value of -1, which means 'Never time out'. Use a setting of -1 when complete data delivery is critical, for example in health care applications. )
0
Pietro Di Leo  Jul 27, 2023 to Eduard Lebedyuk

Thank you! With these settings and with a delay of 12 seconds of the Postman Mock Service, the BO correctly resends the message. However, I can't see the resent messages in the visual trace but only a message, as it happens when the message is not resent. Is there a way to see the resent messages as well or at least to see a warning or a log telling us that the BO is trying to send the message again?

0
Luis Angel Pérez Ramos  Jul 27, 2023 to Pietro Di Leo

Try enabling the I/O log from the business operation configuration. 

0
Pietro Di Leo  Jul 27, 2023 to Luis Angel Pérez Ramos

I tried, but only the message that received a reply is displayed. 

edit. I also tried with the BO parameter "RetryCount", for example: 

$$$TRACE(..RetryCount())

but this property is a boolean variable and so I always get print "1". In the same way, I also tried the methods RetryCountGet(), which always print me "1", and RetryCountLogicalToDisplay(), which always print me "96".

0