Is there a “topics” API or are you just thinking of a new feature? But the second example, I didn’t know you could fetchAndLock before deciding which topics to grab. That’s exactly what I need to do. For our implementation, we limit the number to lock based on the number of CPUs available and we spawn off threads for each locked task. We will have to rework our code to do it like your example, but sounds very promising.
You can close that JIRA ticket that I opened with the priority bug in the Java API. Sorry for hunt, but this does help on how to use the fetchAndLock API better so it’s very useful for me and others.