Class KafkaProducerEndpoint
Represents a topic to produce to.
Inherited Members
Namespace: Silverback.Messaging
Assembly: Silverback.Integration.Kafka.dll
Syntax
public sealed class KafkaProducerEndpoint : ProducerEndpoint, IProducerEndpoint, IEndpoint, IEquatable<KafkaProducerEndpoint>
Constructors
| Improve this doc View sourceKafkaProducerEndpoint(Func<IOutboundEnvelope, IServiceProvider, String>, KafkaClientConfig)
Initializes a new instance of the KafkaProducerEndpoint class.
Declaration
public KafkaProducerEndpoint(Func<IOutboundEnvelope, IServiceProvider, string> topicNameFunction, KafkaClientConfig clientConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IOutboundEnvelope, System.IServiceProvider, System.String> | topicNameFunction | The function returning the topic name for the message being produced. If the function returns
|
KafkaClientConfig | clientConfig | The KafkaClientConfig to be used to initialize the KafkaProducerConfig. |
KafkaProducerEndpoint(Func<IOutboundEnvelope, IServiceProvider, String>, Func<IOutboundEnvelope, IServiceProvider, Int32>, KafkaClientConfig)
Initializes a new instance of the KafkaProducerEndpoint class.
Declaration
public KafkaProducerEndpoint(Func<IOutboundEnvelope, IServiceProvider, string> topicNameFunction, Func<IOutboundEnvelope, IServiceProvider, int> partitionFunction, KafkaClientConfig clientConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IOutboundEnvelope, System.IServiceProvider, System.String> | topicNameFunction | The function returning the topic name for the message being produced. If the function returns
|
System.Func<IOutboundEnvelope, System.IServiceProvider, System.Int32> | partitionFunction | The optional function returning the target partition index for the message being produced. If |
KafkaClientConfig | clientConfig | The KafkaClientConfig to be used to initialize the KafkaProducerConfig. |
KafkaProducerEndpoint(Func<IOutboundEnvelope, String>, KafkaClientConfig)
Initializes a new instance of the KafkaProducerEndpoint class.
Declaration
public KafkaProducerEndpoint(Func<IOutboundEnvelope, string> topicNameFunction, KafkaClientConfig clientConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IOutboundEnvelope, System.String> | topicNameFunction | The function returning the topic name for the message being produced. If the function returns
|
KafkaClientConfig | clientConfig | The KafkaClientConfig to be used to initialize the KafkaProducerConfig. |
KafkaProducerEndpoint(Func<IOutboundEnvelope, String>, Func<IOutboundEnvelope, Int32>, KafkaClientConfig)
Initializes a new instance of the KafkaProducerEndpoint class.
Declaration
public KafkaProducerEndpoint(Func<IOutboundEnvelope, string> topicNameFunction, Func<IOutboundEnvelope, int> partitionFunction, KafkaClientConfig clientConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IOutboundEnvelope, System.String> | topicNameFunction | The function returning the topic name for the message being produced. If the function returns
|
System.Func<IOutboundEnvelope, System.Int32> | partitionFunction | The optional function returning the target partition index for the message being produced. If |
KafkaClientConfig | clientConfig | The KafkaClientConfig to be used to initialize the KafkaProducerConfig. |
KafkaProducerEndpoint(String, KafkaClientConfig)
Initializes a new instance of the KafkaProducerEndpoint class.
Declaration
public KafkaProducerEndpoint(string topicName, KafkaClientConfig clientConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | topicName | The name of the topic. |
KafkaClientConfig | clientConfig | The KafkaClientConfig to be used to initialize the KafkaProducerConfig. |
KafkaProducerEndpoint(String, Func<IOutboundEnvelope, String[]>, KafkaClientConfig)
Initializes a new instance of the KafkaProducerEndpoint class.
Declaration
public KafkaProducerEndpoint(string topicNameFormatString, Func<IOutboundEnvelope, string[]> topicNameArgumentsFunction, KafkaClientConfig clientConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | topicNameFormatString | The endpoint name format string that will be combined with the arguments returned by the
|
System.Func<IOutboundEnvelope, System.String[]> | topicNameArgumentsFunction | The function returning the arguments to be used to format the string. |
KafkaClientConfig | clientConfig | The KafkaClientConfig to be used to initialize the KafkaProducerConfig. |
KafkaProducerEndpoint(String, Func<IOutboundEnvelope, String[]>, Func<IOutboundEnvelope, Int32>, KafkaClientConfig)
Initializes a new instance of the KafkaProducerEndpoint class.
Declaration
public KafkaProducerEndpoint(string topicNameFormatString, Func<IOutboundEnvelope, string[]> topicNameArgumentsFunction, Func<IOutboundEnvelope, int> partitionFunction, KafkaClientConfig clientConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | topicNameFormatString | The endpoint name format string that will be combined with the arguments returned by the
|
System.Func<IOutboundEnvelope, System.String[]> | topicNameArgumentsFunction | The function returning the arguments to be used to format the string. |
System.Func<IOutboundEnvelope, System.Int32> | partitionFunction | The optional function returning the target partition index for the message being produced. If |
KafkaClientConfig | clientConfig | The KafkaClientConfig to be used to initialize the KafkaProducerConfig. |
KafkaProducerEndpoint(String, Nullable<Int32>, KafkaClientConfig)
Initializes a new instance of the KafkaProducerEndpoint class.
Declaration
public KafkaProducerEndpoint(string topicName, int? partition, KafkaClientConfig clientConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | topicName | The name of the topic. |
System.Nullable<System.Int32> | partition | The optional partition index. If |
KafkaClientConfig | clientConfig | The KafkaClientConfig to be used to initialize the KafkaProducerConfig. |
KafkaProducerEndpoint(Type, KafkaClientConfig)
Initializes a new instance of the KafkaProducerEndpoint class.
Declaration
public KafkaProducerEndpoint(Type resolverType, KafkaClientConfig clientConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.Type | resolverType | The type of the IKafkaProducerEndpointNameResolver to be used to resolve the actual endpoint name. |
KafkaClientConfig | clientConfig | The KafkaClientConfig to be used to initialize the KafkaProducerConfig. |
Properties
| Improve this doc View sourceConfiguration
Gets or sets the Kafka client configuration. This is actually an extension of the configuration dictionary provided by the Confluent.Kafka library.
Declaration
public KafkaProducerConfig Configuration { get; set; }
Property Value
Type | Description |
---|---|
KafkaProducerConfig |
Methods
| Improve this doc View sourceEquals(KafkaProducerEndpoint)
Declaration
public bool Equals(KafkaProducerEndpoint other)
Parameters
Type | Name | Description |
---|---|---|
KafkaProducerEndpoint | other |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
GetPartition(IOutboundEnvelope, IServiceProvider)
Gets the target partition. When set to Partition.Any
(-1) the partition is automatically
derived from the message key (use KafkaKeyMemberAttribute to specify a message key,
otherwise a random one will be generated).
The default is Partition.Any
(-1).
Declaration
public Partition GetPartition(IOutboundEnvelope envelope, IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
IOutboundEnvelope | envelope | The envelope containing the message being produced. |
System.IServiceProvider | serviceProvider | The System.IServiceProvider in the current scope. |
Returns
Type | Description |
---|---|
Confluent.Kafka.Partition | The partition to be produced to. |
Validate()
Declaration
public override void Validate()