Class Agent
- Namespace
- MassTransit.Middleware
- Assembly
- MassTransit.Abstractions.dll
An Agent Provocateur that simply exists, out of context
public class Agent : IAgent
- Inheritance
-
Agent
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
Agent()
Creates the Agent
public Agent()
Properties
Completed
A Task which is completed when the agent has completed (should never be set to Faulted, per convention)
public Task Completed { get; }
Property Value
IsAlreadyCompleted
protected bool IsAlreadyCompleted { get; }
Property Value
IsAlreadyReady
protected bool IsAlreadyReady { get; }
Property Value
IsStopped
True if the agent is stopped
protected bool IsStopped { get; }
Property Value
IsStopping
True if the agent is in the process of stopping or is stopped
protected bool IsStopping { get; }
Property Value
Ready
A Task which can be awaited and is completed when the agent is either ready or faulted/canceled
public Task Ready { get; }
Property Value
Stopped
The token which indicates if the agent is stopped
public CancellationToken Stopped { get; }
Property Value
Stopping
The token which indicates if the agent is in the process of stopping (or stopped)
public CancellationToken Stopping { get; }
Property Value
Methods
SetCompleted(Task)
Set the agent Completed for duty
protected void SetCompleted(Task completedTask)
Parameters
completedTask
Task
SetFaulted(Task)
Set the agent faulted, making it dead.
protected void SetFaulted(Task task)
Parameters
task
Task
SetNotReady(Exception)
Puts the agent in a faulted state where it will never be ready
public virtual void SetNotReady(Exception exception)
Parameters
exception
Exception
SetReady()
Puts the agent in a ready state, explicitly
public virtual void SetReady()
SetReady(Task)
Set the agent ready for duty
protected void SetReady(Task readyTask)
Parameters
readyTask
Task
Stop(StopContext)
Stop the agent, and any supervised agents under it's control. Any faults related to stopping should be returned via this method, and not propagated to the Completed Task.
public Task Stop(StopContext context)
Parameters
context
StopContextThe stop context
Returns
StopAgent(StopContext)
Stops the agent
protected virtual Task StopAgent(StopContext context)
Parameters
context
StopContext