Question

1
Replies
49
Views
Paul Neal (PaulNFord)
Ford Motor Company

Ford Motor Company
CA
PaulNFord Member since 2019 7 posts
Ford Motor Company
Posted: May 11, 2021
Last activity: May 18, 2021
Posted: 11 May 2021 11:01 EDT
Last activity: 18 May 2021 13:17 EDT

handle rest connector exception in an Activity step

we have a number of REST API calls that are made from our 7.3.1 server as part of a larger Marketing application.

they are all called via Activities which can be invoked due to receipt of an event stream, or possibly via an agent that is processing from a queue.

I have read over most of the posts I could find on this topic, and there does not appear to be a good answer to the problem of the REST Connector receiving an Exception within the provided OOB Pega code, when called from an Activity

in all of the Activities, the Connect-REST step has a jump step with a StepStatusFail, but this code is never reached when the connector receives an exception condition.

multiple ERRORS are logged with an accompanying stack trace, but without the ability to catch the ERROR in the calling Activity and handle it appropriately, the exceptions often cause the calling Agent to fall over due to the exception.

we now monitor our log files very closely, and track agent failures; so we are both aware of the frequency of the occurrence, and can restart failed agents, but ideally we need to handle the exception conditions in our code.

from the stack trace we can follow the path:

Activity>invoke 

Activity>pyinvokerestconnector

and the internal RESTConnector methods

invoke/perform/executeRequest/invokeRest/mapResponsBody/mapInboundData

but what we need is the Pega approved way to handle these exceptions, either 

we have a number of REST API calls that are made from our 7.3.1 server as part of a larger Marketing application.

they are all called via Activities which can be invoked due to receipt of an event stream, or possibly via an agent that is processing from a queue.

I have read over most of the posts I could find on this topic, and there does not appear to be a good answer to the problem of the REST Connector receiving an Exception within the provided OOB Pega code, when called from an Activity

in all of the Activities, the Connect-REST step has a jump step with a StepStatusFail, but this code is never reached when the connector receives an exception condition.

multiple ERRORS are logged with an accompanying stack trace, but without the ability to catch the ERROR in the calling Activity and handle it appropriately, the exceptions often cause the calling Agent to fall over due to the exception.

we now monitor our log files very closely, and track agent failures; so we are both aware of the frequency of the occurrence, and can restart failed agents, but ideally we need to handle the exception conditions in our code.

from the stack trace we can follow the path:

Activity>invoke 

Activity>pyinvokerestconnector

and the internal RESTConnector methods

invoke/perform/executeRequest/invokeRest/mapResponsBody/mapInboundData

but what we need is the Pega approved way to handle these exceptions, either 

a) in our Activity directly, OR

b) by overriding the OOB code in the appropriate place so that we can return to the Activity with a status code that we can use to control the flow, and not have our Agents die off simply because an API call failed.

by the number of posts on this topic, this is an obvious sore point for a lot of developers, surely there must be a proper solution available to us.

 

Pega Platform 7.3.1 Decision Management Data Integration Manufacturing System Architect