-
Notifications
You must be signed in to change notification settings - Fork 35
Add close() to Emitter interface and Tracker #357
Copy link
Copy link
Closed
Labels
category:breaking_changeA breaking change will be introduced if this issue is completed.A breaking change will be introduced if this issue is completed.status:completedCompleted - but might not be released yet.Completed - but might not be released yet.type:enhancementNew features or improvements to existing features.New features or improvements to existing features.
Milestone
Metadata
Metadata
Assignees
Labels
category:breaking_changeA breaking change will be introduced if this issue is completed.A breaking change will be introduced if this issue is completed.status:completedCompleted - but might not be released yet.Completed - but might not be released yet.type:enhancementNew features or improvements to existing features.New features or improvements to existing features.
A
Snowplowinterface was added in #340. This class contains static methods for creating and managing Trackers, without needing to create other objects first. The internal classes of the tracker - BatchEmitter or Subject - can be created behind-the-scenes, or via Configuration objects.The
BatchEmitteris the defaultEmitter; it uses a thread pool to asynchronously process and send events. The threads are non-daemon threads. To safely shut down the tracker, theBatchEmittercontains aclose()method, which attempts to send all remaining buffered events and then terminates the thread pool executor.The
close()method is not part of theEmitterinterface. This makes it clumsy and non-intuitive to stop a tracker:Ideally it would be:
Or even better:
This can be achieved by updating the
Emitterinterface and also addingclose()to the Tracker class.