Class MessageBrokerExtensions
Extension methods for IMessageBroker.
Inheritance
Inherited Members
Namespace: Kephas.Messaging.Distributed
Assembly: Kephas.Messaging.dll
Syntax
public static class MessageBrokerExtensions
Methods
| Improve this Doc View SourceCreateBrokeredMessageBuilder(IContext)
Creates an initialized brokered message builder.
Declaration
public static IBrokeredMessageBuilder CreateBrokeredMessageBuilder(this IContext context)
Parameters
Type | Name | Description |
---|---|---|
IContext | context | The publishing context. |
Returns
Type | Description |
---|---|
IBrokeredMessageBuilder | The new brokered message builder. |
ProcessAsync(IMessageBroker, Object, IEndpoint, IContext, CancellationToken)
Processes a message asynchronously, waiting for a response from the handler.
Declaration
public static Task<IMessage> ProcessAsync(this IMessageBroker messageBroker, object message, IEndpoint recipient, IContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IMessageBroker | messageBroker | The message broker to act on. |
System.Object | message | The message to be processed. |
IEndpoint | recipient | The recipient. |
IContext | context | The processing context. |
System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IMessage> | The asynchronous result yielding the response message. |
ProcessAsync(IMessageBroker, Object, IContext, CancellationToken)
Processes a message asynchronously, waiting for a response from the handler.
Declaration
public static Task<IMessage> ProcessAsync(this IMessageBroker messageBroker, object message, IContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IMessageBroker | messageBroker | The message broker to act on. |
System.Object | message | The message to be processed. |
IContext | context | The processing context. |
System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IMessage> | The asynchronous result yielding the response message. |
ProcessAsync(IMessageBroker, Object, IEnumerable<IEndpoint>, IContext, CancellationToken)
Processes a message asynchronously, waiting for a response from the handler.
Declaration
public static Task<IMessage> ProcessAsync(this IMessageBroker messageBroker, object message, IEnumerable<IEndpoint> recipients, IContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IMessageBroker | messageBroker | The message broker to act on. |
System.Object | message | The message to be processed. |
System.Collections.Generic.IEnumerable<IEndpoint> | recipients | The recipients. |
IContext | context | The processing context. |
System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IMessage> | The asynchronous result yielding the response message. |
ProcessOneWayAsync(IMessageBroker, Object, IEndpoint, IContext, CancellationToken)
Processes a message asynchronously without waiting for a response from the handler.
Declaration
public static Task<IMessage> ProcessOneWayAsync(this IMessageBroker messageBroker, object message, IEndpoint recipient, IContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IMessageBroker | messageBroker | The message broker to act on. |
System.Object | message | The message to be processed. |
IEndpoint | recipient | The recipient. |
IContext | context | The processing context. |
System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IMessage> | The asynchronous result. |
ProcessOneWayAsync(IMessageBroker, Object, IContext, CancellationToken)
Processes a message asynchronously without waiting for a response from the handler.
Declaration
public static Task<IMessage> ProcessOneWayAsync(this IMessageBroker messageBroker, object message, IContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IMessageBroker | messageBroker | The message broker to act on. |
System.Object | message | The message to be processed. |
IContext | context | The processing context. |
System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IMessage> | The asynchronous result. |
ProcessOneWayAsync(IMessageBroker, Object, IEnumerable<IEndpoint>, IContext, CancellationToken)
Processes a message asynchronously without waiting for a response from the handler.
Declaration
public static Task<IMessage> ProcessOneWayAsync(this IMessageBroker messageBroker, object message, IEnumerable<IEndpoint> recipients, IContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IMessageBroker | messageBroker | The message broker to act on. |
System.Object | message | The message to be processed. |
System.Collections.Generic.IEnumerable<IEndpoint> | recipients | The recipients. |
IContext | context | The processing context. |
System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IMessage> | The asynchronous result. |
Publish(IMessageBroker, Object, IExpando, IContext)
Publishes the event with the provided ID and arguments.
Declaration
public static void Publish(this IMessageBroker messageBroker, object eventId, IExpando eventArgs, IContext context)
Parameters
Type | Name | Description |
---|---|---|
IMessageBroker | messageBroker | The message broker. |
System.Object | eventId | Identifier for the application event. |
IExpando | eventArgs | The application event arguments. |
IContext | context | Optional. the context. |
Publish(IMessageBroker, Object, IContext)
Publishes the provided event.
Declaration
public static void Publish(this IMessageBroker messageBroker, object event, IContext context)
Parameters
Type | Name | Description |
---|---|---|
IMessageBroker | messageBroker | The message broker. |
System.Object | event | The event. |
IContext | context | The context. |
Publish<TEvent>(IMessageBroker, IContext)
Publishes the provided event.
Declaration
public static void Publish<TEvent>(this IMessageBroker messageBroker, IContext context)
where TEvent : class, new()
Parameters
Type | Name | Description |
---|---|---|
IMessageBroker | messageBroker | The message broker. |
IContext | context | The context. |
Type Parameters
Name | Description |
---|---|
TEvent | Type of the event. |
PublishAsync(IMessageBroker, Object, IExpando, IContext, CancellationToken)
Asynchronously publishes the event with the provided ID and arguments.
Declaration
public static Task PublishAsync(this IMessageBroker messageBroker, object eventId, IExpando eventArgs, IContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IMessageBroker | messageBroker | The message broker. |
System.Object | eventId | Identifier for the event. |
IExpando | eventArgs | The application event arguments. |
IContext | context | The context. |
System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | An asynchronous result. |
PublishAsync(IMessageBroker, Object, IEndpoint, IContext, CancellationToken)
Publishes an event asynchronously.
Declaration
public static Task PublishAsync(this IMessageBroker messageBroker, object event, IEndpoint recipient, IContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IMessageBroker | messageBroker | The message broker to act on. |
System.Object | event | The event message. |
IEndpoint | recipient | The recipient. |
IContext | context | The publishing context. |
System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | The asynchronous result. |
Remarks
It does not wait for an answer from the subscribers, just for the acknowledgement of the message being sent.
PublishAsync(IMessageBroker, Object, IContext, CancellationToken)
Publishes an event asynchronously.
Declaration
public static Task PublishAsync(this IMessageBroker messageBroker, object event, IContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IMessageBroker | messageBroker | The message broker to act on. |
System.Object | event | The event message. |
IContext | context | The publishing context. |
System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | The asynchronous result. |
Remarks
It does not wait for an answer from the subscribers, just for the acknowledgement of the message being sent.
PublishAsync(IMessageBroker, Object, IEnumerable<IEndpoint>, IContext, CancellationToken)
Publishes an event asynchronously.
Declaration
public static Task PublishAsync(this IMessageBroker messageBroker, object event, IEnumerable<IEndpoint> recipients, IContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IMessageBroker | messageBroker | The message broker to act on. |
System.Object | event | The event message. |
System.Collections.Generic.IEnumerable<IEndpoint> | recipients | The recipients. |
IContext | context | The publishing context. |
System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | The asynchronous result. |
Remarks
It does not wait for an answer from the subscribers, just for the acknowledgement of the message being sent.
PublishAsync<TEvent>(IMessageBroker, IContext, CancellationToken)
Publishes the provided event.
Declaration
public static Task PublishAsync<TEvent>(this IMessageBroker messageBroker, IContext context, CancellationToken cancellationToken = default(CancellationToken))
where TEvent : class, new()
Parameters
Type | Name | Description |
---|---|---|
IMessageBroker | messageBroker | The message broker. |
IContext | context | The context. |
System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | An asynchronous result. |
Type Parameters
Name | Description |
---|---|
TEvent | Type of the event. |