Interface IEventBus
Namespace: Volo.Abp.EventBus
Assembly: Volo.Abp.EventBus.dll
Syntax
public interface IEventBus
Methods
PublishAsync(Type, Object)
Triggers an event.
Declaration
Task PublishAsync(Type eventType, object eventData)
Parameters
Type | Name | Description |
---|---|---|
Type | eventType | Event type |
System.Object | eventData | Related data for the event |
Returns
Type | Description |
---|---|
Task | The task to handle async operation |
PublishAsync<TEvent>(TEvent)
Triggers an event.
Declaration
Task PublishAsync<TEvent>(TEvent eventData)
where TEvent : class
Parameters
Type | Name | Description |
---|---|---|
TEvent | eventData | Related data for the event |
Returns
Type | Description |
---|---|
Task | The task to handle async operation |
Type Parameters
Name | Description |
---|---|
TEvent | Event type |
Subscribe(Type, IEventHandler)
Registers to an event. Same (given) instance of the handler is used for all event occurrences.
Declaration
IDisposable Subscribe(Type eventType, IEventHandler handler)
Parameters
Type | Name | Description |
---|---|---|
Type | eventType | Event type |
IEventHandler | handler | Object to handle the event |
Returns
Type | Description |
---|---|
IDisposable |
Subscribe(Type, IEventHandlerFactory)
Registers to an event.
Declaration
IDisposable Subscribe(Type eventType, IEventHandlerFactory factory)
Parameters
Type | Name | Description |
---|---|---|
Type | eventType | Event type |
IEventHandlerFactory | factory | A factory to create/release handlers |
Returns
Type | Description |
---|---|
IDisposable |
Subscribe<TEvent>(Func<TEvent, Task>)
Registers to an event. Given action is called for all event occurrences.
Declaration
IDisposable Subscribe<TEvent>(Func<TEvent, Task> action)
where TEvent : class
Parameters
Type | Name | Description |
---|---|---|
Func<TEvent, Task> | action | Action to handle events |
Returns
Type | Description |
---|---|
IDisposable |
Type Parameters
Name | Description |
---|---|
TEvent | Event type |
Subscribe<TEvent>(IEventHandlerFactory)
Registers to an event. Given factory is used to create/release handlers
Declaration
IDisposable Subscribe<TEvent>(IEventHandlerFactory factory)
where TEvent : class
Parameters
Type | Name | Description |
---|---|---|
IEventHandlerFactory | factory | A factory to create/release handlers |
Returns
Type | Description |
---|---|
IDisposable |
Type Parameters
Name | Description |
---|---|
TEvent | Event type |
Subscribe<TEvent, THandler>()
Registers to an event.
A new instance of
Declaration
IDisposable Subscribe<TEvent, THandler>()
where TEvent : class where THandler : IEventHandler, new()
Returns
Type | Description |
---|---|
IDisposable |
Type Parameters
Name | Description |
---|---|
TEvent | Event type |
THandler | Type of the event handler |
Unsubscribe(Type, IEventHandler)
Unregisters from an event.
Declaration
void Unsubscribe(Type eventType, IEventHandler handler)
Parameters
Type | Name | Description |
---|---|---|
Type | eventType | Event type |
IEventHandler | handler | Handler object that is registered before |
Unsubscribe(Type, IEventHandlerFactory)
Unregisters from an event.
Declaration
void Unsubscribe(Type eventType, IEventHandlerFactory factory)
Parameters
Type | Name | Description |
---|---|---|
Type | eventType | Event type |
IEventHandlerFactory | factory | Factory object that is registered before |
Unsubscribe<TEvent>(Func<TEvent, Task>)
Unregisters from an event.
Declaration
void Unsubscribe<TEvent>(Func<TEvent, Task> action)
where TEvent : class
Parameters
Type | Name | Description |
---|---|---|
Func<TEvent, Task> | action |
Type Parameters
Name | Description |
---|---|
TEvent | Event type |
Unsubscribe<TEvent>(IEventHandlerFactory)
Unregisters from an event.
Declaration
void Unsubscribe<TEvent>(IEventHandlerFactory factory)
where TEvent : class
Parameters
Type | Name | Description |
---|---|---|
IEventHandlerFactory | factory | Factory object that is registered before |
Type Parameters
Name | Description |
---|---|
TEvent | Event type |
Unsubscribe<TEvent>(ILocalEventHandler<TEvent>)
Unregisters from an event.
Declaration
void Unsubscribe<TEvent>(ILocalEventHandler<TEvent> handler)
where TEvent : class
Parameters
Type | Name | Description |
---|---|---|
ILocalEventHandler<TEvent> | handler | Handler object that is registered before |
Type Parameters
Name | Description |
---|---|
TEvent | Event type |
UnsubscribeAll(Type)
Unregisters all event handlers of given event type.
Declaration
void UnsubscribeAll(Type eventType)
Parameters
Type | Name | Description |
---|---|---|
Type | eventType | Event type |
UnsubscribeAll<TEvent>()
Unregisters all event handlers of given event type.
Declaration
void UnsubscribeAll<TEvent>()
where TEvent : class
Type Parameters
Name | Description |
---|---|
TEvent | Event type |