[Java] Can't add second consumer on same JsonPointer after events were consumed
ffendt opened this issue · 0 comments
Currently, the client doesn't allow a second consumer for the same selection after already events were consumed. Here's how to reproduce the problem:
- Register consumer A with id "a-id" (+
startConsumption()
for the client) - Generate events -> A consumes the events
- Register consumer B with id "b-id"
- Still only A consumes events
- Cancel consumer A -> B will now consume events.
Desired functionality:
In step 4, A and B should both consume the same events.
Current implementation:
The client uses the DefaultRegistry
class for storing for which JsonPointerSelection
which consumers get called. The first time the registry is asked if a JsonPointer
matches any of the known selections, it will add the result to a cache. If it is asked again for the same JsonPointer
, it will simply return the result of the cache. Since the cache isn't cleared on new registrations, consumer B will never show up in the cached result.
Possible Fix:
This can be fixed by clearing the cache when a new consumer is registered.