You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Chia-Ping Tsai (Jira)" <ji...@apache.org> on 2026/09/23 11:01:00 UTC
[jira] [Created] (KAFKA-21150) Refactor AbstractKafkaConfig#processRoles
Chia-Ping Tsai created KAFKA-21150:
--------------------------------------
Summary: Refactor AbstractKafkaConfig#processRoles
Key: KAFKA-21150
URL: https://issues.apache.org/jira/browse/KAFKA-21150
Project: Kafka
Issue Type: Improvement
Reporter: Chia-Ping Tsai
Assignee: Chia-Ping Tsai
{code:java}
public Set<ProcessRole> processRoles() {
Set<ProcessRole> result = new HashSet<>();
for (String role : getList(KRaftConfigs.PROCESS_ROLES_CONFIG)) {
switch (role) {
case "broker" -> result.add(ProcessRole.BrokerRole);
case "controller" -> result.add(ProcessRole.ControllerRole);
default -> throw new ConfigException("Unknown process role '" + role +
"' (only 'broker' and 'controller' are allowed roles)");
}
}
return Collections.unmodifiableSet(result);
} {code}
We could add a helper method to {{ProcessRole}} that converts a string to a {{{}ProcessRole{}}}, and then rewrite {{processRoles()}} in a fluent style.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)