Class WorkflowRuntime
OptimaJet.Workflow.SQLite.Models.WorkflowRuntime
Database object for workflow runtime status and multi-server coordination operations.
Namespace: OptimaJet.Workflow.SQLite.Models
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
schemaNameStringThe database schema name.
commandTimeoutInt32The 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
connectionSqliteConnectionThe SQLite connection.
statusWorkflowRuntimeModelThe runtime model with the new status.
oldLockGuidThe 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
connectionSqliteConnectionThe SQLite connection.
statusWorkflowRuntimeModelThe runtime model with the new restorer.
oldLockGuidThe 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
connectionSqliteConnectionThe 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
connectionSqliteConnectionThe SQLite connection.
currentRuntimeIdStringThe 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
connectionSqliteConnectionThe SQLite connection.
runtimeIdStringThe 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
connectionSqliteConnectionThe SQLite connection.
runtimeIdStringThe runtime identifier.
timeDateTimeThe 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
connectionSqliteConnectionThe SQLite connection.
runtimeIdStringThe runtime identifier.
nextTimeColumnNameStringThe name of the next time column to update.
timeDateTimeThe new next time value.
transactionSqliteTransactionAn 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
connectionSqliteConnectionThe SQLite connection.
runtimeIdStringThe current runtime identifier to exclude.
nextTimeColumnNameStringThe 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.