Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-13398

The caller program will be shut down directly when the execution of Kafka script is abnormal

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • 3.0.0
    • None
    • admin
    • None

    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),  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`

      // If the command failed, exit with a non-zero exit code.
       if (failed) {
       Exit.exit(1)
       }

      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.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            RivenSun RivenSun
            Guozhang Wang Guozhang Wang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: