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
If your Business Operation is deployed in a Production you can configure the default options of EnsLib.HTTP.OutboundAdapter to control timeouts and retries:
https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...
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.
Have you tried in OnInit method something like this? :
Set ..Adapter.ConnectTimeout = 15
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 = 15 Set ..Adapter.ResponseTimeout = 10 Set ..RetryInterval = 5 Set ..FailureTimeout = 60 Set ..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).
Try something like this:
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?
Try enabling the I/O log from the business operation configuration.
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".