Table of Contents

Class TriggerEvaluationScriptBase<ParametersInterface>

Namespace
ArcanaDevelopment.adTempus.ApplicationIntegration
Assembly
ArcanaDevelopment.adTempus.ApplicationIntegration.dll

Base class for trigger evaluation user scripts

public abstract class TriggerEvaluationScriptBase<ParametersInterface> : TypedUserScriptBase<ParametersInterface> where ParametersInterface : IScriptParameters

Type Parameters

NameDescription
ParametersInterface
Inheritance
object
MarshalByRefObject
TypedUserScriptBase<ParametersInterface>
TriggerEvaluationScriptBase<ParametersInterface>
Derived

Remarks

This class exposes methods to allow a user script to communicate additional information about trigger event processing.

Prior to version 6, trigger scripts returned a true or false result to indicate whether the job should trigger based on the data being evaluated by the script. If a script encountered a problem the only way to communicate this to adTempus was to throw an exception, which caused the trigger to be disabled until the job was requeued. Scripts can now use ReportProcessingFailure(string, bool, TimeSpan?) to report and control error behavior more precisely.

Methods

ReportProcessingFailure(string, bool, TimeSpan?)

Reports an evaluation failure, causing adTempus to abort and optionally suspend processing of the trigger.

protected void ReportProcessingFailure(string message, bool logToJobLog = false, TimeSpan? suspendFor = null)

Parameters

NameTypeDescription
message string

A message to be reported to the user.

logToJobLog bool

Indicates whether the message should be logged to the Job Log for the job

suspendFor TimeSpan?

Optionally suspends processing of the trigger. Set to null if the trigger should not be suspended; set to System.TimeSpan.MaxValue to suspend the trigger until the job is requeued.

Remarks

If the script encounters an error, it should call ReportProcessingFailure to communicate the problem to adTempus, and then terminate immediately by returning from its Run method.

Calling this method has the following effects:

  • The return value from the script is ignored and the job is not triggered.
  • Processing for the current batch of events terminates. For example, if a email trigger has 10 new messages to process and on the second message the script returns a failure result, no additional messages are processed. See below for more information.
  • The Trigger Status is updated with a warning, including the details from the message. The job's status is set to TriggerWarning.
  • If logToJobLog is true, a message is written to the Job Log. This message has a Warning severity if suspendFor is null, or an Error severity if suspendFor is set.
  • Based on the value of suspendFor, adTempus may suspend processing of the trigger:
    • If suspendFor is null, the trigger is not suspended and will continue to be evaluated the next time a triggering event occurs or on the next polling loop for triggers that use polling.
    • If suspendFor is System.TimeSpan.MaxValue, the trigger is suspended until the job is requeued (e.g., by editing it or holding and releasing it, or by restarting the adTempus service).
    • If suspendFor is set to any other value, the trigger is suspended until the the specified interval has elapsed or until job is requeued (e.g., by editing it or holding and releasing it, or by restarting the adTempus service).

This method should be used only in scenarios where all processing for the trigger should be suspended. For example, if your script checks email messages against a database and that database is temporarily unavailable, you can suspend trigger processing for an appropriate time.

It should not be used to indicate a problem with a single item or event. For polling triggers such as Email Triggers and File Triggers, the trigger may be processing a batch of items (e.g., email messages, files) at once. Calling ReportProcessingFailure causes the processing to abort immediately without processing the remaining items in the batch. These items will be processed when the trigger resumes processing, assuming they are still present (e.g., the email message or file has not been deleted). That is, your script will eventually be called to evaluate the same item again, so calling ReportProcessingFailure does not allow you to "skip" a particular item. To do this, the proper approach is to return a false value, which instructs adTempus not to trigger for the item. If you need to communicate a problem that affects only one item, call adTempus.LogMessage to log a message.

Inherited Members