Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for complexe additional properties in Kafka connector #97

Merged
merged 1 commit into from
Dec 22, 2019
Merged

Add support for complexe additional properties in Kafka connector #97

merged 1 commit into from
Dec 22, 2019

Conversation

S-Tischer
Copy link
Contributor

The additional properties annotation for the setup of the Kafka connection accepts single quotes to wrap parts of the value, which contain the list and/or key value separator itself. This allows more complexe values, for example:
security.protocol=SASL_SSL,sasl.mechanism=PLAIN,sasl.jaas.config='org.apache.kafka.common.security.plain.PlainLoginModule required username="foo" password="bar";'

If a value should contain single quotes, the whole values has to be wrapped in single quotes and the quotes inside the value must be duplicated.

The additional properties annotation for the setup of the Kafka connection accepts single quotes to wrap parts of the value, which contain the list and/or key value separator itself. This allows more complexe values, for example:
security.protocol=SASL_SSL,sasl.mechanism=PLAIN,sasl.jaas.config='org.apache.kafka.common.security.plain.PlainLoginModule required username="foo" password="bar";'

If a value should contain single quotes, the whole values has to be wrapped in single quotes and the quotes inside the value must be duplicated.
@MarkWareham
Copy link
Contributor

Thanks for your PR @S-Tischer
Before we are able to merge your contribution we need you to sign a CLA. Details are in this blog: https://blog.payara.fish/how-to-contribute-to-payara-server

@S-Tischer
Copy link
Contributor Author

Thanks for your PR @S-Tischer
Before we are able to merge your contribution we need you to sign a CLA. Details are in this blog: https://blog.payara.fish/how-to-contribute-to-payara-server

Thank you for the information. The CLA is in the mail on it's way to you.

@smillidge
Copy link
Contributor

We have the CLA thanks.

@smillidge smillidge merged commit 165b260 into payara:master Dec 22, 2019
@nitika-dave
Copy link

Hi @smillidge @S-Tischer ,

I am trying to set sasl.jaas.config property as : @ActivationConfigProperty(propertyName = "additionalProperties", "sasl.jaas.config='org.apache.kafka.common.security.plain.PlainLoginModule required username="user" password="password";'"), referring to this PR. However I see the logs complaining that the property isn't set correctly. I am using 0.6.0(latest) version of rar and jca. Could someone provide inputs as to what might be wrong.
Full set of additionalProperties being set:
@ActivationConfigProperty(propertyName = "additionalProperties", propertyValue = "ssl.truststore.location=/u01/oracle/pp.tenant.truststore.jks,"
+ "ssl.truststore.password=pswd,ssl.keystore.location= /u01/oracle/pp.tenant.sr.keystore.jks,ssl.keystore.password=pswd1,"
+ "sasl.mechanism=PLAIN,security.protocol=SASL_PLAINTEXT,"
+ "sasl.jaas.config='org.apache.kafka.common.security.plain.PlainLoginModule required username="username" password="password";'")

Note : setting username="user" password="password" (without ), gives Syntax/compilation error. and all other properties provided except jaas.config are being set as expected.

Thanks in advance.

@smillidge
Copy link
Contributor

What's the log message?

@nitika-dave
Copy link

nitika-dave commented Jul 1, 2021

@smillidge , Below is the exception :
WARNING: Found illegal properties [sasl.jaas.config, 'org.apache.kafka.common.security.plain.PlainLoginModule required username, "user" password, "pswd";']>
sasl.jaas.config = null
Caused by: java.lang.IllegalArgumentException: No Configuration was registered that can handle the configuration named KafkaClient
at com.bea.common.security.jdkutils.JAASConfiguration.getAppConfigurationEntry(JAASConfiguration.java:130)
at org.apache.kafka.common.security.JaasContext.defaultContext(JaasContext.java:126)
at org.apache.kafka.common.security.JaasContext.load(JaasContext.java:98)
at org.apache.kafka.common.security.JaasContext.loadClientContext(JaasContext.java:84)
at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:134)
at org.apache.kafka.common.network.ChannelBuilders.clientChannelBuilder(ChannelBuilders.java:73)
at org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:105)
at org.apache.kafka.clients.consumer.KafkaConsumer.(KafkaConsumer.java:743)

PFA the full log.

Thanks,
Nitika
log_MDB.log

@nitika-dave
Copy link

@S-Tischer : Did you get a chance to look at the logs . Do you have any pointers for me ?

Thanks,
Nitika

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants