Class DefaultOrchestrationManager
The default orchestration manager.
Inherited Members
Namespace: Kephas.Orchestration
Assembly: Kephas.Orchestration.dll
Syntax
[OverridePriority(Priority.Low)]
public class DefaultOrchestrationManager : Loggable, ILoggable, IOrchestrationManager, IAsyncInitializable, IAsyncFinalizable
Constructors
| Improve this Doc View SourceDefaultOrchestrationManager(IAppRuntime, IEventHub, IMessageBroker, IExportFactory<IProcessStarterFactory>)
Initializes a new instance of the DefaultOrchestrationManager class.
Declaration
public DefaultOrchestrationManager(IAppRuntime appRuntime, IEventHub eventHub, IMessageBroker messageBroker, IExportFactory<IProcessStarterFactory> processStarterFactoryFactory)
Parameters
Type | Name | Description |
---|---|---|
IAppRuntime | appRuntime | The application runtime. |
IEventHub | eventHub | The event hub. |
IMessageBroker | messageBroker | The message broker. |
IExportFactory<IProcessStarterFactory> | processStarterFactoryFactory | Factory for the process starter factory. |
Properties
| Improve this Doc View SourceAppContext
Gets a context for the application.
Declaration
public IContext AppContext { get; }
Property Value
Type | Description |
---|---|
IContext | The application context. |
AppRuntime
Gets the application runtime.
Declaration
public IAppRuntime AppRuntime { get; }
Property Value
Type | Description |
---|---|
IAppRuntime | The application runtime. |
EventHub
Gets the event hub.
Declaration
public IEventHub EventHub { get; }
Property Value
Type | Description |
---|---|
IEventHub | The event hub. |
LiveApps
Gets the live apps cache.
Declaration
protected ConcurrentDictionary<string, IAppEvent> LiveApps { get; }
Property Value
Type | Description |
---|---|
System.Collections.Concurrent.ConcurrentDictionary<System.String, IAppEvent> | The live apps cache. |
MessageBroker
Gets the message broker.
Declaration
public IMessageBroker MessageBroker { get; }
Property Value
Type | Description |
---|---|
IMessageBroker | The message broker. |
TimerDueTime
Gets or sets the timer due time.
Declaration
protected TimeSpan TimerDueTime { get; set; }
Property Value
Type | Description |
---|---|
System.TimeSpan | The timer due time. |
TimerPeriod
Gets or sets the timer period.
Declaration
protected TimeSpan TimerPeriod { get; set; }
Property Value
Type | Description |
---|---|
System.TimeSpan | The timer period. |
Methods
| Improve this Doc View SourceCreateAppHeartbeatEvent()
Creates application heartbeat event.
Declaration
protected virtual AppHeartbeatEvent CreateAppHeartbeatEvent()
Returns
Type | Description |
---|---|
AppHeartbeatEvent | The new application heartbeat event. |
CreateProcessStarterFactory(IAppInfo, IExpando, IContext)
Creates a new process starter factory.
Declaration
protected virtual IProcessStarterFactory CreateProcessStarterFactory(IAppInfo appInfo, IExpando arguments, IContext context = null)
Parameters
Type | Name | Description |
---|---|---|
IAppInfo | appInfo | Information describing the application. |
IExpando | arguments | The arguments. |
IContext | context | Optional. A context for initialization. |
Returns
Type | Description |
---|---|
IProcessStarterFactory | The new process starter factory. |
CreateStopAppMessage(IRuntimeAppInfo, IContext)
Creates stop application message.
Declaration
protected virtual StopAppMessage CreateStopAppMessage(IRuntimeAppInfo runtimeAppInfo, IContext context = null)
Parameters
Type | Name | Description |
---|---|---|
IRuntimeAppInfo | runtimeAppInfo | Information describing the runtime application. |
IContext | context | Optional. A context for initialization. |
Returns
Type | Description |
---|---|
StopAppMessage | The new stop application message. |
FinalizeAsync(IContext, CancellationToken)
Finalizes the service.
Declaration
public virtual Task FinalizeAsync(IContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IContext | context | The context for finalization. |
System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | An asynchronous result. |
GetAppExecutableArgs(IAppInfo)
Gets the app executable arguments.
Declaration
protected virtual IEnumerable<string> GetAppExecutableArgs(IAppInfo appInfo)
Parameters
Type | Name | Description |
---|---|---|
IAppInfo | appInfo | Information describing the application. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> | The app executable arguments. |
GetAppExecutablePath(IAppInfo)
Gets the app executable path.
Declaration
protected virtual string GetAppExecutablePath(IAppInfo appInfo)
Parameters
Type | Name | Description |
---|---|---|
IAppInfo | appInfo | Information describing the application. |
Returns
Type | Description |
---|---|
System.String | The app executable path. |
GetAppKey(IRuntimeAppInfo)
Gets the application key in the live apps collection.
Declaration
protected virtual string GetAppKey(IRuntimeAppInfo appInfo)
Parameters
Type | Name | Description |
---|---|---|
IRuntimeAppInfo | appInfo | Information describing the application. |
Returns
Type | Description |
---|---|
System.String | The application key. |
GetLiveAppsAsync(IContext, CancellationToken)
Gets the live apps asynchronously.
Declaration
public virtual Task<IEnumerable<IRuntimeAppInfo>> GetLiveAppsAsync(IContext context = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IContext | context | Optional. The context. |
System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<IRuntimeAppInfo>> | An asynchronous result that yields the live apps. |
InitializeAsync(IContext, CancellationToken)
Initializes the service asynchronously.
Declaration
public virtual Task InitializeAsync(IContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IContext | context | A context for initialization. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | An awaitable task. |
InitializeLiveAppsAsync(CancellationToken)
Initializes the live apps cache asynchronously.
Declaration
protected virtual Task InitializeLiveAppsAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | An asynchronous result. |
OnAppHeartbeatAsync(AppHeartbeatEvent, IContext, CancellationToken)
Callback invoked when an application notified its heartbeat.
Declaration
protected virtual Task OnAppHeartbeatAsync(AppHeartbeatEvent appEvent, IContext context, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
AppHeartbeatEvent | appEvent | The application event. |
IContext | context | An optional context for initialization. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | An asynchronous result. |
OnAppStartedAsync(AppStartedEvent, IContext, CancellationToken)
Callback invoked when an application was started.
Declaration
protected virtual Task OnAppStartedAsync(AppStartedEvent appEvent, IContext context, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
AppStartedEvent | appEvent | The application event. |
IContext | context | An optional context for initialization. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | An asynchronous result. |
OnAppStoppedAsync(AppStoppedEvent, IContext, CancellationToken)
Callback invoked when an application was stopped.
Declaration
protected virtual Task OnAppStoppedAsync(AppStoppedEvent appEvent, IContext context, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
AppStoppedEvent | appEvent | The application event. |
IContext | context | An optional context for initialization. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | An asynchronous result. |
OnHeartbeat(Object)
Executes the heartbeat timer action.
Declaration
protected virtual void OnHeartbeat(object state)
Parameters
Type | Name | Description |
---|---|---|
System.Object | state | The state. |
StartAppAsync(IAppInfo, IExpando, IContext, CancellationToken)
Starts the application asynchronously.
Declaration
public virtual Task<IOperationResult> StartAppAsync(IAppInfo appInfo, IExpando arguments, IContext context = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IAppInfo | appInfo | Information describing the application. |
IExpando | arguments | The arguments. |
IContext | context | Optional. The context. |
System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IOperationResult> | An asynchronous result that yields an operation result. |
StopAppAsync(IRuntimeAppInfo, IContext, CancellationToken)
Stops a running application asynchronously.
Declaration
public virtual Task<IOperationResult> StopAppAsync(IRuntimeAppInfo runtimeAppInfo, IContext context = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IRuntimeAppInfo | runtimeAppInfo | Information describing the runtime application. |
IContext | context | Optional. The context. |
System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IOperationResult> | An asynchronous result that yields an operation result. |