Interface ClusterResourceListener
-
public interface ClusterResourceListener
A callback interface that users can implement when they wish to get notified about changes in the Cluster metadata.Users who need access to cluster metadata in interceptors, metric reporters, serializers and deserializers can implement this interface. The order of method calls for each of these types is described below.
Clients
There will be one invocation ofonUpdate(ClusterResource)
after each metadata response. Note that the cluster id may be null when the Kafka broker version is below 0.10.1.0. If you receive a null cluster id, you can expect it to always be null unless you have a cluster with multiple broker versions which can happen if the cluster is being upgraded while the client is running.ProducerInterceptor
: TheonUpdate(ClusterResource)
method will be invoked afterProducerInterceptor.onSend(org.apache.kafka.clients.producer.ProducerRecord)
but beforeProducerInterceptor.onAcknowledgement(org.apache.kafka.clients.producer.RecordMetadata, Exception)
.ConsumerInterceptor
: TheonUpdate(ClusterResource)
method will be invoked beforeConsumerInterceptor.onConsume(org.apache.kafka.clients.consumer.ConsumerRecords)
Serializer
: TheonUpdate(ClusterResource)
method will be invoked beforeSerializer.serialize(String, Object)
Deserializer
: TheonUpdate(ClusterResource)
method will be invoked beforeDeserializer.deserialize(String, byte[])
MetricsReporter
: TheonUpdate(ClusterResource)
method will be invoked after firstKafkaProducer.send(org.apache.kafka.clients.producer.ProducerRecord)
invocation for Producer metrics reporter and after firstKafkaConsumer.poll(java.time.Duration)
invocation for Consumer metrics reporters. The reporter may receive metric events from the network layer before this method is invoked.Broker
There is a single invocationonUpdate(ClusterResource)
on broker start-up and the cluster metadata will never change.KafkaMetricsReporter : The
onUpdate(ClusterResource)
method will be invoked during the bootup of the Kafka broker. The reporter may receive metric events from the network layer before this method is invoked.MetricsReporter
: TheonUpdate(ClusterResource)
method will be invoked during the bootup of the Kafka broker. The reporter may receive metric events from the network layer before this method is invoked.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
onUpdate(ClusterResource clusterResource)
A callback method that a user can implement to get updates forClusterResource
.
-
-
-
Method Detail
-
onUpdate
void onUpdate(ClusterResource clusterResource)
A callback method that a user can implement to get updates forClusterResource
.- Parameters:
clusterResource
- cluster metadata
-
-