All attempts execute within the same agent run
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.
Steps to Reproduce
- Create a standard agent.
- Use Queue-for-Agent to post instances to be executed by agent.
- Make sure execution of said instances fails. All three attempts will be executed in one run.
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.
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 December 15, 2015 - Updated December 21, 2015