Class KafkaBroker
An IBroker implementation for Apache Kafka.
Inherited Members
Namespace: Silverback.Messaging.Broker
Assembly: Silverback.Integration.Kafka.dll
Syntax
public class KafkaBroker : Broker<KafkaProducerEndpoint, KafkaConsumerEndpoint>, IBroker, IDisposable
Constructors
| Improve this doc View sourceKafkaBroker(IServiceProvider)
Initializes a new instance of the KafkaBroker class.
Declaration
public KafkaBroker(IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | serviceProvider | The IServiceProvider to be used to resolve the required services. |
Methods
| Improve this doc View sourceDispose(bool)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | A value indicating whether the method has been called by the |
Overrides
| Improve this doc View sourceGetProducer(IProducerEndpoint)
Returns an IProducer to be used to produce to the specified endpoint.
Declaration
public override IProducer GetProducer(IProducerEndpoint endpoint)
Parameters
Type | Name | Description |
---|---|---|
IProducerEndpoint | endpoint | The target endpoint. |
Returns
Type | Description |
---|---|
IProducer | The IProducer for the specified endpoint. |
Overrides
| Improve this doc View sourceGetProducer(string)
Returns an IProducer to be used to produce to the specified endpoint.
Declaration
public override IProducer GetProducer(string endpointName)
Parameters
Type | Name | Description |
---|---|---|
string | endpointName | The target endpoint name (or friendly name). |
Returns
Type | Description |
---|---|
IProducer | The IProducer for the specified endpoint. |
Overrides
| Improve this doc View sourceGetTransactionalProducer(IProducerEndpoint)
Returns a KafkaTransactionalProducer to be used to produce to the specified endpoint using a transaction.
Declaration
public KafkaTransactionalProducer GetTransactionalProducer(IProducerEndpoint endpoint)
Parameters
Type | Name | Description |
---|---|---|
IProducerEndpoint | endpoint | The target endpoint. |
Returns
Type | Description |
---|---|
KafkaTransactionalProducer | The IProducer for the specified endpoint. |
GetTransactionalProducer(string)
Returns an existing IProducer to be used to produce to the specified endpoint.
Declaration
public KafkaTransactionalProducer GetTransactionalProducer(string endpointName)
Parameters
Type | Name | Description |
---|---|---|
string | endpointName | The target endpoint name (or friendly name). |
Returns
Type | Description |
---|---|
KafkaTransactionalProducer | The IProducer for the specified endpoint. |
InstantiateConsumer(KafkaConsumerEndpoint, IBrokerBehaviorsProvider<IConsumerBehavior>, IServiceProvider)
Returns a new instance of IConsumer to subscribe to the specified endpoint.
Declaration
protected override IConsumer InstantiateConsumer(KafkaConsumerEndpoint endpoint, IBrokerBehaviorsProvider<IConsumerBehavior> behaviorsProvider, IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
KafkaConsumerEndpoint | endpoint | The endpoint. |
IBrokerBehaviorsProvider<IConsumerBehavior> | behaviorsProvider | |
IServiceProvider | serviceProvider | The IServiceProvider instance to be used to resolve the needed types or to be forwarded to the consumer. |
Returns
Type | Description |
---|---|
IConsumer | The instantiated IConsumer. |
Overrides
| Improve this doc View sourceInstantiateProducer(KafkaProducerEndpoint, IBrokerBehaviorsProvider<IProducerBehavior>, IServiceProvider)
Returns a new instance of IProducer to publish to the specified endpoint. The returned instance will be cached and reused for the same endpoint.
Declaration
protected override IProducer InstantiateProducer(KafkaProducerEndpoint endpoint, IBrokerBehaviorsProvider<IProducerBehavior> behaviorsProvider, IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
KafkaProducerEndpoint | endpoint | The endpoint. |
IBrokerBehaviorsProvider<IProducerBehavior> | behaviorsProvider | |
IServiceProvider | serviceProvider | The IServiceProvider instance to be used to resolve the needed types or to be forwarded to the consumer. |
Returns
Type | Description |
---|---|
IProducer | The instantiated IProducer. |