Producer Configuration

AxualProducerConfig

Namespace: Axual.Kafka.Proxy.Proxies.Axual

An AxualProducer is configured in the same way a plain Kafka Producer would be. A collection of key value pairs object which contains the appropriate configurations needs to be defined. The properties that need to be set are the SSL authorization specifics alongside the Axual Specific properties for authenticating and routing to an available Axual Cluster.

In our case instead of using the ProducerConfig, we use the overloaded AxualProducerConfig which contains the additional Axual properties.

Usage

var config = new AxualProducerConfig
{
    // Axual Configuration
    ApplicationId = "io.axual.example.client.avro.producer.dotnet",
    EndPoint = new UriBuilder("https",
                    ServerSettings.ENDPOINT_ADDRESS,
                    ServerSettings.ENDPOINT_PORT).Uri,
    Tenant = ServerSettings.TENANT,
    Environment = ServerSettings.ENVIRONMENT,

    Debug = "broker,topic,msg",

    // Standard SSL Configuration
    EnableSslCertificateVerification = true,
    SslCaLocation = ServerSettings.SSL_CA_PATH,
    SecurityProtocol = SecurityProtocol.Ssl,

    // Option 1: Using p12 files
    SslKeystoreLocation = PRODUCER_KEYSTORE_RESOURCE_PATH,
    SslKeystorePassword = KEYSTORE_PASSWORD,

    // Option 2: Using PEM format files
    SslCertificateLocation = PRODUCER_PUBLIC_KEY_LOCATION,
    SslKeyLocation = PRODUCER_PRIVATE_KEY_LOCATION,
    SskKeyPassword = PRODUCER_PRIVATE_KEY_PASSWORD,

    // Option 3: Using PEM format string
    SslCertificatePem = PRODUCER_PUBLIC_KEY_STRING,
    SslKeyPem = PRODUCER_PRIVATE_KEY_STRING,
    SskKeyPassword = PRODUCER_PRIVATE_KEY_PASSWORD,
};

The properties used in the code snippet are summarized below:

Table 1. General Configurations
Configuration Type Description

ApplicationId

string

Unique application identifier (as it appears on Self Service Portal)

EndPoint

Uri

Url of instance Discovery-API

Tenant

string

Name of the tenant to connect to

Environment

string

Name of the environment to connect to

Debug

string

A comma-separated list of debug contexts to enable. Producer debugging: broker,topic,msg

Table 2. SSL Configurations
Configuration Type Description

SecurityProtocol

Confluent.Kafka.SecurityProtocol

Protocol used to communicate with brokers

EnableSslCertificateVerification

bool

Enable OpenSSL’s builtin broker (server) certificate verification.

SslCaLocation ¹

string

File, directory path or string (PEM format) to CA certificate(s) for verifying the broker’s key

SslKeystoreLocation

string

Path to client’s keystore (PKCS#12) used for authentication

SslKeystorePassword

string

Password to client’s keystore (PKCS#12) used for authentication

SslCertificateLocation

string

Path to client’s public key (PEM) used for authentication

SslKeyLocation

string

Path to client’s private key (PEM) used for authentication

SslCertificatePem ²

string

Client’s public key string (PEM format) used for authentication

SslKeyPem

string

Client’s private key string (PEM format)

SskKeyPassword

string

Private key passphrase

¹ ¹ The .NET client creates a temporary file when using CA PEM certificate(s) as string SslCaLocation.
² SslCertificatePem - Client Certificate Sent without the Full Chain