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 |
---|---|---|
System.IServiceProvider | serviceProvider | The System.IServiceProvider to be used to resolve the required services. |
Methods
| Improve this doc View sourceDispose(Boolean)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | A value indicating whether the method has been called by the |
Overrides
GetProducer(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
GetProducer(String)
Returns an IProducer to be used to produce to the specified endpoint.
Declaration
public override IProducer GetProducer(string endpointName)
Parameters
Type | Name | Description |
---|---|---|
System.String | endpointName | The target endpoint name (or friendly name). |
Returns
Type | Description |
---|---|
IProducer | The IProducer for the specified endpoint. |
Overrides
GetTransactionalProducer(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 |
---|---|---|
System.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 | |
IBrokerBehaviorsProvider<IConsumerBehavior> | behaviorsProvider | |
System.IServiceProvider | serviceProvider | The System.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
InstantiateProducer(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 | |
IBrokerBehaviorsProvider<IProducerBehavior> | behaviorsProvider | |
System.IServiceProvider | serviceProvider | The System.IServiceProvider instance to be used to resolve the needed types or to be forwarded to the consumer. |
Returns
Type | Description |
---|---|
IProducer | The instantiated IProducer. |