Class BrokerCollection
Holds a reference to all the registered IBroker implementations and is able to resolve the right instance according to the IEndpoint type.
Implements
Inherited Members
Namespace: Silverback.Messaging.Broker
Assembly: Silverback.Integration.dll
Syntax
public class BrokerCollection : IBrokerCollection, IReadOnlyList<IBroker>, IReadOnlyCollection<IBroker>, IEnumerable<IBroker>, IEnumerable
Constructors
| Improve this doc View sourceBrokerCollection(IEnumerable<IBroker>)
Initializes a new instance of the BrokerCollection class.
Declaration
public BrokerCollection(IEnumerable<IBroker> brokers)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IBroker> | brokers | The brokers to be added to the collection. |
Properties
| Improve this doc View sourceCount
Gets the number of elements in the collection.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int | The number of elements in the collection. |
this[int]
Gets the element at the specified index in the read-only list.
Declaration
public IBroker this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The zero-based index of the element to get. |
Property Value
| Type | Description |
|---|---|
| IBroker | The element at the specified index in the read-only list. |
Methods
| Improve this doc View sourceAddConsumer(IConsumerEndpoint)
Adds an IConsumer that will consume from the specified endpoint as soon as the broker is connected. The received messages will be forwarded to the specified callback delegate.
Declaration
public IConsumer AddConsumer(IConsumerEndpoint endpoint)
Parameters
| Type | Name | Description |
|---|---|---|
| IConsumerEndpoint | endpoint | The source endpoint. |
Returns
| Type | Description |
|---|---|
| IConsumer | The IConsumer for the specified endpoint. |
ConnectAsync()
Connect to all message brokers to start consuming.
Declaration
public Task ConnectAsync()
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. |
DisconnectAsync()
Disconnect from all message brokers to stop consuming.
Declaration
public Task DisconnectAsync()
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. |
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<IBroker> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<IBroker> | An enumerator that can be used to iterate through the collection. |
GetProducer(IProducerEndpoint)
Returns an IProducer to be used to produce to the specified endpoint.
Declaration
public IProducer GetProducer(IProducerEndpoint endpoint)
Parameters
| Type | Name | Description |
|---|---|---|
| IProducerEndpoint | endpoint | The target endpoint. |
Returns
| Type | Description |
|---|---|
| IProducer | The IProducer for the specified endpoint. |