Skip to content

enable sending any kafka props#25

Merged
tsuz merged 1 commit into
mainfrom
feat/kafka-props
May 23, 2026
Merged

enable sending any kafka props#25
tsuz merged 1 commit into
mainfrom
feat/kafka-props

Conversation

@tsuz
Copy link
Copy Markdown
Owner

@tsuz tsuz commented May 23, 2026

partially fixes #24

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a mechanism to pass through KAFKA_* environment variables into Kafka client configurations across the Java services and the Python SDK, enabling users to inject Kafka authentication and other client properties (issue #24).

Changes:

  • Introduced KafkaEnvProps (Java) / kafka_env_props() (Python) helpers that map KAFKA_FOO_BARfoo.bar and skip app-level KAFKA_* vars (topics, consumer group).
  • Applied the env-derived Kafka properties to Kafka Consumers/Producers/Admin clients across multiple apps (chat-api, think-consumer, memoir consumer, monitoring consumer, streams processing app).
  • Exported the Python helper in the SDK and updated an example to use it.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
think/think-consumer/src/main/java/io/flightdeck/think/consumer/ThinkConsumer.java Applies env-derived Kafka props to the Think consumer/producer configs.
think/think-consumer/src/main/java/io/flightdeck/think/config/KafkaEnvProps.java Adds env → Kafka Properties pass-through helper for think-consumer.
sdk/python/flightdeck_sdk/tool_consumer_runner.py Merges env-derived Kafka props into SDK tool runner Consumer/Producer configs.
sdk/python/flightdeck_sdk/think_consumer_runner.py Merges env-derived Kafka props into SDK think runner Consumer/Producer configs.
sdk/python/flightdeck_sdk/kafka_env_props.py Adds Python env → Kafka config dict helper.
sdk/python/flightdeck_sdk/init.py Exposes kafka_env_props as part of the public SDK API.
processor-apps/processing/src/main/java/io/flightdeck/streams/KafkaEnvProps.java Adds env → Kafka Properties helper for the Streams processing app.
processor-apps/processing/src/main/java/io/flightdeck/streams/FlightDeckStreamsApp.java Applies env-derived Kafka props to Streams and AdminClient configs.
monitoring/logging-consumer/src/main/java/io/flightdeck/monitoring/MonitoringApp.java Applies env-derived Kafka props to monitoring consumer config.
monitoring/logging-consumer/src/main/java/io/flightdeck/monitoring/KafkaEnvProps.java Adds env → Kafka Properties helper for monitoring module.
memoir/update-memoir-consumer/src/main/java/io/flightdeck/memoir/consumer/UpdateMemoirConsumer.java Applies env-derived Kafka props to memoir consumer/producer configs.
memoir/update-memoir-consumer/src/main/java/io/flightdeck/memoir/config/KafkaEnvProps.java Adds env → Kafka Properties helper for memoir module.
examples/system-ops/kafka-tool-service/app.py Uses SDK helper to pass env-derived Kafka props into AdminClient / lag Consumer.
api/chat-api/src/main/java/io/flightdeck/api/PipelineConsumer.java Applies env-derived Kafka props to pipeline consumer config.
api/chat-api/src/main/java/io/flightdeck/api/OutputConsumer.java Applies env-derived Kafka props to output consumer config.
api/chat-api/src/main/java/io/flightdeck/api/KafkaMessageProducer.java Applies env-derived Kafka props to chat-api producer config.
api/chat-api/src/main/java/io/flightdeck/api/KafkaEnvProps.java Adds env → Kafka Properties helper for chat-api module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +33 to +35
if (!key.startsWith(PREFIX) || SKIP.contains(key)) continue;
String mapped = key.substring(PREFIX.length()).toLowerCase().replace('_', '.');
props.put(mapped, entry.getValue());
Comment on lines +29 to +32
String key = entry.getKey();
if (!key.startsWith(PREFIX) || SKIP.contains(key)) continue;
String mapped = key.substring(PREFIX.length()).toLowerCase().replace('_', '.');
props.put(mapped, entry.getValue());
Comment on lines +29 to +32
String key = entry.getKey();
if (!key.startsWith(PREFIX) || SKIP.contains(key)) continue;
String mapped = key.substring(PREFIX.length()).toLowerCase().replace('_', '.');
props.put(mapped, entry.getValue());
Comment on lines +29 to +32
String key = entry.getKey();
if (!key.startsWith(PREFIX) || SKIP.contains(key)) continue;
String mapped = key.substring(PREFIX.length()).toLowerCase().replace('_', '.');
props.put(mapped, entry.getValue());
Comment on lines +29 to +32
String key = entry.getKey();
if (!key.startsWith(PREFIX) || SKIP.contains(key)) continue;
String mapped = key.substring(PREFIX.length()).toLowerCase().replace('_', '.');
props.put(mapped, entry.getValue());
Comment on lines +7 to +16
/**
* Pass-through of {@code KAFKA_*} environment variables into a Kafka client
* {@link Properties}. {@code KAFKA_FOO_BAR_BAZ} becomes {@code foo.bar.baz}.
*
* <p>Application-level variables that share the {@code KAFKA_} prefix but are
* not Kafka client config are skipped (input/output topic, consumer group).
* These will be renamed without the prefix in the future.
*/
public final class KafkaEnvProps {

Comment on lines +27 to +33
public static void apply(Properties props) {
for (Map.Entry<String, String> entry : System.getenv().entrySet()) {
String key = entry.getKey();
if (!key.startsWith(PREFIX) || SKIP.contains(key)) continue;
String mapped = key.substring(PREFIX.length()).toLowerCase().replace('_', '.');
props.put(mapped, entry.getValue());
}
continue
mapped = key[len(_PREFIX):].lower().replace("_", ".")
out[mapped] = value
return out
@tsuz tsuz merged commit c141289 into main May 23, 2026
3 checks passed
@tsuz tsuz deleted the feat/kafka-props branch May 23, 2026 04:54
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

Successfully merging this pull request may close these issues.

Enable injecting all kafka and schema props

2 participants