Class RoutineClient
The RoutineClient
class provides methods to interact with the Routine system.
The RoutineClient
can largely be thought of as the main entrypoint into programmatically interacting with the Routine system. Create, monitor, and manage Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance objects,
their associated Workspace.XBR.Xperiflow.Routines.Runs.Run objects and Workspace.XBR.Xperiflow.Routines.Artifacts.Artifact objects to automate and orchestrate your own business processes and use cases.
Namespace: Workspace.XBR.Xperiflow.Routines
Assembly: Xperiflow.dll
public class RoutineClient : IRoutineClient
Implements: Workspace.XBR.Xperiflow.Routines.IRoutineClient
Methods
GetCurrentRunsCountAsync(MemoizedCacheInfo?, CancellationToken)
Gets the number of runs that are currently in an an Workspace.XBR.Xperiflow.Routines.Runs.ExecutionActivityStatusType.Running state.
This can be used to monitor the current load on the Routine system.If the number of runs is high, it may be an indication that the system is under heavy load. This can be used to help determine if the system is under heavy load and if it is a good time to start a new run.
public Task<int> GetCurrentRunsCountAsync(MemoizedCacheInfo? cacheInfo = null, CancellationToken cancellationToken = default)
Returns
Task<System.Int32>
The number of runs that are currently in an Workspace.XBR.Xperiflow.Routines.Runs.ExecutionActivityStatusType.Running state.
Parameters
Type | Name |
---|---|
Workspace.XBR.Xperiflow.Utilities.Http.MemoizedCacheInfo | cacheInfo |
System.Threading.CancellationToken | cancellationToken |
Exceptions
Workspace.XBR.Xperiflow.Routines.RoutineClientException
Thrown when an error occurs while retrieving the runs count.
OneStream.Shared.Common.XFException
The OneStream aggregate exception that wraps any exception thrown.
GetCurrentMemoryUsageAsync(MemoizedCacheInfo?, CancellationToken)
Gets the current memory usage (in gigabytes) of the Routine system. The memory usage is the total memory used by all the runs that are currently in an Workspace.XBR.Xperiflow.Routines.Runs.ExecutionActivityStatusType.Running state."/>
This can be used to monitor the current load on the Routine system. If the memory usage is high relative to the allowed total memory capacity, it may be an indication that the system is under heavy load.
public Task<double> GetCurrentMemoryUsageAsync(MemoizedCacheInfo? cacheInfo = null, CancellationToken cancellationToken = default)
Returns
Task<System.Double>
The current memory usage (in gigabytes) of the Routine system.
Parameters
Type | Name | Description |
---|---|---|
Workspace.XBR.Xperiflow.Utilities.Http.MemoizedCacheInfo | cacheInfo | |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Exceptions
Workspace.XBR.Xperiflow.Routines.RoutineClientException
Thrown when an error occurs while retrieving the memory usage.
OneStream.Shared.Common.XFException
The OneStream aggregate exception that wraps any exception thrown.
CreateRoutineInstanceAsync(string, string, string?, string, double?, IEnumerable<string>?, JObject?, MemoizedCacheInfo?, CancellationToken)
Creates a new Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance object."/>
public Task<RoutineInstance> CreateRoutineInstanceAsync(string routineTypename, string routineVersion, string? name = null, string description = "", double? memoryOverride = null, IEnumerable<string>? labels = null, JObject? attributes = null, MemoizedCacheInfo? cacheInfo = null, CancellationToken cancellationToken = default)
Returns
Task
< Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance >
The newly created RoutineInstance
object.
Parameters
Type | Name | Description |
---|---|---|
System.String | routineTypename | The type of routine to create. This name must match a known Routine registered within your Routine Library. |
System.String | routineVersion | The version of the routine to create. This is expected to be a Semantic Versioning 2.0 compliant version string that aligns to an existing version for the given routineTypename |
System.String | name | The user-provided name for this routine instance. |
System.String | description | The user-provided description for this routine instance. It is recommended to provide this to better identifiy the routine instance's purpose or usage. |
System.Nullable<System.Double> | memoryOverride | Whether or not to override the default memory capacity that is defined for this routineTypename . This memory override will be applied to all methods within this routine instance. Note there may system defined lower and upper bounds at runtime. |
System.Collections.Generic.IEnumerable<System.String> | labels | The user-provided labels for this routine instance. This is a list of strings that can be used to categorize or tag the routine instance. |
Newtonsoft.Json.Linq.JObject | attributes | The user-provided attributes for this routine instance. This is a JSON object that can be used to store additional metadata about the routine instance. |
Workspace.XBR.Xperiflow.Utilities.Http.MemoizedCacheInfo | cacheInfo | |
System.Threading.CancellationToken | cancellationToken |
Exceptions
System.ArgumentException
Thrown when the routineTypename or name is not provided or when the memoryOverride is provided and is less than or equal to 0.
Workspace.XBR.Xperiflow.Routines.RoutineClientException
Thrown when an error occurs while creating the Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance.
OneStream.Shared.Common.XFException
The OneStream aggregate exception that wraps any exception thrown.
CreateRoutineInstanceAsync(string, Version, string?, string, double?, IEnumerable<string>?, JObject?, MemoizedCacheInfo?, CancellationToken)
Creates a new routine instance with the specified parameters using a strongly-typed version.
public Task<RoutineInstance> CreateRoutineInstanceAsync(string routineType, Version routineVersion, string? name = null, string description = "", double? memoryOverride = null, IEnumerable<string>? labels = null, JObject? attributes = null, MemoizedCacheInfo? cacheInfo = null, CancellationToken cancellationToken = default)
Remarks
This overload provides the same functionality as the string-based version but accepts
a System.Version
object for type safety and better version validation.
Returns
Task
< Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance >
A task that represents the asynchronous operation. The task result contains the newly created Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance.
Parameters
Type | Name | Description |
---|---|---|
System.String | routineType | |
System.Version | routineVersion | The version of the routine as a System.Version object |
System.String | name | Optional user-friendly name for the routine instance |
System.String | description | Optional description of the routine instance |
System.Nullable<System.Double> | memoryOverride | Optional memory limit override in gigabytes |
System.Collections.Generic.IEnumerable<System.String> | labels | Optional collection of labels to associate with the instance |
Newtonsoft.Json.Linq.JObject | attributes | Optional JSON object containing custom attributes |
Workspace.XBR.Xperiflow.Utilities.Http.MemoizedCacheInfo | cacheInfo | Optional caching information to improve performance |
System.Threading.CancellationToken | cancellationToken | Token to monitor for cancellation requests |
Exceptions
System.ArgumentNullException
Thrown when routineTypename or routineVersion is null
System.ArgumentException
Thrown when routineTypename is invalid
Workspace.XBR.Xperiflow.Routines.RoutineClientException
Thrown when an error occurs during instance creation
DeleteRoutineInstanceAsync(string, MemoizedCacheInfo?, CancellationToken)
Deletes a Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance object by its identifier.
Caution: that this will also delete all runs and artifacts associated with this Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance object.
public Task DeleteRoutineInstanceAsync(string instanceIdentifier, MemoizedCacheInfo? cacheInfo = null, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task
null
Parameters
Type | Name | Description |
---|---|---|
System.String | instanceIdentifier | The unique identifier of the Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance. |
Workspace.XBR.Xperiflow.Utilities.Http.MemoizedCacheInfo | cacheInfo | |
System.Threading.CancellationToken | cancellationToken |
Exceptions
System.ArgumentException
Thrown when the instanceIdentifier is not provided.
Workspace.XBR.Xperiflow.Routines.RoutineClientException
Thrown when an error occurs while deleting the Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance.
OneStream.Shared.Common.XFException
The OneStream aggregate exception that wraps any exception thrown.
GetRoutineInstanceAsync(string, MemoizedCacheInfo?, CancellationToken)
Gets a Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance object by its identifier. If the routine instance does not exist, the method will return null
.
public Task<RoutineInstance?> GetRoutineInstanceAsync(string instanceIdentifier, MemoizedCacheInfo? cacheInfo = null, CancellationToken cancellationToken = default)
Returns
Task
< Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance >
The Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance object, or null if the routine instance does not exist.
Parameters
Type | Name | Description |
---|---|---|
System.String | instanceIdentifier | The unique identifier of the Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance. |
Workspace.XBR.Xperiflow.Utilities.Http.MemoizedCacheInfo | cacheInfo | |
System.Threading.CancellationToken | cancellationToken |
Exceptions
System.ArgumentException
Thrown when the instanceIdentifier is not provided.
OneStream.Shared.Common.XFException
The OneStream aggregate exception that wraps any exception thrown.
GetRoutineInstanceByNameAsync(string, MemoizedCacheInfo?, CancellationToken)
Gets a Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance object by its name. If the routine instance does not exist, the method will return null
.
public Task<RoutineInstance?> GetRoutineInstanceByNameAsync(string instanceName, MemoizedCacheInfo? cacheInfo = null, CancellationToken cancellationToken = default)
Returns
Task
< Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance >
The Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance object, or null if the routine instance does not exist.
Parameters
Type | Name | Description |
---|---|---|
System.String | instanceName | The user-provided name for the Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance. |
Workspace.XBR.Xperiflow.Utilities.Http.MemoizedCacheInfo | cacheInfo | |
System.Threading.CancellationToken | cancellationToken |
Exceptions
System.ArgumentException
Thrown when the instanceName is not provided.
OneStream.Shared.Common.XFException
The OneStream aggregate exception that wraps any exception thrown.
GetRoutineInstancesByTypenameAsync(string, MemoizedCacheInfo?, CancellationToken)
Gets a list of Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance objects by their typename.
public Task<List<RoutineInstance>> GetRoutineInstancesByTypenameAsync(string routineTypename, MemoizedCacheInfo? cacheInfo = null, CancellationToken cancellationToken = default)
Returns
Task<System.Collections.Generic.List{Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance}>
A list of Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstance objects.
Parameters
Type | Name | Description |
---|---|---|
System.String | routineTypename | The type of routine to retrieve. This name must match a known Routine registered within your Routine Library. |
Workspace.XBR.Xperiflow.Utilities.Http.MemoizedCacheInfo | cacheInfo | |
System.Threading.CancellationToken | cancellationToken |
Exceptions
System.ArgumentException
Thrown when the routineTypename is not provided.
OneStream.Shared.Common.XFException
The OneStream aggregate exception that wraps any exception thrown.
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object,System.Object)
System.Object.GetHashCode
System.Object.GetType
System.Object.MemberwiseClone
System.Object.ReferenceEquals(System.Object,System.Object)
System.Object.ToString