Class KafkaDynamicProducerEndpointResolver<TMessage>
Dynamically resolves the target topic and partition for each message being produced.
Inheritance
Implements
Inherited Members
Namespace: Silverback.Messaging.Producing.EndpointResolvers
Assembly: Silverback.Integration.Kafka.dll
Syntax
public sealed record KafkaDynamicProducerEndpointResolver<TMessage> : DynamicProducerEndpointResolver<TMessage, KafkaProducerEndpoint, KafkaProducerEndpointConfiguration>, IDynamicProducerEndpointResolver<KafkaProducerEndpoint>, IDynamicProducerEndpointResolver, IProducerEndpointResolver<KafkaProducerEndpoint>, IProducerEndpointResolver, IEquatable<DynamicProducerEndpointResolver<TMessage, KafkaProducerEndpoint, KafkaProducerEndpointConfiguration>>, IEquatable<KafkaDynamicProducerEndpointResolver<TMessage>> where TMessage : class
Type Parameters
| Name | Description |
|---|---|
| TMessage | The type of the message being produced. |
Constructors
KafkaDynamicProducerEndpointResolver(Func<IOutboundEnvelope<TMessage>, TopicPartition>)
Initializes a new instance of the KafkaDynamicProducerEndpointResolver<TMessage> class.
Declaration
public KafkaDynamicProducerEndpointResolver(Func<IOutboundEnvelope<TMessage>, TopicPartition> topicPartitionFunction)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IOutboundEnvelope<TMessage>, TopicPartition> | topicPartitionFunction | The function returning the target topic and partition index for the message being produced. |
KafkaDynamicProducerEndpointResolver(Func<IOutboundEnvelope<TMessage>, string>)
Initializes a new instance of the KafkaDynamicProducerEndpointResolver<TMessage> class.
Declaration
public KafkaDynamicProducerEndpointResolver(Func<IOutboundEnvelope<TMessage>, string> topicFunction)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IOutboundEnvelope<TMessage>, string> | topicFunction | The function returning the target topic for the message being produced. |
KafkaDynamicProducerEndpointResolver(Func<IOutboundEnvelope<TMessage>, string>, Func<IOutboundEnvelope<TMessage>, int>)
Initializes a new instance of the KafkaDynamicProducerEndpointResolver<TMessage> class.
Declaration
public KafkaDynamicProducerEndpointResolver(Func<IOutboundEnvelope<TMessage>, string> topicFunction, Func<IOutboundEnvelope<TMessage>, int> partitionFunction)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IOutboundEnvelope<TMessage>, string> | topicFunction | The function returning the target topic for the message being produced. |
| Func<IOutboundEnvelope<TMessage>, int> | partitionFunction | The function returning the target partition index for the message being produced. |
KafkaDynamicProducerEndpointResolver(Func<TMessage?, TopicPartition>)
Initializes a new instance of the KafkaDynamicProducerEndpointResolver<TMessage> class.
Declaration
public KafkaDynamicProducerEndpointResolver(Func<TMessage?, TopicPartition> topicPartitionFunction)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TMessage, TopicPartition> | topicPartitionFunction | The function returning the target topic and partition index for the message being produced. |
KafkaDynamicProducerEndpointResolver(Func<TMessage?, string>)
Initializes a new instance of the KafkaDynamicProducerEndpointResolver<TMessage> class.
Declaration
public KafkaDynamicProducerEndpointResolver(Func<TMessage?, string> topicFunction)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TMessage, string> | topicFunction | The function returning the target topic for the message being produced. |
KafkaDynamicProducerEndpointResolver(Func<TMessage?, string>, Func<TMessage?, int>)
Initializes a new instance of the KafkaDynamicProducerEndpointResolver<TMessage> class.
Declaration
public KafkaDynamicProducerEndpointResolver(Func<TMessage?, string> topicFunction, Func<TMessage?, int> partitionFunction)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TMessage, string> | topicFunction | The function returning the target topic for the message being produced. |
| Func<TMessage, int> | partitionFunction | The function returning the target partition index for the message being produced. |
KafkaDynamicProducerEndpointResolver(string, Func<IOutboundEnvelope<TMessage>, int>)
Initializes a new instance of the KafkaDynamicProducerEndpointResolver<TMessage> class.
Declaration
public KafkaDynamicProducerEndpointResolver(string topic, Func<IOutboundEnvelope<TMessage>, int> partitionFunction)
Parameters
| Type | Name | Description |
|---|---|---|
| string | topic | The target topic. |
| Func<IOutboundEnvelope<TMessage>, int> | partitionFunction | The function returning the target partition index for the message being produced. |
KafkaDynamicProducerEndpointResolver(string, Func<IOutboundEnvelope<TMessage>, string[]>, Func<IOutboundEnvelope<TMessage>, int>?)
Initializes a new instance of the KafkaDynamicProducerEndpointResolver<TMessage> class.
Declaration
public KafkaDynamicProducerEndpointResolver(string topicFormatString, Func<IOutboundEnvelope<TMessage>, string[]> topicArgumentsFunction, Func<IOutboundEnvelope<TMessage>, int>? partitionFunction = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | topicFormatString | The topic format string that will be combined with the arguments returned by the |
| Func<IOutboundEnvelope<TMessage>, string[]> | topicArgumentsFunction | The function returning the arguments to be used to format the string. |
| Func<IOutboundEnvelope<TMessage>, int> | partitionFunction | The optional function returning the target partition index for the message being produced. If |
KafkaDynamicProducerEndpointResolver(string, Func<TMessage?, int>)
Initializes a new instance of the KafkaDynamicProducerEndpointResolver<TMessage> class.
Declaration
public KafkaDynamicProducerEndpointResolver(string topic, Func<TMessage?, int> partitionFunction)
Parameters
| Type | Name | Description |
|---|---|---|
| string | topic | The target topic. |
| Func<TMessage, int> | partitionFunction | The function returning the target partition index for the message being produced. |
KafkaDynamicProducerEndpointResolver(string, Func<TMessage?, string[]>, Func<TMessage?, int>?)
Initializes a new instance of the KafkaDynamicProducerEndpointResolver<TMessage> class.
Declaration
public KafkaDynamicProducerEndpointResolver(string topicFormatString, Func<TMessage?, string[]> topicArgumentsFunction, Func<TMessage?, int>? partitionFunction = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | topicFormatString | The topic format string that will be combined with the arguments returned by the |
| Func<TMessage, string[]> | topicArgumentsFunction | The function returning the arguments to be used to format the string. |
| Func<TMessage, int> | partitionFunction | The optional function returning the target partition index for the message being produced. If |
Properties
EqualityContract
Dynamically resolves the target topic and partition for each message being produced.
Declaration
protected override Type EqualityContract { get; }
Property Value
| Type | Description |
|---|---|
| Type |
Overrides
Methods
DeserializeEndpoint(string, KafkaProducerEndpointConfiguration)
Deserializes the endpoint from a string.
Declaration
protected override KafkaProducerEndpoint DeserializeEndpoint(string serializedEndpoint, KafkaProducerEndpointConfiguration configuration)
Parameters
| Type | Name | Description |
|---|---|---|
| string | serializedEndpoint | The serialized endpoint. |
| KafkaProducerEndpointConfiguration | configuration | The endpoint configuration. |
Returns
| Type | Description |
|---|---|
| KafkaProducerEndpoint | The deserialized endpoint. |
Overrides
Equals(DynamicProducerEndpointResolver<TMessage, KafkaProducerEndpoint, KafkaProducerEndpointConfiguration>?)
Dynamically resolves the target topic and partition for each message being produced.
Declaration
public override sealed bool Equals(DynamicProducerEndpointResolver<TMessage, KafkaProducerEndpoint, KafkaProducerEndpointConfiguration>? other)
Parameters
| Type | Name | Description |
|---|---|---|
| DynamicProducerEndpointResolver<TMessage, KafkaProducerEndpoint, KafkaProducerEndpointConfiguration> | other |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
Equals(KafkaDynamicProducerEndpointResolver<TMessage>?)
Dynamically resolves the target topic and partition for each message being produced.
Declaration
public bool Equals(KafkaDynamicProducerEndpointResolver<TMessage>? other)
Parameters
| Type | Name | Description |
|---|---|---|
| KafkaDynamicProducerEndpointResolver<TMessage> | other |
Returns
| Type | Description |
|---|---|
| bool |
Equals(object?)
Dynamically resolves the target topic and partition for each message being produced.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
GetEndpointCore(IOutboundEnvelope<TMessage>, KafkaProducerEndpointConfiguration)
Gets the computed actual destination endpoint for the message being produced.
Declaration
protected override KafkaProducerEndpoint GetEndpointCore(IOutboundEnvelope<TMessage> envelope, KafkaProducerEndpointConfiguration configuration)
Parameters
| Type | Name | Description |
|---|---|---|
| IOutboundEnvelope<TMessage> | envelope | The envelope containing the message to be produced. |
| KafkaProducerEndpointConfiguration | configuration | The endpoint configuration. |
Returns
| Type | Description |
|---|---|
| KafkaProducerEndpoint | The ProducerEndpoint for the specified message. |
Overrides
GetHashCode()
Dynamically resolves the target topic and partition for each message being produced.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
Overrides
PrintMembers(StringBuilder)
Dynamically resolves the target topic and partition for each message being produced.
Declaration
protected override bool PrintMembers(StringBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| StringBuilder | builder |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
SerializeEndpoint(KafkaProducerEndpoint)
Serializes the endpoint to a string.
Declaration
protected override string SerializeEndpoint(KafkaProducerEndpoint endpoint)
Parameters
| Type | Name | Description |
|---|---|---|
| KafkaProducerEndpoint | endpoint | The endpoint to be serialized. |
Returns
| Type | Description |
|---|---|
| string | The serialized endpoint. |
Overrides
ToString()
Dynamically resolves the target topic and partition for each message being produced.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
Operators
operator ==(KafkaDynamicProducerEndpointResolver<TMessage>?, KafkaDynamicProducerEndpointResolver<TMessage>?)
Dynamically resolves the target topic and partition for each message being produced.
Declaration
public static bool operator ==(KafkaDynamicProducerEndpointResolver<TMessage>? left, KafkaDynamicProducerEndpointResolver<TMessage>? right)
Parameters
| Type | Name | Description |
|---|---|---|
| KafkaDynamicProducerEndpointResolver<TMessage> | left | |
| KafkaDynamicProducerEndpointResolver<TMessage> | right |
Returns
| Type | Description |
|---|---|
| bool |
operator !=(KafkaDynamicProducerEndpointResolver<TMessage>?, KafkaDynamicProducerEndpointResolver<TMessage>?)
Dynamically resolves the target topic and partition for each message being produced.
Declaration
public static bool operator !=(KafkaDynamicProducerEndpointResolver<TMessage>? left, KafkaDynamicProducerEndpointResolver<TMessage>? right)
Parameters
| Type | Name | Description |
|---|---|---|
| KafkaDynamicProducerEndpointResolver<TMessage> | left | |
| KafkaDynamicProducerEndpointResolver<TMessage> | right |
Returns
| Type | Description |
|---|---|
| bool |