[英]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"), @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 = "autoCommitInterval", propertyValue = "100"),
@ActivationConfigProperty(propertyName = "retryBackoff", propertyValue = "1000"), @ActivationConfigProperty(propertyName = "retryBackoff", propertyValue = "1000"),
@ActivationConfigProperty(propertyName = "keyDeserializer", propertyValue = "org.apache.kafka.common.serialization.StringDeserializer"), @ActivationConfigProperty(propertyName = "keyDeserializer", propertyValue = "org.apache.kafka.common.serialization.StringDeserializer"),
@ActivationConfigProperty(propertyName = "valueDeserializer", propertyValue = "org.apache.kafka.common.serialization.StringDeserializer"), @ActivationConfigProperty(propertyName = "valueDeserializer", propertyValue = "org.apache.kafka.common.serialization.StringDeserializer"),
@ActivationConfigProperty(propertyName = "pollInterval", propertyValue = "30000"), @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**"") }) @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.谁能帮我将 sasl.jass.config 属性添加到我使用 Payara MDB 创建的 KafkaConsumer。 I am trying as above, but does not work.
我正在尝试如上所述,但不起作用。
Thanks谢谢
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我遇到了同样的问题,似乎其他人也为云连接器项目做出了贡献,这是拉取请求-> 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.问题的出现是因为 sasl.jaas.config 参数中的“=”符号,这用于从 kafka 连接器中的值拆分属性。
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.通过将变量值用单引号括起来,整个字符串被获取,并且 sasl.jaas.config 字符串可以加载到系统中。
@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};'"))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.