Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Example: Regex Subscription

Existing Semantics (Follows Suggested Semantics)

Code Block
consumer.subscribe(Pattern.compile("..."))
System.out.println(consumer.assignment()); // prints []

consumer.poll(0)
  --> onPartitionsRevoked([]) 
  --> onPartitionsAssigned([(foo, 0), (bar,0)])
System.out.println(consumer.assignment()); // prints [(foo, 0), (bar, 0)]
 
consumer.subscribe(Pattern.compile("f.."))
System.out.println(consumer.assignment()); // prints [(foo, 0), (bar, 0)]

consumer.poll(0)
  --> onPartitionsRevoked([(foo, 0), (bar, 0)]) 
  --> onPartitionsAssigned([(foo, 0)])
System.out.println(consumer.assignment()); // prints [(foo, 0)]

Note that there is a JIRA (KAFKA-3854) open for a defect in how consecutive regex subscription calls fail. This JIRA, although related to this KIP, is outside its scope. It is expected that regex subscription works as described in the above example once the JIRA is fixed. 

 

Public Interfaces

There are no new public interfaces or changes to existing interfaces suggested by this KIP.

...