Table of Contents

Class RuntimeOptions

Namespace
DCR.Workflow
Assembly
DCR.Workflow.dll

Options for DCR Runtime. The properties are usually set in appsettings.json under DCR:Runtime.

public class RuntimeOptions
Inheritance
RuntimeOptions
Inherited Members
Extension Methods

Examples

The default settings correspond to this configuration file:

{ "DCR": 
  { "Workflow": 
    { "Runtime": 
      {
        "WithRobots": false,
        "MaxRobots": 256,
        "Timeout": null,
        "PersistUpdates": false,
        "IgnoreUnknownEffects": false,
        "DetectRoleMismatch": false
      }
    }
  }
}

Note that WithRobots is overriden by AddDefault(IRuntimeBuilder).

Remarks

These options all regulate the behaviour of Runtime.Execute. This method is always called with a particular activity to execute. We call this activity the main activity.

Fields

Section

public const string Section = "DCR:Workflow:Runtime"

Field Value

string

Properties

DetectRoleMismatch

If true, report an access control violation if the main activity is not accessible for the requested role (role parameter to Runtime.Execute).

public bool DetectRoleMismatch { get; set; }

Property Value

bool

Remarks

If true, an exception will be thrown iff

  1. The main activity has at least one non-empty role, and
  2. the requested role is not one of those non-empty roles.

Note that this means that any role can execute an activity that does not have an associated role.

Holidays

List of non-weekend bank holidays used in workday-duration computations (e.g., expression P3WD)

public DateTime[] Holidays { get; set; }

Property Value

DateTime[]

Ignore

List of specific effects to ignore.

public List<string> Ignore { get; set; }

Property Value

List<string>

IgnoreUnknownEffects

If true, activites requesting effects not configured will trigger a warning in the log. If false, requesting an effect will trigger a run-time exception.

public bool IgnoreUnknownEffects { get; set; }

Property Value

bool

Remarks

Using this option is not recommended, since it will make misspellings in effect ids result in effects silently not executing.

MaxRobots

Maximum number of robot activities to execute as part of one call to Runtime.Execute.

public int MaxRobots { get; set; }

Property Value

int

Remarks

Setting this to 0 is equivalent to setting WithRobots to false. Default is 256.

See Also

PersistUpdates

If true, require an ICasePersistor to be provided and persist model updates during activity execution.

public bool PersistUpdates { get; set; }

Property Value

bool

Remarks

Note that setting this option to true requires the Runtime to be instantiated with a non-null ICaseContext.

See Also

RequiredContext

Keys required in the context for valid execution. If any key on this list is not present, Runtime.Execute will throw KeyNotFoundException

public string[] RequiredContext { get; set; }

Property Value

string[]

SetTimestamp

Indicate under what circumstances the runtime should update model time when executing activities.

public RuntimeOptions.SetTimestampOptions SetTimestamp { get; set; }

Property Value

RuntimeOptions.SetTimestampOptions

TimeZone

Timezone to assume for date values that do not specify a timezone.

public TimeZoneInfo? TimeZone { get; set; }

Property Value

TimeZoneInfo

Remarks

Defaults to CET if not set.

Timeout

Maximum time spent carrying out a single activity execution request.

public TimeSpan Timeout { get; set; }

Property Value

TimeSpan

Remarks

This option limits only the time spent executing robot activities. Once the limit is reached, no more robots will be executed, and only pending effect continuations will be executed. If they themselves have effects, those effects will be declared failed without execution.

See Also

UpdateModelLog

If true make Runtime.Execute create or add to the <log> element in the XML-representation of model.
Default true.

public bool UpdateModelLog { get; set; }

Property Value

bool

WithRobots

Determines whether activities with robot roles are run automatically after calls to Runtime.Execute.

public bool WithRobots { get; set; }

Property Value

bool

Remarks

When set, after execution the main activity and its optional effect continuation, the middleware will repeatedly select an event satisfying the following eligibility criteria and execute it:

Role Eligibility
Robot A
LocalRobot B

Activity must be enabled and pending | Activity must be enabled and locally pending

Robot take precedence over LocalRobot, but otherwise, activities are selected non-deterministically. Selection and execution of robots continutes until no activity is eligible, or possibly until the Timeout is reached, or the budget for robot executions is exhausted.

Setting this option to false is equivalent to setting MaxRobots to 0. The default value is false, but do note that AddRobots(IRuntimeBuilder) and AddDefault(IRuntimeBuilder).