Show / Hide Table of Contents

    Class KafkaProducerEndpoint

    Represents a topic to produce to.

    Inheritance
    object
    Endpoint
    ProducerEndpoint
    KafkaProducerEndpoint
    Implements
    IProducerEndpoint
    IEndpoint
    IEquatable<KafkaProducerEndpoint>
    Inherited Members
    ProducerEndpoint.Chunk
    ProducerEndpoint.Strategy
    ProducerEndpoint.MessageEnrichers
    ProducerEndpoint.GetActualName(IOutboundEnvelope, IServiceProvider)
    Endpoint.DefaultSerializer
    Endpoint.DisplayName
    Endpoint.Name
    Endpoint.FriendlyName
    Endpoint.Serializer
    Endpoint.Encryption
    Endpoint.MessageValidationMode
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Silverback.Messaging
    Assembly: Silverback.Integration.Kafka.dll
    Syntax
    public sealed class KafkaProducerEndpoint : ProducerEndpoint, IProducerEndpoint, IEndpoint, IEquatable<KafkaProducerEndpoint>

    Constructors

    | Improve this doc View source

    KafkaProducerEndpoint(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
    Func<IOutboundEnvelope, IServiceProvider, string> topicNameFunction

    The function returning the topic name for the message being produced. If the function returns null the message will not be produced.

    KafkaClientConfig clientConfig

    The KafkaClientConfig to be used to initialize the KafkaProducerConfig.

    | Improve this doc View source

    KafkaProducerEndpoint(Func<IOutboundEnvelope, IServiceProvider, string?>, Func<IOutboundEnvelope, IServiceProvider, int>?, 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
    Func<IOutboundEnvelope, IServiceProvider, string> topicNameFunction

    The function returning the topic name for the message being produced. If the function returns null the message will not be produced.

    Func<IOutboundEnvelope, IServiceProvider, int> partitionFunction

    The optional function returning the target partition index for the message being produced. If null the partition is automatically derived from the message key (use KafkaKeyMemberAttribute to specify a message key, otherwise a random one will be generated).

    KafkaClientConfig clientConfig

    The KafkaClientConfig to be used to initialize the KafkaProducerConfig.

    | Improve this doc View source

    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
    Func<IOutboundEnvelope, string> topicNameFunction

    The function returning the topic name for the message being produced. If the function returns null the message will not be produced.

    KafkaClientConfig clientConfig

    The KafkaClientConfig to be used to initialize the KafkaProducerConfig.

    | Improve this doc View source

    KafkaProducerEndpoint(Func<IOutboundEnvelope, string?>, Func<IOutboundEnvelope, int>?, 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
    Func<IOutboundEnvelope, string> topicNameFunction

    The function returning the topic name for the message being produced. If the function returns null the message will not be produced.

    Func<IOutboundEnvelope, int> partitionFunction

    The optional function returning the target partition index for the message being produced. If null the partition is automatically derived from the message key (use KafkaKeyMemberAttribute to specify a message key, otherwise a random one will be generated).

    KafkaClientConfig clientConfig

    The KafkaClientConfig to be used to initialize the KafkaProducerConfig.

    | Improve this doc View source

    KafkaProducerEndpoint(string, KafkaClientConfig?)

    Initializes a new instance of the KafkaProducerEndpoint class.

    Declaration
    public KafkaProducerEndpoint(string topicName, KafkaClientConfig? clientConfig = null)
    Parameters
    Type Name Description
    string topicName

    The name of the topic.

    KafkaClientConfig clientConfig

    The KafkaClientConfig to be used to initialize the KafkaProducerConfig.

    | Improve this doc View source

    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
    string topicNameFormatString

    The endpoint name format string that will be combined with the arguments returned by the topicNameArgumentsFunction using a string.Format.

    Func<IOutboundEnvelope, 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.

    | Improve this doc View source

    KafkaProducerEndpoint(string, Func<IOutboundEnvelope, string[]>, Func<IOutboundEnvelope, int>?, 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
    string topicNameFormatString

    The endpoint name format string that will be combined with the arguments returned by the topicNameArgumentsFunction using a string.Format.

    Func<IOutboundEnvelope, string[]> topicNameArgumentsFunction

    The function returning the arguments to be used to format the string.

    Func<IOutboundEnvelope, int> partitionFunction

    The optional function returning the target partition index for the message being produced. If null the partition is automatically derived from the message key (use KafkaKeyMemberAttribute to specify a message key, otherwise a random one will be generated).

    KafkaClientConfig clientConfig

    The KafkaClientConfig to be used to initialize the KafkaProducerConfig.

    | Improve this doc View source

    KafkaProducerEndpoint(string, int?, KafkaClientConfig?)

    Initializes a new instance of the KafkaProducerEndpoint class.

    Declaration
    public KafkaProducerEndpoint(string topicName, int? partition, KafkaClientConfig? clientConfig = null)
    Parameters
    Type Name Description
    string topicName

    The name of the topic.

    int? partition

    The optional partition index. If null the partition is automatically derived from the message key (use KafkaKeyMemberAttribute to specify a message key, otherwise a random one will be generated).

    KafkaClientConfig clientConfig

    The KafkaClientConfig to be used to initialize the KafkaProducerConfig.

    | Improve this doc View source

    KafkaProducerEndpoint(Type, KafkaClientConfig?)

    Initializes a new instance of the KafkaProducerEndpoint class.

    Declaration
    public KafkaProducerEndpoint(Type resolverType, KafkaClientConfig? clientConfig = null)
    Parameters
    Type Name Description
    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 source

    Configuration

    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 source

    Equals(KafkaProducerEndpoint?)

    Indicates whether the current object is equal to another object of the same type.

    Declaration
    public bool Equals(KafkaProducerEndpoint? other)
    Parameters
    Type Name Description
    KafkaProducerEndpoint other

    An object to compare with this object.

    Returns
    Type Description
    bool

    true if the current object is equal to the other parameter; otherwise, false.

    | Improve this doc View source

    Equals(object?)

    Determines whether the specified object is equal to the current object.

    Declaration
    public override bool Equals(object? obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with the current object.

    Returns
    Type Description
    bool

    true if the specified object is equal to the current object; otherwise, false.

    Overrides
    object.Equals(object)
    | Improve this doc View source

    GetHashCode()

    Serves as the default hash function.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for the current object.

    Overrides
    object.GetHashCode()
    | Improve this doc View source

    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.

    IServiceProvider serviceProvider

    The IServiceProvider in the current scope.

    Returns
    Type Description
    Partition

    The partition to be produced to.

    | Improve this doc View source

    Validate()

    Validates the endpoint configuration and throws an EndpointConfigurationException if not valid.

    Declaration
    public override void Validate()
    Overrides
    ProducerEndpoint.Validate()

    Implements

    IProducerEndpoint
    IEndpoint
    IEquatable<T>
    • Improve this doc
    • View source
    GitHub E-Mail
    ↑ Back to top © 2020 Sergio Aquilini