Table of Contents

Class TemporalWorkerServiceOptionsBuilderExtensions

Namespace
Temporalio.Extensions.Hosting
Assembly
Temporalio.Extensions.Hosting.dll

Extension methods for ITemporalWorkerServiceOptionsBuilder to configure worker services.

public static class TemporalWorkerServiceOptionsBuilderExtensions
Inheritance
TemporalWorkerServiceOptionsBuilderExtensions
Inherited Members

Methods

AddActivitiesInstance(ITemporalWorkerServiceOptionsBuilder, Type, object)

Register the given type's activities with an existing instance. The given instance will be used to invoke non-static activity methods.

public static ITemporalWorkerServiceOptionsBuilder AddActivitiesInstance(this ITemporalWorkerServiceOptionsBuilder builder, Type type, object instance)

Parameters

builder ITemporalWorkerServiceOptionsBuilder

Builder to use.

type Type

Type to register activities for.

instance object

Instance to use.

Returns

ITemporalWorkerServiceOptionsBuilder

Same builder instance.

AddActivitiesInstance<T>(ITemporalWorkerServiceOptionsBuilder, T)

Register the given type's activities with an existing instance. The given instance will be used to invoke non-static activity methods.

public static ITemporalWorkerServiceOptionsBuilder AddActivitiesInstance<T>(this ITemporalWorkerServiceOptionsBuilder builder, T instance)

Parameters

builder ITemporalWorkerServiceOptionsBuilder

Builder to use.

instance T

Instance to use.

Returns

ITemporalWorkerServiceOptionsBuilder

Same builder instance.

Type Parameters

T

Type to register activities for.

AddScopedActivities(ITemporalWorkerServiceOptionsBuilder, Type)

Register the given type as a scoped if not already done and all activities of the given type to the worker. Basically TryAddScoped(IServiceCollection, Type) + ApplyTemporalActivities(ITemporalWorkerServiceOptionsBuilder, Type).

public static ITemporalWorkerServiceOptionsBuilder AddScopedActivities(this ITemporalWorkerServiceOptionsBuilder builder, Type type)

Parameters

builder ITemporalWorkerServiceOptionsBuilder

Builder to use.

type Type

Type to register activities for.

Returns

ITemporalWorkerServiceOptionsBuilder

Same builder instance.

AddScopedActivities<T>(ITemporalWorkerServiceOptionsBuilder)

Register the given type as scoped if not already done and all activities of the given type to the worker. Basically TryAddScoped<TService>(IServiceCollection) + ApplyTemporalActivities<T>(ITemporalWorkerServiceOptionsBuilder).

public static ITemporalWorkerServiceOptionsBuilder AddScopedActivities<T>(this ITemporalWorkerServiceOptionsBuilder builder)

Parameters

builder ITemporalWorkerServiceOptionsBuilder

Builder to use.

Returns

ITemporalWorkerServiceOptionsBuilder

Same builder instance.

Type Parameters

T

Type to register activities for.

AddSingletonActivities(ITemporalWorkerServiceOptionsBuilder, Type)

Register the given type as a singleton if not already done and all activities of the given type to the worker. Basically TryAddSingleton(IServiceCollection, Type) + ApplyTemporalActivities(ITemporalWorkerServiceOptionsBuilder, Type).

public static ITemporalWorkerServiceOptionsBuilder AddSingletonActivities(this ITemporalWorkerServiceOptionsBuilder builder, Type type)

Parameters

builder ITemporalWorkerServiceOptionsBuilder

Builder to use.

type Type

Type to register activities for.

Returns

ITemporalWorkerServiceOptionsBuilder

Same builder instance.

AddSingletonActivities<T>(ITemporalWorkerServiceOptionsBuilder)

Register the given type as a singleton if not already done and all activities of the given type to the worker. Basically TryAddSingleton<TService>(IServiceCollection) + ApplyTemporalActivities<T>(ITemporalWorkerServiceOptionsBuilder).

public static ITemporalWorkerServiceOptionsBuilder AddSingletonActivities<T>(this ITemporalWorkerServiceOptionsBuilder builder)

Parameters

builder ITemporalWorkerServiceOptionsBuilder

Builder to use.

Returns

ITemporalWorkerServiceOptionsBuilder

Same builder instance.

Type Parameters

T

Type to register activities for.

AddStaticActivities(ITemporalWorkerServiceOptionsBuilder, Type)

Register the given type's activities. The activity methods must all be static.

public static ITemporalWorkerServiceOptionsBuilder AddStaticActivities(this ITemporalWorkerServiceOptionsBuilder builder, Type type)

Parameters

builder ITemporalWorkerServiceOptionsBuilder

Builder to use.

type Type

Type to register activities for.

Returns

ITemporalWorkerServiceOptionsBuilder

Same builder instance.

AddStaticActivities<T>(ITemporalWorkerServiceOptionsBuilder)

Register the given type's activities. The activity methods must all be static.

public static ITemporalWorkerServiceOptionsBuilder AddStaticActivities<T>(this ITemporalWorkerServiceOptionsBuilder builder)

Parameters

builder ITemporalWorkerServiceOptionsBuilder

Builder to use.

Returns

ITemporalWorkerServiceOptionsBuilder

Same builder instance.

Type Parameters

T

Type to register activities for.

AddTransientActivities(ITemporalWorkerServiceOptionsBuilder, Type)

Register the given type as transient if not already done and all activities of the given type to the worker. Basically TryAddTransient(IServiceCollection, Type) + ApplyTemporalActivities(ITemporalWorkerServiceOptionsBuilder, Type).

public static ITemporalWorkerServiceOptionsBuilder AddTransientActivities(this ITemporalWorkerServiceOptionsBuilder builder, Type type)

Parameters

builder ITemporalWorkerServiceOptionsBuilder

Builder to use.

type Type

Type to register activities for.

Returns

ITemporalWorkerServiceOptionsBuilder

Same builder instance.

AddTransientActivities<T>(ITemporalWorkerServiceOptionsBuilder)

Register the given type as transient if not already done and all activities of the given type to the worker. Basically TryAddTransient<TService>(IServiceCollection) + ApplyTemporalActivities<T>(ITemporalWorkerServiceOptionsBuilder).

public static ITemporalWorkerServiceOptionsBuilder AddTransientActivities<T>(this ITemporalWorkerServiceOptionsBuilder builder)

Parameters

builder ITemporalWorkerServiceOptionsBuilder

Builder to use.

Returns

ITemporalWorkerServiceOptionsBuilder

Same builder instance.

Type Parameters

T

Type to register activities for.

AddWorkflow(ITemporalWorkerServiceOptionsBuilder, Type)

Add the given workflow type as a workflow on this worker service.

public static ITemporalWorkerServiceOptionsBuilder AddWorkflow(this ITemporalWorkerServiceOptionsBuilder builder, Type type)

Parameters

builder ITemporalWorkerServiceOptionsBuilder

Builder to use.

type Type

Workflow type.

Returns

ITemporalWorkerServiceOptionsBuilder

Same builder instance.

AddWorkflow<T>(ITemporalWorkerServiceOptionsBuilder)

Add the given workflow type as a workflow on this worker service.

public static ITemporalWorkerServiceOptionsBuilder AddWorkflow<T>(this ITemporalWorkerServiceOptionsBuilder builder)

Parameters

builder ITemporalWorkerServiceOptionsBuilder

Builder to use.

Returns

ITemporalWorkerServiceOptionsBuilder

Same builder instance.

Type Parameters

T

Workflow type.

ApplyTemporalActivities(ITemporalWorkerServiceOptionsBuilder, Type)

Register the given type's activities. This uses the service provider to create the instance for non-static methods, but does not register the type/instance with the service collection.

public static ITemporalWorkerServiceOptionsBuilder ApplyTemporalActivities(this ITemporalWorkerServiceOptionsBuilder builder, Type type)

Parameters

builder ITemporalWorkerServiceOptionsBuilder

Builder to use.

type Type

Type to register activities for.

Returns

ITemporalWorkerServiceOptionsBuilder

Same builder instance.

ApplyTemporalActivities<T>(ITemporalWorkerServiceOptionsBuilder)

Register the given type's activities. This uses the service provider to create the instance for non-static methods, but does not register the type/instance with the service collection.

public static ITemporalWorkerServiceOptionsBuilder ApplyTemporalActivities<T>(this ITemporalWorkerServiceOptionsBuilder builder)

Parameters

builder ITemporalWorkerServiceOptionsBuilder

Builder to use.

Returns

ITemporalWorkerServiceOptionsBuilder

Same builder instance.

Type Parameters

T

Type to register activities for.

ConfigureOptions(ITemporalWorkerServiceOptionsBuilder, Action<TemporalWorkerServiceOptions>, bool)

Configure worker service options using an action.

public static ITemporalWorkerServiceOptionsBuilder ConfigureOptions(this ITemporalWorkerServiceOptionsBuilder builder, Action<TemporalWorkerServiceOptions> configure, bool disallowDuplicates = false)

Parameters

builder ITemporalWorkerServiceOptionsBuilder

Builder to use.

configure Action<TemporalWorkerServiceOptions>

Configuration action.

disallowDuplicates bool

If true, will fail if options already registered for this builder's task queue and build ID.

Returns

ITemporalWorkerServiceOptionsBuilder

Same builder instance.

ConfigureOptions(ITemporalWorkerServiceOptionsBuilder, bool)

Get an options builder to configure worker service options.

public static OptionsBuilder<TemporalWorkerServiceOptions> ConfigureOptions(this ITemporalWorkerServiceOptionsBuilder builder, bool disallowDuplicates = false)

Parameters

builder ITemporalWorkerServiceOptionsBuilder

Builder to use.

disallowDuplicates bool

If true, will fail if options already registered for this builder's task queue and build ID.

Returns

OptionsBuilder<TemporalWorkerServiceOptions>

Options builder.