Closed FORRESTLWL closed 1 year ago
In order to do this, you will need to create 2 different configuration files, and use them to create 2 different Kafka clients.
For instance:
client1.properties
# Sets up TLS for encryption and SASL for authN.
security.protocol = SASL_SSL
# Identifies the SASL mechanism to use.
sasl.mechanism = AWS_MSK_IAM
# Binds SASL client implementation. Uses the specified profile name to look for credentials.
sasl.jaas.config = software.amazon.msk.auth.iam.IAMLoginModule required awsProfileName="profile1";
# Encapsulates constructing a SigV4 signature based on extracted credentials.
# The SASL client bound by "sasl.jaas.config" invokes this class.
sasl.client.callback.handler.class = software.amazon.msk.auth.iam.IAMClientCallbackHandler
client2.properties
# Sets up TLS for encryption and SASL for authN.
security.protocol = SASL_SSL
# Identifies the SASL mechanism to use.
sasl.mechanism = AWS_MSK_IAM
# Binds SASL client implementation. Uses the specified profile name to look for credentials.
sasl.jaas.config = software.amazon.msk.auth.iam.IAMLoginModule required awsProfileName="profile2";
# Encapsulates constructing a SigV4 signature based on extracted credentials.
# The SASL client bound by "sasl.jaas.config" invokes this class.
sasl.client.callback.handler.class = software.amazon.msk.auth.iam.IAMClientCallbackHandler
And use the following Kafka cli commands to consume messages from topic:
kafka-console-consumer.sh --bootstrap-server $bootstrap-server --topic test_topic --consumer.config <enter filename here>
We have a scenario that there are 2 kafkas source need to be connected in our project with different IAM credentials. But according to your credential provider chain, it seems that it only support 1 single credential at one time. I'm wondering if there is anyway that I can achieve this? Sth like: Kafka1 config -> load credential 1 Kafka2 config -> load credential 2