Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Replace ConnectClusterState.kafkaClusterId() method with clusterDetails() method, add ConnectClusterDetails type

...

Code Block
languagejava
titleConnectClusterState interface - additional methods
/**
 * Lookup the current configuration of a connector. This provides the current snapshot of configuration by querying the underlying
 * herder. A connector returned by previous invocation of {@link #connectors()} may no longer be available and could result in {@link
 * org.apache.kafka.connect.errors.NotFoundException}.
 *
 * @param connName name of the connector
 * @return the configuration of the connector for the connector name
 * @throws org.apache.kafka.connect.errors.NotFoundException if the requested connector can't be found
 * @throws java.lang.UnsupportedOperationException if the default implementation has not been overridden
 */
default Map<String, String> connectorConfig(String connName) {
  throw new UnsupportedOperationException();
}

/**
 * Get details about the clustersetup ID of the Kafka cluster backing this Connect cluster.
 * @return thea cluster{@link IDConnectClusterDetails} ofobject thecontaining Kafkainformation clusterabout backing thisthe connect cluster
 * @throws java.lang.UnsupportedOperationException if the default implementation has not been overridden
 **/
default StringConnectClusterDetails kafkaClusterIdclusterDetails() {
  throw new UnsupportedOperationException();
}


A new ConnectClusterDetails class will be added as well, that contains immutable information about the Connect cluster:

Code Block
languagejava
titleConnectClusterDetails - new interface
package org.apache.kafka.connect.health;

public class ConnectClusterDetails {

  private final String kafkaClusterId;

  public ConnectClusterDetails(String kafkaClusterId) {
    this.kafkaClusterId = kafkaClusterId;
  }

  /**
   * Get the cluster ID of the Kafka cluster backing this Connect cluster.
   * @return the cluster ID of the Kafka cluster backing this connect cluster
   **/
  public String kafkaClusterId() {
    return kafkaClusterId;
  }
}

This class will only provide the ID of the backing Kafka cluster for now, but may be expanded in the future to include the mode of the Connect worker (standalone, distributed, embedded), the group ID of a distributed cluster, or other information.

Proposed Changes

The basic idea here was to add as much information to the ConnectClusterState interface as is available via the Connect REST API; this includes all currently-available read-only methods of the Herder interface. However, due to lack of a convincing use case, information on task configurations will be left out for now.

...