THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Example: Regex Subscription
Existing 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)]) --> onPartitionsAssigned([(foo, (bar0)]) System.out.println(consumer.assignment()); // prints [(foo, 0)] |
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), 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.
...