Skip to content

Fast.EventBus public API

Targets: net8.0;net9.0;net10.0. This is a declaration and XML-comment reference. See the module guide for usage and constraints.

Source commit: 43554c07f6c216f80b509bd535c0a5b66ae7f2e8. Maintained through scripts/export-dotnet-api.ps1 -Language en; ordinary site builds consume this file directly.

Fast.EventBus.EventSubscribeAttribute

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public sealed class EventSubscribeAttribute : Attribute

Event handler attribute

Remarks: Applied to instance methods on IEventSubscriber implementations; multiple event IDs can invoke the same handler

Fast.EventBus.EventSubscribeAttribute.EventSubscribeAttribute

Source · Targets: net8.0, net9.0, net10.0

csharp
public EventSubscribeAttribute(object eventId)

Initializes a new instance of the class

Remarks: Only event and Enum types are supported

  • Parameter eventId: Logging event identifier

Fast.EventBus.EventSubscribeAttribute.EventId

Source · Targets: net8.0, net9.0, net10.0

csharp
public string EventId { get; set; }

Event ID

Fast.EventBus.EventSubscribeAttribute.GCCollect

Source · Targets: net8.0, net9.0, net10.0

csharp
public object GCCollect { get; set; } = false;

Whether to trigger garbage collection after execution

Remarks: Disabled by default; normally let the runtime decide when to collect garbage

Fast.EventBus.EventSubscribeAttribute.NumRetries

Source · Targets: net8.0, net9.0, net10.0

csharp
public int NumRetries { get; set; } = 0;

Retry count

Fast.EventBus.EventSubscribeAttribute.RetryTimeout

Source · Targets: net8.0, net9.0, net10.0

csharp
public int RetryTimeout { get; set; } = 1000;

Retry interval

Remarks: Defaults to 1000 milliseconds

Fast.EventBus.EventSubscribeAttribute.ExceptionTypes

Source · Targets: net8.0, net9.0, net10.0

csharp
public Type[] ExceptionTypes { get; set; }

Can restrict retries to specific exception types

Fast.EventBus.EventSubscribeAttribute.FallbackPolicy

Source · Targets: net8.0, net9.0, net10.0

csharp
public Type FallbackPolicy { get; set; }

Retry failure policy configuration

Fast.EventBus.EventSubscribeAttribute.Order

Source · Targets: net8.0, net9.0, net10.0

csharp
public int Order { get; set; } = 0;

Order

Remarks: Larger values execute first

Fast.EventBus.EventHandlerContext

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public abstract class EventHandlerContext

Event handler context

Fast.EventBus.EventHandlerContext.Source

Source · Targets: net8.0, net9.0, net10.0

csharp
public IEventSource Source { get; }

Event source carrying the event data

Fast.EventBus.EventHandlerContext.Properties

Source · Targets: net8.0, net9.0, net10.0

csharp
public IDictionary<object, object> Properties { get; set; }

Shared context data

Fast.EventBus.EventHandlerContext.HandlerMethod

Source · Targets: net8.0, net9.0, net10.0

csharp
public MethodInfo HandlerMethod { get; }

Invoked method

Remarks: May be null for dynamic subscriptions

Fast.EventBus.EventHandlerContext.Attribute

Source · Targets: net8.0, net9.0, net10.0

csharp
public EventSubscribeAttribute Attribute { get; }

Subscription attribute

Remarks: May be null for dynamic subscriptions

Fast.EventBus.EventHandlerExecutedContext

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public sealed class EventHandlerExecutedContext : EventHandlerContext

Post-execution event handler context

Fast.EventBus.EventHandlerExecutedContext.ExecutedTime

Source · Targets: net8.0, net9.0, net10.0

csharp
public DateTime ExecutedTime { get; internal set; }

Post-execution time

Fast.EventBus.EventHandlerExecutedContext.Exception

Source · Targets: net8.0, net9.0, net10.0

csharp
public InvalidOperationException Exception { get; internal set; }

Exception information

Fast.EventBus.EventHandlerExecutingContext

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public sealed class EventHandlerExecutingContext : EventHandlerContext

Pre-execution event handler context

Fast.EventBus.EventHandlerExecutingContext.ExecutingTime

Source · Targets: net8.0, net9.0, net10.0

csharp
public DateTime ExecutingTime { get; internal set; }

Pre-execution time

Fast.EventBus.EventBusExtension

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public static class EventBusExtension

Event bus extensions

Fast.EventBus.EventBusExtension.EventBusToString

Source · Targets: net8.0, net9.0, net10.0

csharp
public static string EventBusToString(this Enum em)

Converts an enum event ID to a string

  • Parameter em: Enum value to convert to an event identifier string
  • Returns: Converts an enum event ID to a string

Fast.EventBus.EventBusExtension.EventBusToEnum

Source · Targets: net8.0, net9.0, net10.0

csharp
public static Enum EventBusToEnum(this string str)

Converts an enum event string to an enum object

  • Parameter str: String to process
  • Returns: Converts an enum event string to an enum object

Fast.EventBus.IServiceCollectionExtension

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public static class IServiceCollectionExtension

Dynamic API extensions for IServiceCollection

Fast.EventBus.IServiceCollectionExtension.AddEventBus

Source · Targets: net8.0, net9.0, net10.0

csharp
public static IServiceCollection AddEventBus(this IServiceCollection services)

Adds event bus services

  • Parameter services: The service collection to add services to
  • Returns: Returns services for chaining

Fast.EventBus.IEventBusFactory

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public interface IEventBusFactory

Event bus factory

Fast.EventBus.IEventBusFactory.Subscribe

Source · Targets: net8.0, net9.0, net10.0

csharp
Task Subscribe(string eventId, Func<EventHandlerExecutingContext, Task> handler, EventSubscribeAttribute attribute = null,
        MethodInfo handlerMethod = null, CancellationToken cancellationToken = default);

Adds an event subscriber

  • Parameter eventId: Logging event identifier
  • Parameter handler: Delegate handling the current event or request
  • Parameter attribute: EventSubscribeAttribute instance
  • Parameter handlerMethod: Event handler method
  • Parameter cancellationToken: Token used to cancel the asynchronous operation
  • Returns: A task representing asynchronous event subscriber registration

Fast.EventBus.IEventBusFactory.Unsubscribe

Source · Targets: net8.0, net9.0, net10.0

csharp
Task Unsubscribe(string eventId, CancellationToken cancellationToken = default);

Removes an event subscriber

  • Parameter eventId: Logging event identifier
  • Parameter cancellationToken: Token used to cancel the asynchronous operation
  • Returns: A task representing asynchronous event subscriber removal

Fast.EventBus.IEventSubscriber

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public interface IEventSubscriber

Event subscriber dependency interface

Remarks: Custom event handlers must match Func{EventSubscribeExecutingContext, Task}. Usually used for dependency discovery rather than service invocation.

Fast.EventBus.IEventHandlerMonitor

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public interface IEventHandlerMonitor

Event handler monitor

Fast.EventBus.IEventHandlerMonitor.OnExecutingAsync

Source · Targets: net8.0, net9.0, net10.0

csharp
Task OnExecutingAsync(EventHandlerExecutingContext context);

Before event handler execution

  • Parameter context: Current event handling context
  • Returns: A task representing the pre-execution event handler operation

Fast.EventBus.IEventHandlerMonitor.OnExecutedAsync

Source · Targets: net8.0, net9.0, net10.0

csharp
Task OnExecutedAsync(EventHandlerExecutedContext context);

After event handler execution

  • Parameter context: Current event handling context
  • Returns: A task representing the post-execution event handler operation

Fast.EventBus.IEventFallbackPolicy

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public interface IEventFallbackPolicy

Event retry failure callback service

Fast.EventBus.IEventFallbackPolicy.CallbackAsync

Source · Targets: net8.0, net9.0, net10.0

csharp
Task CallbackAsync(EventHandlerExecutingContext context, Exception ex);

Callback after retry failure

  • Parameter context: Current event handling context
  • Parameter ex: Exception that triggered the current handling flow
  • Returns: A task representing the retry failure callback

Fast.EventBus.IEventPublisher

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public interface IEventPublisher

Event publisher dependency interface

Fast.EventBus.IEventPublisher.PublishAsync

Source · Targets: net8.0, net9.0, net10.0

csharp
Task PublishAsync(IEventSource eventSource);

Publishes a message

  • Parameter eventSource: Event message to publish
  • Returns: A task representing message publication

Fast.EventBus.IEventPublisher.PublishDelayAsync

Source · Targets: net8.0, net9.0, net10.0

csharp
Task PublishDelayAsync(IEventSource eventSource, long delay);

Publishes a message after a delay

  • Parameter eventSource: Event message to publish
  • Parameter delay: Delay duration
  • Returns: A task representing delayed message publication

Fast.EventBus.IEventPublisher.PublishAsync

Source · Targets: net8.0, net9.0, net10.0

csharp
Task PublishAsync(string eventId, object payload = null, CancellationToken cancellationToken = default);

Publishes a message

  • Parameter eventId: Logging event identifier
  • Parameter payload: Payload to write into the token
  • Parameter cancellationToken: Token used to cancel the asynchronous operation
  • Returns: A task representing message publication

Fast.EventBus.IEventPublisher.PublishAsync

Source · Targets: net8.0, net9.0, net10.0

csharp
Task PublishAsync(Enum eventId, object payload = null, CancellationToken cancellationToken = default);

Publishes a message

  • Parameter eventId: Logging event identifier
  • Parameter payload: Payload to write into the token
  • Parameter cancellationToken: Token used to cancel the asynchronous operation
  • Returns: A task representing message publication

Fast.EventBus.IEventPublisher.PublishDelayAsync

Source · Targets: net8.0, net9.0, net10.0

csharp
Task PublishDelayAsync(string eventId, long delay, object payload = null, CancellationToken cancellationToken = default);

Publishes a message after a delay

  • Parameter eventId: Logging event identifier
  • Parameter delay: Delay duration
  • Parameter payload: Payload to write into the token
  • Parameter cancellationToken: Token used to cancel the asynchronous operation
  • Returns: A task representing delayed message publication

Fast.EventBus.IEventPublisher.PublishDelayAsync

Source · Targets: net8.0, net9.0, net10.0

csharp
Task PublishDelayAsync(Enum eventId, long delay, object payload = null, CancellationToken cancellationToken = default);

Publishes a message after a delay

  • Parameter eventId: Logging event identifier
  • Parameter delay: Delay duration
  • Parameter payload: Payload to write into the token
  • Parameter cancellationToken: Token used to cancel the asynchronous operation
  • Returns: A task representing delayed message publication

Fast.EventBus.ChannelEventSource

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public sealed class ChannelEventSource : IEventSource

In-memory channel event source carrying event data

Fast.EventBus.ChannelEventSource.ChannelEventSource

Source · Targets: net8.0, net9.0, net10.0

csharp
public ChannelEventSource()

Initializes a new instance of the class

Fast.EventBus.ChannelEventSource.ChannelEventSource

Source · Targets: net8.0, net9.0, net10.0

csharp
public ChannelEventSource(string eventId)

Initializes a new instance of the class

  • Parameter eventId: Logging event identifier

Fast.EventBus.ChannelEventSource.ChannelEventSource

Source · Targets: net8.0, net9.0, net10.0

csharp
public ChannelEventSource(string eventId, object payload) : this(eventId)

Initializes a new instance of the class

  • Parameter eventId: Logging event identifier
  • Parameter payload: Payload to write into the token

Fast.EventBus.ChannelEventSource.ChannelEventSource

Source · Targets: net8.0, net9.0, net10.0

csharp
public ChannelEventSource(string eventId, object payload, CancellationToken cancellationToken) : this(eventId, payload)

Initializes a new instance of the class

  • Parameter eventId: Logging event identifier
  • Parameter payload: Payload to write into the token
  • Parameter cancellationToken: Token used to cancel the asynchronous operation

Fast.EventBus.ChannelEventSource.ChannelEventSource

Source · Targets: net8.0, net9.0, net10.0

csharp
public ChannelEventSource(Enum eventId) : this(eventId.EventBusToString())

Initializes a new instance of the class

  • Parameter eventId: Logging event identifier

Fast.EventBus.ChannelEventSource.ChannelEventSource

Source · Targets: net8.0, net9.0, net10.0

csharp
public ChannelEventSource(Enum eventId, object payload) : this(eventId.EventBusToString(), payload)

Initializes a new instance of the class

  • Parameter eventId: Logging event identifier
  • Parameter payload: Payload to write into the token

Fast.EventBus.ChannelEventSource.ChannelEventSource

Source · Targets: net8.0, net9.0, net10.0

csharp
public ChannelEventSource(Enum eventId, object payload, CancellationToken cancellationToken) : this(
        eventId.EventBusToString(), payload, cancellationToken)

Initializes a new instance of the class

  • Parameter eventId: Logging event identifier
  • Parameter payload: Payload to write into the token
  • Parameter cancellationToken: Token used to cancel the asynchronous operation

Fast.EventBus.ChannelEventSource.EventId

Source · Targets: net8.0, net9.0, net10.0

csharp
public string EventId { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.EventBus.ChannelEventSource.Payload

Source · Targets: net8.0, net9.0, net10.0

csharp
public object Payload { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.EventBus.ChannelEventSource.CreatedTime

Source · Targets: net8.0, net9.0, net10.0

csharp
public DateTime CreatedTime { get; set; } = DateTime.UtcNow;

Documentation is inherited from an interface or base class; consult that declaration.

Fast.EventBus.ChannelEventSource.CancellationToken

Source · Targets: net8.0, net9.0, net10.0

csharp
[JsonIgnore]
    public CancellationToken CancellationToken { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.EventBus.IEventSource

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public interface IEventSource

Event source dependency interface

Fast.EventBus.IEventSource.EventId

Source · Targets: net8.0, net9.0, net10.0

csharp
string EventId { get; }

Event ID

Fast.EventBus.IEventSource.Payload

Source · Targets: net8.0, net9.0, net10.0

csharp
object Payload { get; }

Event payload data

Fast.EventBus.IEventSource.CreatedTime

Source · Targets: net8.0, net9.0, net10.0

csharp
DateTime CreatedTime { get; }

Event creation time

Fast.EventBus.IEventSource.CancellationToken

Source · Targets: net8.0, net9.0, net10.0

csharp
CancellationToken CancellationToken { get; }

Task cancellation token

Remarks: Used to cancel handling of this message