Class DefaultEventHub
The default implementation of the IEventHub service.
Inherited Members
Namespace: Kephas.Interaction
Assembly: Kephas.Core.dll
Syntax
[OverridePriority(Priority.Low)]
public class DefaultEventHub : Loggable, ILoggable, IEventHub, IDisposable
Methods
| Improve this Doc View SourceDispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(Boolean)
Releases the unmanaged resources used by the Kephas.Interaction.DefaultEventHub and optionally releases the managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | True to release both managed and unmanaged resources; false to release only unmanaged resources. |
GetEventContent(Object)
Gets the event content.
Declaration
protected virtual object GetEventContent(object event)
Parameters
Type | Name | Description |
---|---|---|
System.Object | event | The event. |
Returns
Type | Description |
---|---|
System.Object | The event content. |
GetTypeMatch(ITypeInfo)
Gets the match for the provided event type.
Declaration
protected virtual Func<object, bool> GetTypeMatch(ITypeInfo typeMatch)
Parameters
Type | Name | Description |
---|---|---|
ITypeInfo | typeMatch | Specifies the type match criteria. |
Returns
Type | Description |
---|---|
System.Func<System.Object, System.Boolean> | A function delegate that yields a bool. |
PublishAsync(Object, IContext, CancellationToken)
Publishes the event asynchronously to its subscribers.
Declaration
public virtual 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
public virtual 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
public virtual 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 event match criteria. |
System.Func<System.Object, IContext, System.Threading.CancellationToken, System.Threading.Tasks.Task> | callback | The callback. |
Returns
Type | Description |
---|---|
IEventSubscription | An IEventSubscription. |