Class XBRApiRoutines
Provides factory methods for creating routine clients and managing routine system interactions.
Namespace: Workspace.XBR.Xperiflow.SubApis
Assembly: Xperiflow.dll
public class XBRApiRoutines
Examples
Basic routine client creation and usage:
// Create a routine client for general use
var routineClient = XBRApi.Routines.GetRoutineClient(sessionInfo);
// Create a routine instance
var instance = routineClient.CreateRoutineInstanceAsync(
"DataProcessor",
"1.0.0",
"Daily Processing Instance"
).Result;
// Execute a routine method
var run = instance.CreateMethodRunAsync(
"process_data",
inputParams: new JObject { ["date"] = "2023-12-01" }
).Result;
// Monitor execution and get results
run.WaitForCompletionAsync().Wait();
var artifacts = run.GetArtifactsAsync().Result;
Project-specific routine client for AI integration:
// Create a routine client scoped to a specific AI project
var projectRoutineClient = XBRApi.Routines.GetRoutineClient(sessionInfo, projectId: 123);
// Create an AI-specific routine instance
var aiInstance = projectRoutineClient.CreateRoutineInstanceAsync(
"AIModelTrainer",
"2.0.0",
"Monthly Model Training"
).Result;
// Execute model training
var trainingRun = aiInstance.CreateMethodRunAsync(
"train_model",
inputParams: new JObject {
["dataset"] = "customer_data_2023",
["algorithm"] = "random_forest"
},
storeArtifacts: true,
includeStatistics: true
).Result;
trainingRun.WaitForCompletionAsync().Result;
var modelArtifacts = trainingRun.GetArtifactsAsync().Result;
Remarks
The Workspace.XBR.Xperiflow.SubApis.XBRApiRoutines class serves as the primary entry point for accessing the Xperiflow routine system. It provides factory methods to create appropriately configured Workspace.XBR.Xperiflow.Routines.IRoutineClient instances that can be used to manage routine instances, execute routine methods, and handle routine-related operations.
Key Features:
-
Multiple Client Types Support for both general routine clients and project-specific clients for AI project integration
-
Solution Scoping Ability to scope routine clients to specific solution codes for multi-tenant scenarios
-
Dependency Management Automatic configuration of all required dependencies including file system clients, metadata lookup clients, and artifact resolvers
-
Authentication Support Optional OIS token support for authenticated operations
Client Configuration:
The factory methods handle the complex initialization of routine clients, including setting up HTTP clients, file system connections, metadata lookup services, and artifact data resolvers. This ensures that clients are properly configured for production use with minimal setup code.
Thread Safety:
All methods in this class are thread-safe and can be called concurrently from multiple threads. The created routine clients are also thread-safe for concurrent operations.
Methods
GetRoutineClient(SessionInfo, OISToken)
Creates a routine client using the default solution code for general routine operations.
public IRoutineClient GetRoutineClient(SessionInfo si, OISToken oisToken = null)
Remarks
This method creates a routine client configured with the default solution code, making it suitable for general routine operations that don't require specific solution scoping.
The created client includes all necessary dependencies:
Returns
Workspace.XBR.Xperiflow.Routines.IRoutineClient
A configured Workspace.XBR.Xperiflow.Routines.IRoutineClient instance ready for routine operations
Parameters
Type | Name | Description |
---|---|---|
OneStream.Shared.Common.SessionInfo | si | The session information containing user context and connection details |
OneStream.Shared.Wcf.OISToken | oisToken | Optional OIS authentication token for secure operations. If null, uses default authentication |
Exceptions
OneStream.Shared.Common.XFException
Thrown when client creation fails due to configuration or authentication issues
GetRoutineClient(SessionInfo, string, OISToken)
Creates a routine client scoped to a specific solution code for multi-tenant scenarios.
public IRoutineClient GetRoutineClient(SessionInfo si, string solutionCode, OISToken oisToken = null)
Remarks
This method creates a routine client that is scoped to a specific solution code, enabling multi-tenant scenarios where different solutions need isolated routine environments.
Solution Scoping Benefits:
Returns
Workspace.XBR.Xperiflow.Routines.IRoutineClient
A configured Workspace.XBR.Xperiflow.Routines.IRoutineClient instance scoped to the specified solution code
Parameters
Type | Name | Description |
---|---|---|
OneStream.Shared.Common.SessionInfo | si | The session information containing user context and connection details |
System.String | solutionCode | The solution code to scope the client to. All routines created by this client will be associated with this solution |
OneStream.Shared.Wcf.OISToken | oisToken | Optional OIS authentication token for secure operations. If null, uses default authentication |
Exceptions
OneStream.Shared.Common.XFException
Thrown when client creation fails due to configuration, authentication, or invalid solution code
GetRoutineClient(SessionInfo, int, OISToken)
Creates a routine client scoped to a specific AI project for AI-integrated routine operations.
public IRoutineClient GetRoutineClient(SessionInfo si, int projectId, OISToken oisToken = null)
Remarks
This method creates a routine client that is specifically configured for AI project integration, enabling seamless interaction between routine operations and AI project workflows.
AI Project Integration Features:
Returns
Workspace.XBR.Xperiflow.Routines.IRoutineClient
A configured Workspace.XBR.Xperiflow.Routines.IRoutineClient instance scoped to the specified AI project
Parameters
Type | Name | Description |
---|---|---|
OneStream.Shared.Common.SessionInfo | si | The session information containing user context and connection details |
System.Int32 | projectId | The unique identifier of the AI project to scope the client to |
OneStream.Shared.Wcf.OISToken | oisToken | Optional OIS authentication token for secure operations. If null, uses default authentication |
Exceptions
OneStream.Shared.Common.XFException
Thrown when client creation fails due to configuration, authentication, or invalid project ID
GetRoutineClient(SessionInfo, int, string, OISToken)
Creates a routine client scoped to both a specific AI project and solution code for comprehensive project integration.
public IRoutineClient GetRoutineClient(SessionInfo si, int projectId, string solutionCode, OISToken oisToken = null)
Remarks
This method creates a routine client that combines both AI project integration and solution scoping, providing the most comprehensive configuration for complex multi-tenant AI scenarios.
Combined Scoping Benefits:
Storage Configuration:
The client is configured with a project-specific connection key that ensures all routine data is stored in the appropriate project context while maintaining solution-level organization.
Returns
Workspace.XBR.Xperiflow.Routines.IRoutineClient
A configured Workspace.XBR.Xperiflow.Routines.IRoutineClient instance scoped to both the specified AI project and solution code
Parameters
Type | Name | Description |
---|---|---|
OneStream.Shared.Common.SessionInfo | si | The session information containing user context and connection details |
System.Int32 | projectId | The unique identifier of the AI project to scope the client to |
System.String | solutionCode | The solution code to scope the client to. All routines created by this client will be associated with this solution |
OneStream.Shared.Wcf.OISToken | oisToken | Optional OIS authentication token for secure operations. If null, uses default authentication |
Exceptions
OneStream.Shared.Common.XFException
Thrown when client creation fails due to configuration, authentication, invalid project ID, or invalid solution code
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