Advanced functionality for agents

You can further enhance the custom agents that you develop by incorporating advanced functionality into them.

This page contains the following information:

Set default values for an agent type

When you develop a custom agent, consider limiting the maximum number that can run simultaneously in your environment. This practice ensures that your environment or application doesn't experience performance degradation.

Use the following steps to set default values on your custom agent:

  1. Open SQL Server Management Studio on your Relativity database server.
  2. Navigate to the AgentType table in the EDDS database.
  3. Edit the following fields on your agent:
    • DefaultInterval – default time populated when you created an instance of this agent type. This value is in seconds.
    • DefaultLogging – default logging level selected when you created an instance of this agent type.
    • MinInstanceEnvironment – the minimum number of agents allowed in a Relativity environment. If the number of agents falls below this minimum value, then a warning message appears on the Alert pop-up.
    • MaxInstanceEnvironment – the maximum number of agents allowed in a Relativity environment. If the number of agents exceeds this maximum value, then a warning message appears on the Alert pop-up.
    • MinInstanceServer – the minimum number of agents allowed on each Relativity agent server. If the number of agents falls below this minimum value, then a warning message appears on the Alert pop-up.
    • MaxInstanceServer – the maximum number of agents allowed on each Relativity agent server. If the number of agents exceeds this maximum value, then a warning message appears on the Alert pop-up.
    • MinInstanceResourcePool – the minimum number of agents allowed in a Resource Pool. If the number of agents falls below this minimum value, then a warning message appears on the Alert pop-up.

Provide default values for schedule intervals

Define agent triggers so that you can run these background processes at optimal time intervals for performing their tasks. Consider the following sample intervals:

  • 3600 second intervals - The agent runs once an hour.
  • 300 second intervals - The agent runs every once 5 minutes.
  • 30 second intervals – The agent runs every once 30 seconds.

For example, you could add the following code as the first step in the Execute() method that you override when you create a custom agent. You can then use UTC time to control the time intervals when the agent runs.

System.DateTime offHourStart = <ReplaceWithYourTime_X>;
System.DateTime offHourEnd = <ReplaceWithYourTime_Y>;
if(!(System.DateTime.Now.Ticks >= offHourStart.Ticks && System.DateTime.Now.Ticks <= offHourEnd.Ticks)){
     return;
}

You can customize your agent to only run between Time_X and Time_Y. Your agent could run once an hour during a specific two hour window, so that it actually only runs twice per day.