IBMStreams / streamsx.kafka

Repository for integration with Apache Kafka
https://ibmstreams.github.io/streamsx.kafka/
Apache License 2.0
13 stars 9 forks source link

Application directory cannot be used as file location for files specified via system property and vmArg parameter #224

Closed ghost closed 4 years ago

ghost commented 4 years ago

When using Kerberos authentication, the Kerberos config file, must be specified if it is not placed within one of the default locations /etc/krb5.conf, or $STREAMS_INSTALL/java/jre/lib/security/krb5.conf. These default locations are not accessible in a containerized environment like Cloud Pak for Data. The remaining option for providing the Kerberos config file name would be to bundle this file with the SAB, and to specify the filename as system property java.security.krb5.conf via the vmArg parameter: vmArg: "-Djava.security.krb5.conf=" + getApplicationDir() + "/etc/krb5.conf";, but this gives a compile error:

CDISP0216E ERROR: The ("-Djava.security.krb5.conf=" + getToolkitDirectory("kafkaTransactionSupport")) + "/etc/krb5.conf" value of the vmArg parameter is not a constant expression. The operator model for the Messages operator expects a compile time literal value.

A solution that supports the {applicationDir} token similar to the Kafka properties would be desirable.

ghost commented 4 years ago

todo: update https://ibmstreams.github.io/streamsx.kafka/docs/user/UsingKerberos/

ghost commented 4 years ago

Since release v3.1.2 the application directory can be used in system property passed with the vmArg parameter:

stream <rstring json, rstring messageKey> Messages = KafkaConsumer() {
    param
        propertiesFile: "etc/consumer_krb5.properties";
        pattern: "threePartitionTopic.*";
        groupId: "testgroup-04";
        outputMessageAttributeName: "json";
        outputKeyAttributeName: "messageKey";
        vmArg: "-Djava.security.krb5.conf={applicationDir}/etc/krb5.conf";
}