Skip to content

Commit

Permalink
Add kafka connection properties to profile (#791)
Browse files Browse the repository at this point in the history
  • Loading branch information
emef authored Dec 3, 2024
1 parent 29e96b0 commit 868b3d5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
1 change: 1 addition & 0 deletions crates/arroyo-connectors/src/confluent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ impl From<ConfluentProfile> for KafkaConfig {
password: c.secret,
},
schema_registry_enum: Some(c.schema_registry.into()),
connection_properties: HashMap::new(),
}
}
}
Expand Down
21 changes: 15 additions & 6 deletions crates/arroyo-connectors/src/kafka/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ impl KafkaConnector {
authentication: auth,
bootstrap_servers: BootstrapServers(pull_opt("bootstrap_servers", options)?),
schema_registry_enum: schema_registry,
connection_properties: HashMap::new(),
})
}

Expand Down Expand Up @@ -926,13 +927,21 @@ pub fn client_configs(
}
};

for (k, v) in connection.connection_properties.iter() {
client_configs.insert(k.to_string(), v.to_string());
}

if let Some(table) = table {
client_configs.extend(
table
.client_configs
.iter()
.map(|(k, v)| (k.to_string(), v.to_string())),
);
for (k, v) in table.client_configs.iter() {
if connection.connection_properties.contains_key(k) {
warn!(
"rdkafka config key {:?} defined in both connection and table config",
k
);
}

client_configs.insert(k.to_string(), v.to_string());
}
}

Ok(client_configs)
Expand Down
12 changes: 12 additions & 0 deletions crates/arroyo-connectors/src/kafka/profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@
"sensitive": ["apiSecret"]
}
]
},
"connectionProperties": {
"type": "object",
"title": "Connection Properties",
"description": "Key-value pairs of rdkafka configuration options",
"items": {
"type": "string",
"title": "property"
},
"additionalProperties": {
"type": "string"
}
}
},
"required": ["bootstrapServers", "authentication"]
Expand Down

0 comments on commit 868b3d5

Please sign in to comment.