Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

All attempts execute within the same agent run

SA-17795

Summary



A configuration has a standard agent processing instances. The instances are generated by an activity using the out-of-the-box method called Queue-For-Agent. The MaxAttempt parameter used with the method is set to 3.


 
The expectation is to have one attempt per run but for any reason, all the attempts are executed consecutively.


Error Messages



Not Applicable


Steps to Reproduce

  1. Create a standard agent.
  2. Use Queue-for-Agent to post instances to be executed by agent.
  3. Make sure execution of said instances fails. All three attempts will be executed in one run.


Root Cause



On such configuration, there are 4 important parameters. Two - at the agent level and two - when using the Queue-For-Agent method. The Agent parameters are:
  • Interval (sec): This is the period between each wake up of the agent, by default it is 30.
  • Max records: This is the number of instances to process on each run, by default it is blank which is 50.
 
Parameters on the call of the method are:
  • MaxAttempts: This is the maximum number of attempts.
  • MinimumAgeForProcessing: The minimum age of a queue entry in milliseconds before the agent tries to process it.

 
With the default settings and the MaxAttempt parameter set to 3, having the instance executed three times in one run is actually the expected behavior. When the agent wakes up, it tries to process all the scheduled items for that agent. In this case (if MaxAttempts is more than 1), after the first attempt is completed and it fails, the queue item will not go to broken process until all the attempts are completed and instead it will be scheduled after the first attempt. Therefore, in a single run - the agent might process all the attempts. 


Resolution



A local-change has been provided in order to have only one attempt per agent’s run. So the point is to add a time gap between attempts using the parameter MinimumAgeForProcessing (this field is in milliseconds) present in the Queue-For-Agent. It is important to set the value for said parameter to be above agent’s wake up parameter’s value.
For example, setting it to 40000, which is 40 seconds, obviously above the 30 seconds wakes the agent (Interval parameter) and makes it work.
 

Published January 31, 2016 - Updated October 8, 2020

Was this useful?

100% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us