Workflow Engine .NET

Assembly: OptimaJet.Workflow.SQLite

Class WorkflowRuntime

OptimaJet.Workflow.SQLite.Models.WorkflowRuntime

Database object for workflow runtime status and multi-server coordination operations.

public class WorkflowRuntime : DbObject<RuntimeEntity>

Inheritance

  • Object
  • DbObject<RuntimeEntity>

Constructors

public WorkflowRuntime(string schemaName, int commandTimeout) #
Initializes a new instance of WorkflowRuntime.

Parameters

Name
Type
Description
schemaName
String
The database schema name.
commandTimeout
Int32
The command timeout in seconds.

Methods

public Task<int> UpdateStatusAsync(SqliteConnection connection, WorkflowRuntimeModel status, Guid oldLock) #
Updates the runtime status using optimistic locking.

Parameters

Name
Type
Description
connection
SqliteConnection
The SQLite connection.
status
WorkflowRuntimeModel
The runtime model with the new status.
oldLock
Guid
The current lock value for optimistic concurrency.

Returns

Type
Description
Task<Int32>
The number of rows affected.
public Task<int> UpdateRestorerAsync(SqliteConnection connection, WorkflowRuntimeModel status, Guid oldLock) #
Updates the runtime restorer identifier using optimistic locking.

Parameters

Name
Type
Description
connection
SqliteConnection
The SQLite connection.
status
WorkflowRuntimeModel
The runtime model with the new restorer.
oldLock
Guid
The current lock value for optimistic concurrency.

Returns

Type
Description
Task<Int32>
The number of rows affected.
public Task<bool> MultiServerRuntimesExistAsync(SqliteConnection connection) #
Checks whether multiple active workflow runtimes exist in the database.

Parameters

Name
Type
Description
connection
SqliteConnection
The SQLite connection.

Returns

Type
Description
Task<Boolean>
true if more than one active runtime exists; otherwise, false.
public Task<int> GetActiveMultiServerRuntimesCountAsync(SqliteConnection connection, string currentRuntimeId) #
Returns the count of active runtimes excluding the current one.

Parameters

Name
Type
Description
connection
SqliteConnection
The SQLite connection.
currentRuntimeId
String
The current runtime identifier to exclude.

Returns

Type
Description
Task<Int32>
The number of other active runtimes.
public Task<WorkflowRuntimeModel> GetWorkflowRuntimeStatusAsync(SqliteConnection connection, string runtimeId) #
Gets the runtime status model for the specified runtime identifier.

Parameters

Name
Type
Description
connection
SqliteConnection
The SQLite connection.
runtimeId
String
The runtime identifier.

Returns

Type
Description
Task<WorkflowRuntimeModel>
The runtime model, or null if not found.
public Task<int> SendRuntimeLastAliveSignalAsync(SqliteConnection connection, string runtimeId, DateTime time) #
Updates the last alive signal timestamp for the specified runtime.

Parameters

Name
Type
Description
connection
SqliteConnection
The SQLite connection.
runtimeId
String
The runtime identifier.
time
DateTime
The timestamp of the alive signal.

Returns

Type
Description
Task<Int32>
The number of rows affected.
public Task<int> UpdateNextTimeAsync(SqliteConnection connection, string runtimeId, string nextTimeColumnName, DateTime time, SqliteTransaction transaction = null) #
Updates the next timer time column for the specified runtime.

Parameters

Name
Type
Description
connection
SqliteConnection
The SQLite connection.
runtimeId
String
The runtime identifier.
nextTimeColumnName
String
The name of the next time column to update.
time
DateTime
The new next time value.
transaction
SqliteTransaction
An optional transaction.

Returns

Type
Description
Task<Int32>
The number of rows affected.
public Task<DateTime?> GetMaxNextTimeAsync(SqliteConnection connection, string runtimeId, string nextTimeColumnName) #
Gets the maximum next timer time across all other active runtimes.

Parameters

Name
Type
Description
connection
SqliteConnection
The SQLite connection.
runtimeId
String
The current runtime identifier to exclude.
nextTimeColumnName
String
The name of the next time column to query.

Returns

Type
Description
Task<DateTime>
The maximum next time, or null if no other active runtimes exist.