Class MessageConsumerJobBase<T>
public abstract class MessageConsumerJobBase<T> : JobBase, IHostedService, IDisposable
Type Parameters
T
- Inheritance
-
MessageConsumerJobBase<T>
- Implements
- Inherited Members
Constructors
MessageConsumerJobBase(JobParameters)
protected MessageConsumerJobBase(JobParameters parameters)
Parameters
parametersJobParameters
Properties
CanExecute
public override bool CanExecute { get; }
Property Value
Methods
CreateChannel(IServiceCollection)
Registers an IMessageChannel<T> singleton and returns it for direct use.
public static IMessageChannel<T> CreateChannel(IServiceCollection services)
Parameters
servicesIServiceCollection
Returns
ExecuteAsync(CancellationToken)
This method is called when the IHostedService starts. The implementation should return a task that represents the lifetime of the long running operation(s) being performed.
protected override Task ExecuteAsync(CancellationToken stoppingToken)
Parameters
stoppingTokenCancellationTokenTriggered when StopAsync(CancellationToken) is called.
Returns
Remarks
See Worker Services in .NET for implementation guidelines.
ExecuteJobAsync(IServices, IPrincipal, IProgress<Status>, CancellationToken)
Implements the actual job logic.
protected override sealed Task ExecuteJobAsync(IServices services, IPrincipal principal, IProgress<Status> progress, CancellationToken cancellationToken)
Parameters
servicesIServicesprincipalIPrincipalprogressIProgress<Status>cancellationTokenCancellationToken
Returns
ExecuteJobAsync(IServices, IPrincipal, IProgress<Status>, T, CancellationToken)
Implements the actual job logic.
protected abstract Task ExecuteJobAsync(IServices services, IPrincipal principal, IProgress<Status> progress, T message, CancellationToken cancellationToken)
Parameters
servicesIServicesprincipalIPrincipalprogressIProgress<Status>messageTcancellationTokenCancellationToken