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

KafkaOutput binding 'topic' attribute doesn't support environment variables #158

Closed
meken opened this issue Aug 10, 2020 · 3 comments
Closed

Comments

@meken
Copy link

meken commented Aug 10, 2020

At least for the Java bindings the following config fails:

@KafkaOutput(topic="%KAFKA_TOPIC%", ...

whereas the username, password etc support environment variables. Interestingly, the @KafkaTrigger topic attribute also supports environment variables.

See below the error messsage indicating that the topic name is not resolved properly.

[2020-08-10 13:58:00] Failed to delivery message to %KAFKA_TOPIC% / -1 / -1001. Reason: Local: Unknown topic. Full Error: Local: Unknown topic
[2020-08-10 13:58:00] Executed 'Functions.producer' (Failed, Id=efdce3d9-ba7c-4cdf-aeae-a18aadde68c9)
[2020-08-10 13:58:00] System.Private.CoreLib: Exception while executing function: Functions.producer. Confluent.Kafka: Local: Unknown topic.

Obviously replacing the environment variable with the name of the topic in verbatim works, but I'd expect all config variables to accept environment variables, or at least the same ones as the trigger.

@TsuyoshiUshio
Copy link
Contributor

I believe this PR solves. :) #153

@meken
Copy link
Author

meken commented Aug 12, 2020

@TsuyoshiUshio it looks like that the PR addresses the environment variable resolution only for the Listener (for the @KafkaTrigger), however I'm having trouble with the output binding (@KafkaOutput).

Just had a quick look at the KafkaProducerFactory.cs, the name resolution for other attributes takes place when a ProducerConfig is created. However, this class doesn't contain the topic information, so it should've been resolved somewhere else (in KafkaProducerEntity.cs or maybe earlier KafkaAttributeBinding.cs?).

@TsuyoshiUshio
Copy link
Contributor

Done implementation, could you wait for the next release?

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

No branches or pull requests

2 participants