简体   繁体   中英

Adding sasl.jaas.config to Kafka MDB on payara

@MessageDriven(name = "KafkaMDB", activationConfig = { @ActivationConfigProperty(propertyName = "bootstrapServersConfig", propertyValue = "ab-cde-xyz-stage.crb.axxxxx.net:9093"), @ActivationConfigProperty(propertyName = "clientId", propertyValue = "sp-document-processor"), @ActivationConfigProperty(propertyName = "groupIdConfig", propertyValue = "AMPSEM.consumerGroup.v1"), @ActivationConfigProperty(propertyName = "topics", propertyValue = "teat.topic.any.v2"), @ActivationConfigProperty(propertyName = "autoOffsetReset", propertyValue = "earliest"),
@ActivationConfigProperty(propertyName = "autoCommitInterval", propertyValue = "100"),
@ActivationConfigProperty(propertyName = "retryBackoff", propertyValue = "1000"),
@ActivationConfigProperty(propertyName = "keyDeserializer", propertyValue = "org.apache.kafka.common.serialization.StringDeserializer"),
@ActivationConfigProperty(propertyName = "valueDeserializer", propertyValue = "org.apache.kafka.common.serialization.StringDeserializer"),
@ActivationConfigProperty(propertyName = "pollInterval", propertyValue = "30000"),
@ActivationConfigProperty(propertyName = "additionalProperties", propertyValue = "ssl.truststore.location=/u01/oracle/application/config/ext/pp.tenant.truststore.jks," + "ssl.truststore.password=12345,ssl.keystore.location= /u01/oracle/application/config/ext/pp.tenant.sr.keystore.jks,ssl.keystore.password=12345," + "sasl.mechanism=SCRAM-SHA-256,security.protocol=SASL_SSL,**sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username\="pp.ampsem.v1" password\="12345**"") })

Can Anyone help me in adding sasl.jass.config property to KafkaConsumer that I have created using Payara MDB. I am trying as above, but does not work.

Thanks

Eclipse 中的语法错误

I was running into the same issue, it appears someone else was as well and created a contribution to the cloud connectors project, here is the pull request -> https://github.com/payara/Cloud-Connectors/pull/97

The issue arises because of the '=' sign in the sasl.jaas.config parameter, this is used for splitting properties from their value in the kafka connector.

By wrapping the variable value in single quotes, the entire string is taken and the sasl.jaas.config string can be loaded into the system.

@MessageDriven(name = "KafkaMDB", activationConfig = {
    @ActivationConfigProperty(propertyName = "additionalProperties", propertyValue = "sasl.jaas.config='org.apache.kafka.common.security.plain.PlainLoginModule required username=${sasl.jaas.connection.string} password=${sasl.jaas.connection.secret};'"))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM