Interface IEventHub
Contract for the singleton application service handling in-process event publishing/subscribing.
Namespace: Kephas.Interaction
Assembly: Kephas.Core.dll
Syntax
[SingletonAppServiceContract]
public interface IEventHub
Methods
| Improve this Doc View SourcePublishAsync(Object, IContext, CancellationToken)
Publishes the event asynchronously to its subscribers.
Declaration
Task PublishAsync(object event, IContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Object | event | The event. |
IContext | context | The context. |
System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | An asynchronous result. |
Subscribe(ITypeInfo, Func<Object, IContext, CancellationToken, Task>)
Subscribes to the event(s) matching the provided type.
Declaration
IEventSubscription Subscribe(ITypeInfo typeMatch, Func<object, IContext, CancellationToken, Task> callback)
Parameters
Type | Name | Description |
---|---|---|
ITypeInfo | typeMatch | Specifies the type match criteria. |
System.Func<System.Object, IContext, System.Threading.CancellationToken, System.Threading.Tasks.Task> | callback | The callback. |
Returns
Type | Description |
---|---|
IEventSubscription | An IEventSubscription. |
Subscribe(Func<Object, Boolean>, Func<Object, IContext, CancellationToken, Task>)
Subscribes to the event(s) matching the criteria.
Declaration
IEventSubscription Subscribe(Func<object, bool> match, Func<object, IContext, CancellationToken, Task> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Func<System.Object, System.Boolean> | match | Specifies the match criteria. |
System.Func<System.Object, IContext, System.Threading.CancellationToken, System.Threading.Tasks.Task> | callback | The callback. |
Returns
Type | Description |
---|---|
IEventSubscription | An IEventSubscription. |