简体   繁体   English

将 sasl.jaas.config 添加到 payara 上的 Kafka MDB

[英]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谢谢

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我遇到了同样的问题,似乎其他人也为云连接器项目做出了贡献,这是拉取请求-> 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.

相关问题 当您有 2 个单独的主题时配置“sasl.jaas.config”,每个主题都有单独的连接密钥? - Configuration of 'sasl.jaas.config' when you have 2 separate topics, each having separate connection key? Java Kafka 客户端动态 Sasl Jaas 配置更新 - Java Kafka Client Dynamic Sasl Jaas config update 使用 Jaas 配置进行 Kafka 身份验证 - Kafka authentication with Jaas config org.apache.kafka.common.errors.TimeoutException:使用 jaas SASL 配置身份验证获取 Kafka 集群的主题元数据时超时 - org.apache.kafka.common.errors.TimeoutException: Timeout expired while fetching topic metadata for Kafka Cluster using jaas SASL config authentication Kafka“未在JAAS配置中指定登录模块” - Kafka “Login module not specified in JAAS config” Kafka Streams:JAAS 配置中未指定登录模块控制标志 - Kafka Streams: Login module control flag not specified in JAAS config 骆驼卡夫卡生产者异常登录模块控制标志在 JAAS 配置中不可用 - camel kafka producer exception Login module control flag is not available in the JAAS config 保护JAAS配置文件 - Securing JAAS config file Kafka Spring与SASL的集成授权 - Kafka spring integration authorization with sasl MDB中SpringBeanAutowiringInterceptor的Java配置 - java config for SpringBeanAutowiringInterceptor in an MDB
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM