anchor.diff:  :page-description: "How to retrieve Kafka consumer lag with Java API."
   
   This article shows how to get Kafka lag for a given consumer group using the Java API.
  -It's about implementing part of the `kafka-consumer-group` command line tool in pure Java.
  +It's about implementing part of the `kafka-consumer-group` command-line tool in pure Java.
   
   image::{imagedir}/lag.svg[Consumer Lag]
   
  
positive.code:     If it were the case, instantiating a consumer would be useless.
  . We have to open two connections, and repeat twice the connection settings like `bootstrap.servers`,
      once for the admin client, then for the consumer client.
      It would be interesting if they could share options and may be even the TCP connection.
  . `AdminClient` class often returns `KafkaFuture<Something>`,
      the API design is very different from `Consumer` and `Producer` clients.
      I wonder why they created a `KafkaFuture` class instead of reusing `CompletableFuture`.
  
negative.code: == Joining offsets and computing lag
  
  Both consumer offsets and topic end offsets are given per partition.
  To compute the lag we have to do a join using the topic partition as key.
  
  [source, java]
  ----
  