Skip to main content

Definition

Assembly: CloudNimble.SimpleMessageBus.Dispatch.dll Namespace: CloudNimble.SimpleMessageBus.Dispatch Inheritance: System.Object

Syntax

CloudNimble.SimpleMessageBus.Dispatch.ParallelMessageDispatcher

Summary

An IMessageDispatcher implementation that processes the messages in parallel, regardless of the order the IMessageHandlerIMessageHandlers</see> were registered with the Dependency Injection container.

Remarks

This dispatcher invokes all matching message handlers concurrently using parallel execution. This provides better performance when handlers are independent and don’t rely on execution order. However, it should be used carefully when handlers have side effects or shared dependencies that aren’t thread-safe.

Constructors

.ctor

Initializes a new instance of the ParallelMessageDispatcher class.

Syntax

public ParallelMessageDispatcher(System.Collections.Generic.IEnumerable<CloudNimble.SimpleMessageBus.Core.IMessageHandler> messageHandlers)

Parameters

NameTypeDescription
messageHandlersSystem.Collections.Generic.IEnumerable<CloudNimble.SimpleMessageBus.Core.IMessageHandler>The collection of message handlers to dispatch to.

.ctor Inherited

Inherited from object

Syntax

public Object()

Methods

Dispatch

Sends the MessageEnvelope to the IMessageHandlerMessageHandlers</see> registered to that type, for processing.

Syntax

public System.Threading.Tasks.Task Dispatch(CloudNimble.SimpleMessageBus.Core.MessageEnvelope messageEnvelope)

Parameters

NameTypeDescription
messageEnvelopeCloudNimble.SimpleMessageBus.Core.MessageEnvelopeThe MessageEnvelope instance to be processed.

Returns

Type: System.Threading.Tasks.Task

Remarks

Handlers are invoked concurrently using parallel execution. The method returns when all handlers have completed. If any handler throws an exception, other handlers will continue executing.

Equals Inherited Virtual

Inherited from object

Syntax

public virtual bool Equals(object obj)

Parameters

NameTypeDescription
objobject?-

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

public static bool Equals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

public System.Type GetType()

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

protected internal object MemberwiseClone()

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

public static bool ReferenceEquals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?
  • CloudNimble.SimpleMessageBus.Dispatch.IMessageDispatcher