[ https://issues.apache.org/jira/browse/KAFKA-13398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
RivenSun updated KAFKA-13398: ----------------------------- Description: hello [~showuon] and [~guozhang] Kafka has some key functions that have not yet been integrated into Java-AdminClient, so I have to use some Scala classes in the Kafka Server `kafka.admin` package in my java program, such as: `ReassignPartitionsCommand`, `ConsumerGroupCommand` (reset group offsets), `ConfigCommand` and etc., to call their `*main(args: Array[String])*` methods in order to achieve specific functions. *Problem*: 1. In different Kafka versions, these Scala classes may have different requirements for input parameters, or they may have different treatments for the results of command execution. 1) `ReassignPartitionsCommand` requires --bootstrap-server is required in the latest high version, but requires --zookeeper in the low version. Once the parameter verification fails, the *Exit.exit(1, Some(message))* method will be called, which will cause my process to shut down directly. 2) In Kafka 3.0.0 version, there is this code at the end in the `*main(args: Array[String])*` method of `ReassignPartitionsCommand` {code:java} // If the command failed, exit with a non-zero exit code. if (failed) { Exit.exit(1) }{code} This will also make my process shut down directly So I hope that the Kafka community will be able to print out the reason and stack of the corresponding exception when the parameter verification fails or the execution command is abnormal, and then return from the `*main(args: Array[String])*` method of the command, but don't call `*Exit.exit(...)*` method. Of course, when the script is executed on the machine, there is no problem with exiting directly. 2. At present, it seems that only scripts can be used to add/update/delete SCRAM credentials for users, eg: {code:java} > bin/kafka-configs.sh --zookeeper localhost:2182 --zk-tls-config-file > zk_tls_config.properties --alter > --add-config'SCRAM-SHA-256=[iterations=8192,password=alice- > secret],SCRAM-SHA-512=[password=alice-secret]' --entity-type users > --entity-name alice{code} In Kafka 3.0.0 version, the `alterUserScramCredentials` method in `KafkaAdminClient` does not support calling yet, and the `AltUserScramCredentialsOptions` parameter is modified by the annotation @InterfaceStability.Evolving. So I currently have to use `ConfigCommand` to achieve this function, but `ConfigCommand` also has the same logic: *Exit.exit( ...)*. was: hello [~showuon] and [~guozhang] Kafka has some key functions that have not yet been integrated into Java-AdminClient, so I have to use some Scala classes in the Kafka Server `kafka.admin` package in my java program, such as: `ReassignPartitionsCommand`, `ConsumerGroupCommand` (reset group offsets), `ConfigCommand` and etc., to call their `*main(args: Array[String])*` methods in order to achieve specific functions. *Problem*: 1. In different Kafka versions, these Scala classes may have different requirements for input parameters, or they may have different treatments for the results of command execution. 1) `ReassignPartitionsCommand` requires --bootstrap-server is required in the latest high version, but requires --zookeeper in the low version. Once the parameter verification fails, the Exit.exit(1, Some(message)) method will be called, which will cause my process to shut down directly. 2) In Kafka 3.0.0 version, there is this code at the end in the `*main(args: Array[String])*` method of `ReassignPartitionsCommand` {code:java} // If the command failed, exit with a non-zero exit code. if (failed) { Exit.exit(1) }{code} This will also make my process shut down directly So I hope that the Kafka community will be able to print out the reason and stack of the corresponding exception when the parameter verification fails or the execution command is abnormal, and then return from the main method of the command, but don't call `Exit.exit(...)` method. Of course, when the script is executed on the machine, there is no problem with exiting directly. 2. At present, it seems that only scripts can be used to add/update/delete SCRAM credentials for users, eg: {code:java} > bin/kafka-configs.sh --zookeeper localhost:2182 --zk-tls-config-file > zk_tls_config.properties --alter > --add-config'SCRAM-SHA-256=[iterations=8192,password=alice- > secret],SCRAM-SHA-512=[password=alice-secret]' --entity-type users > --entity-name alice{code} In Kafka 3.0.0 version, the `alterUserScramCredentials` method in `KafkaAdminClient` does not support calling yet, and the `AltUserScramCredentialsOptions` parameter is modified by the annotation @InterfaceStability.Evolving. So I currently have to use `ConfigCommand` to achieve this function, but `ConfigCommand` also has the same logic: Exit.exit( ...). > The caller program will be shut down directly when the execution of Kafka > script is abnormal > -------------------------------------------------------------------------------------------- > > Key: KAFKA-13398 > URL: https://issues.apache.org/jira/browse/KAFKA-13398 > Project: Kafka > Issue Type: Improvement > Components: admin > Affects Versions: 3.0.0 > Reporter: RivenSun > Priority: Major > > hello [~showuon] and [~guozhang] > Kafka has some key functions that have not yet been integrated into > Java-AdminClient, so I have to use some Scala classes in the Kafka Server > `kafka.admin` package in my java program, such as: > `ReassignPartitionsCommand`, `ConsumerGroupCommand` (reset group offsets), > `ConfigCommand` and etc., to call their `*main(args: Array[String])*` methods > in order to achieve specific functions. > *Problem*: > 1. In different Kafka versions, these Scala classes may have different > requirements for input parameters, or they may have different treatments for > the results of command execution. > 1) `ReassignPartitionsCommand` requires --bootstrap-server is required in > the latest high version, > but requires --zookeeper in the low version. > Once the parameter verification fails, the *Exit.exit(1, Some(message))* > method will be called, which will cause my process to shut down directly. > 2) In Kafka 3.0.0 version, there is this code at the end in the `*main(args: > Array[String])*` method of `ReassignPartitionsCommand` > {code:java} > // If the command failed, exit with a non-zero exit code. > if (failed) { > Exit.exit(1) > }{code} > This will also make my process shut down directly > So I hope that the Kafka community will be able to print out the reason and > stack of the corresponding exception when the parameter verification fails or > the execution command is abnormal, and then return from the `*main(args: > Array[String])*` method of the command, but don't call `*Exit.exit(...)*` > method. Of course, when the script is executed on the machine, there is no > problem with exiting directly. > 2. At present, it seems that only scripts can be used to add/update/delete > SCRAM credentials for users, eg: > {code:java} > > bin/kafka-configs.sh --zookeeper localhost:2182 --zk-tls-config-file > > zk_tls_config.properties --alter > > --add-config'SCRAM-SHA-256=[iterations=8192,password=alice- > > secret],SCRAM-SHA-512=[password=alice-secret]' --entity-type users > > --entity-name alice{code} > In Kafka 3.0.0 version, the `alterUserScramCredentials` method in > `KafkaAdminClient` does not support calling yet, and the > `AltUserScramCredentialsOptions` parameter is modified by the annotation > @InterfaceStability.Evolving. So I currently have to use `ConfigCommand` to > achieve this function, but `ConfigCommand` also has the same logic: > *Exit.exit( ...)*. -- This message was sent by Atlassian Jira (v8.3.4#803005)