Consumer Configuration
AxualConsumerConfig
Namespace: Axual.Kafka.Proxy.Proxies.Axual
An AxualConsumer is configured in the same way a plain Kafka Consumer 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 ConsumerConfig
, we use the overloaded AxualConsumerConfig
which
contains the additional Axual properties.
Usage
var config = new AxualConsumerConfig
{
// Axual Configuration
ApplicationId = "io.axual.example.client.avro.consumer.dotnet",
EndPoint = new UriBuilder("https",
ServerSettings.ENDPOINT_ADDRESS,
ServerSettings.ENDPOINT_PORT).Uri,
Tenant = ServerSettings.TENANT,
Environment = ServerSettings.ENVIRONMENT,
Debug = "consumer,cgrp,topic,fetch",
// Standard SSL Configuration
EnableSslCertificateVerification = true,
SslCaLocation = ServerSettings.SSL_CA_PATH,
SecurityProtocol = SecurityProtocol.Ssl,
// Option 1: Using p12 files
SslKeystoreLocation = CONSUMER_KEYSTORE_RESOURCE_PATH,
SslKeystorePassword = KEYSTORE_PASSWORD,
// Option 2: Using PEM format files
SslCertificateLocation = CONSUMER_PUBLIC_KEY_LOCATION,
SslKeyLocation = CONSUMER_PRIVATE_KEY_LOCATION,
SskKeyPassword = CONSUMER_PRIVATE_KEY_PASSWORD,
// Option 3: Using PEM format string
SslCertificatePem = CONSUMER_PUBLIC_KEY_STRING,
SslKeyPem = CONSUMER_PRIVATE_KEY_STRING,
SskKeyPassword = CONSUMER_PRIVATE_KEY_PASSWORD,
};
The properties used in the code snippet are summarized below:
Configuration | Type | Description |
---|---|---|
ApplicationId |
|
Identifier used for verifying ConsumerGroup authorization (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. Consumer: consumer,cgrp,topic,fetch |
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