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:
Configuration | Type | Description |
---|---|---|
ApplicationId |
|
Unique application identifier (as it appears on Self Service Portal) |
EndPoint |
|
Url of instance |
Tenant |
|
Name of the tenant to connect to |
Environment |
|
Name of the environment to connect to |
Debug |
|
A comma-separated list of debug contexts to enable. Producer debugging: broker,topic,msg |
Configuration | Type | Description |
---|---|---|
SecurityProtocol |
|
Protocol used to communicate with brokers |
EnableSslCertificateVerification |
|
Enable OpenSSL’s builtin broker (server) certificate verification. |
SslCaLocation ¹ |
|
File, directory path or string (PEM format) to CA certificate(s) for verifying the broker’s key |
SslKeystoreLocation |
|
Path to client’s keystore (PKCS#12) used for authentication |
SslKeystorePassword |
|
Password to client’s keystore (PKCS#12) used for authentication |
SslCertificateLocation |
|
Path to client’s public key (PEM) used for authentication |
SslKeyLocation |
|
Path to client’s private key (PEM) used for authentication |
SslCertificatePem ² |
|
Client’s public key string (PEM format) used for authentication |
SslKeyPem |
|
Client’s private key string (PEM format) |
SskKeyPassword |
|
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