public interface ClusterResourceListener
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.
onUpdate(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
: The onUpdate(ClusterResource)
method will be invoked after ProducerInterceptor.onSend(ProducerRecord)
but before ProducerInterceptor.onAcknowledgement(RecordMetadata, Exception)
.
ConsumerInterceptor
: The onUpdate(ClusterResource)
method will be invoked before ConsumerInterceptor.onConsume(ConsumerRecords)
Serializer
: The onUpdate(ClusterResource)
method will be invoked before Serializer.serialize(String, Object)
Deserializer
: The onUpdate(ClusterResource)
method will be invoked before Deserializer.deserialize(String, byte[])
MetricsReporter
: The onUpdate(ClusterResource)
method will be invoked after first KafkaProducer.send(ProducerRecord)
invocation for Producer metrics reporter
and after first KafkaConsumer.poll(long)
invocation for Consumer metrics reporters. The reporter may receive metric events from the network layer before this method is invoked.
onUpdate(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
: 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.
Modifier and Type | Method | Description |
---|---|---|
void |
onUpdate(ClusterResource clusterResource) |
A callback method that a user can implement to get updates for
ClusterResource . |
void onUpdate(ClusterResource clusterResource)
ClusterResource
.clusterResource
- cluster metadata