Show / Hide Table of Contents

    Class KafkaProducerEndpointBuilder

    Builds the KafkaProducerEndpoint.

    Inheritance
    object
    EndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>
    ProducerEndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>
    KafkaProducerEndpointBuilder
    Implements
    IKafkaProducerEndpointBuilder
    IProducerEndpointBuilder<IKafkaProducerEndpointBuilder>
    IEndpointBuilder<IKafkaProducerEndpointBuilder>
    Inherited Members
    ProducerEndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.SerializeUsing(IMessageSerializer)
    ProducerEndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.Encrypt(EncryptionSettings)
    ProducerEndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.UseStrategy(IProduceStrategy)
    ProducerEndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.ProduceDirectly()
    ProducerEndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.ProduceToOutbox()
    ProducerEndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.EnableChunking(int, bool)
    ProducerEndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.AddHeader(string, object)
    ProducerEndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.AddHeader<TMessage>(string, object)
    ProducerEndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.AddHeader<TMessage>(string, Func<IOutboundEnvelope<TMessage>, object>)
    ProducerEndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.WithMessageId<TMessage>(Func<IOutboundEnvelope<TMessage>, object>)
    ProducerEndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.Build()
    EndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.MessageType
    EndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.EndpointsConfigurationBuilder
    EndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.This
    EndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.WithName(string)
    EndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.UseSerializer(IMessageSerializer)
    EndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.WithEncryption(EncryptionSettings)
    EndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.ValidateMessage(bool)
    EndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.DisableMessageValidation()
    EndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.CreateEndpoint()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Silverback.Messaging.Configuration.Kafka
    Assembly: Silverback.Integration.Kafka.dll
    Syntax
    public class KafkaProducerEndpointBuilder : ProducerEndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>, IKafkaProducerEndpointBuilder, IProducerEndpointBuilder<IKafkaProducerEndpointBuilder>, IEndpointBuilder<IKafkaProducerEndpointBuilder>

    Constructors

    | Improve this doc View source

    KafkaProducerEndpointBuilder(KafkaClientConfig?, Type?, IEndpointsConfigurationBuilder?)

    Initializes a new instance of the KafkaProducerEndpointBuilder class.

    Declaration
    public KafkaProducerEndpointBuilder(KafkaClientConfig? clientConfig = null, Type? messageType = null, IEndpointsConfigurationBuilder? endpointsConfigurationBuilder = null)
    Parameters
    Type Name Description
    KafkaClientConfig clientConfig

    The KafkaClientConfig to be used to initialize the KafkaProducerConfig.

    Type messageType

    The type of the message being produced.

    IEndpointsConfigurationBuilder endpointsConfigurationBuilder

    The optional reference to the IEndpointsConfigurationBuilder that instantiated the builder.

    Properties

    | Improve this doc View source

    This

    Gets this instance.

    Declaration
    protected override IKafkaProducerEndpointBuilder This { get; }
    Property Value
    Type Description
    IKafkaProducerEndpointBuilder
    Overrides
    EndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.This
    Remarks

    This is necessary to work around casting in the base classes.

    Methods

    | Improve this doc View source

    Configure(Action<KafkaProducerConfig>)

    Configures the Kafka client properties.

    Declaration
    public IKafkaProducerEndpointBuilder Configure(Action<KafkaProducerConfig> configAction)
    Parameters
    Type Name Description
    Action<KafkaProducerConfig> configAction

    An Action<T> that takes the KafkaProducerConfig and configures it.

    Returns
    Type Description
    IKafkaProducerEndpointBuilder

    The IKafkaProducerEndpointBuilder so that additional calls can be chained.

    | Improve this doc View source

    CreateEndpoint()

    Creates the endpoint to be configured according to the options stored in the builder.

    Declaration
    protected override KafkaProducerEndpoint CreateEndpoint()
    Returns
    Type Description
    KafkaProducerEndpoint

    The endpoint.

    Overrides
    EndpointBuilder<KafkaProducerEndpoint, IKafkaProducerEndpointBuilder>.CreateEndpoint()
    | Improve this doc View source

    ProduceTo(Func<IOutboundEnvelope, IServiceProvider, string?>, Func<IOutboundEnvelope, IServiceProvider, int>?)

    Specifies the name of the topic and optionally the target partition.

    Declaration
    public IKafkaProducerEndpointBuilder ProduceTo(Func<IOutboundEnvelope, IServiceProvider, string?> topicNameFunction, Func<IOutboundEnvelope, IServiceProvider, int>? partitionFunction = 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).

    Returns
    Type Description
    IKafkaProducerEndpointBuilder

    The IKafkaProducerEndpointBuilder so that additional calls can be chained.

    | Improve this doc View source

    ProduceTo(Func<IOutboundEnvelope, string?>, Func<IOutboundEnvelope, int>?)

    Specifies the name of the topic and optionally the target partition.

    Declaration
    public IKafkaProducerEndpointBuilder ProduceTo(Func<IOutboundEnvelope, string?> topicNameFunction, Func<IOutboundEnvelope, int>? partitionFunction = 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).

    Returns
    Type Description
    IKafkaProducerEndpointBuilder

    The IKafkaProducerEndpointBuilder so that additional calls can be chained.

    | Improve this doc View source

    ProduceTo(string, Func<IOutboundEnvelope, string[]>, Func<IOutboundEnvelope, int>?)

    Specifies the name of the topic and optionally the target partition.

    Declaration
    public IKafkaProducerEndpointBuilder ProduceTo(string topicNameFormatString, Func<IOutboundEnvelope, string[]> topicNameArgumentsFunction, Func<IOutboundEnvelope, int>? partitionFunction = 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).

    Returns
    Type Description
    IKafkaProducerEndpointBuilder

    The IKafkaProducerEndpointBuilder so that additional calls can be chained.

    | Improve this doc View source

    ProduceTo(string, int?)

    Specifies the name of the topic and optionally the target partition.

    Declaration
    public IKafkaProducerEndpointBuilder ProduceTo(string topicName, int? partition = 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).

    Returns
    Type Description
    IKafkaProducerEndpointBuilder

    The IKafkaProducerEndpointBuilder so that additional calls can be chained.

    | Improve this doc View source

    ProduceTo<TMessage>(Func<IOutboundEnvelope<TMessage>, IServiceProvider, string?>, Func<IOutboundEnvelope<TMessage>, IServiceProvider, int>?)

    Specifies the name of the topic and optionally the target partition.

    Declaration
    public IKafkaProducerEndpointBuilder ProduceTo<TMessage>(Func<IOutboundEnvelope<TMessage>, IServiceProvider, string?> topicNameFunction, Func<IOutboundEnvelope<TMessage>, IServiceProvider, int>? partitionFunction = null) where TMessage : class
    Parameters
    Type Name Description
    Func<IOutboundEnvelope<TMessage>, 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<TMessage>, 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).

    Returns
    Type Description
    IKafkaProducerEndpointBuilder

    The IKafkaProducerEndpointBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages being produced.

    | Improve this doc View source

    ProduceTo<TMessage>(Func<IOutboundEnvelope<TMessage>, string?>, Func<IOutboundEnvelope<TMessage>, int>?)

    Specifies the name of the topic and optionally the target partition.

    Declaration
    public IKafkaProducerEndpointBuilder ProduceTo<TMessage>(Func<IOutboundEnvelope<TMessage>, string?> topicNameFunction, Func<IOutboundEnvelope<TMessage>, int>? partitionFunction = null) where TMessage : class
    Parameters
    Type Name Description
    Func<IOutboundEnvelope<TMessage>, 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<TMessage>, 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).

    Returns
    Type Description
    IKafkaProducerEndpointBuilder

    The IKafkaProducerEndpointBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages being produced.

    | Improve this doc View source

    ProduceTo<TMessage>(string, Func<IOutboundEnvelope<TMessage>, string[]>, Func<IOutboundEnvelope<TMessage>, int>?)

    Specifies the name of the topic and optionally the target partition.

    Declaration
    public IKafkaProducerEndpointBuilder ProduceTo<TMessage>(string topicNameFormatString, Func<IOutboundEnvelope<TMessage>, string[]> topicNameArgumentsFunction, Func<IOutboundEnvelope<TMessage>, int>? partitionFunction = null) where TMessage : class
    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<TMessage>, string[]> topicNameArgumentsFunction

    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 null the partition is automatically derived from the message key (use KafkaKeyMemberAttribute to specify a message key, otherwise a random one will be generated).

    Returns
    Type Description
    IKafkaProducerEndpointBuilder

    The IKafkaProducerEndpointBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages being produced.

    | Improve this doc View source

    UseEndpointNameResolver<TResolver>()

    Specifies the type of the IKafkaProducerEndpointNameResolver to be used to resolve the actual endpoint name and partition.

    Declaration
    public IKafkaProducerEndpointBuilder UseEndpointNameResolver<TResolver>() where TResolver : IKafkaProducerEndpointNameResolver
    Returns
    Type Description
    IKafkaProducerEndpointBuilder

    The IKafkaProducerEndpointBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TResolver

    The type of the IKafkaProducerEndpointNameResolver to be used.

    | Improve this doc View source

    WithKafkaKey<TMessage>(Func<IOutboundEnvelope<TMessage>, object?>)

    Uses the specified value provider function to set the kafka key for each produced message.

    Declaration
    public IKafkaProducerEndpointBuilder WithKafkaKey<TMessage>(Func<IOutboundEnvelope<TMessage>, object?> valueProvider) where TMessage : class
    Parameters
    Type Name Description
    Func<IOutboundEnvelope<TMessage>, object> valueProvider

    The value provider function.

    Returns
    Type Description
    IKafkaProducerEndpointBuilder

    The endpoint builder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be enriched.

    Implements

    IKafkaProducerEndpointBuilder
    IProducerEndpointBuilder<TBuilder>
    IEndpointBuilder<TBuilder>

    Extension Methods

    ProducerEndpointBuilderEncryptUsingExtensions.EncryptUsingAes<TBuilder>(IProducerEndpointBuilder<TBuilder>, byte[], byte[]?)
    ProducerEndpointBuilderEncryptUsingExtensions.EncryptUsingAes<TBuilder>(IProducerEndpointBuilder<TBuilder>, byte[], string, byte[]?)
    ProducerEndpointBuilderProduceBinaryFilesExtensions.ProduceBinaryFiles<TBuilder>(IProducerEndpointBuilder<TBuilder>, Action<IBinaryFileMessageSerializerBuilder>?)
    ProducerEndpointBuilderSerializeAsJsonExtensions.SerializeAsJson<TBuilder>(IProducerEndpointBuilder<TBuilder>, Action<IJsonMessageSerializerBuilder>?)
    ProducerEndpointBuilderSerializeAsJsonUsingNewtonsoftExtensions.SerializeAsJsonUsingNewtonsoft<TBuilder>(IProducerEndpointBuilder<TBuilder>, Action<INewtonsoftJsonMessageSerializerBuilder>?)
    • Improve this doc
    • View source
    GitHub E-Mail
    ↑ Back to top © 2020 Sergio Aquilini