Skip to content

Add close() to Emitter interface and Tracker #357

@mscwilson

Description

A Snowplow interface 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 BatchEmitter is the default Emitter; it uses a thread pool to asynchronously process and send events. The threads are non-daemon threads. To safely shut down the tracker, the BatchEmitter contains a close() method, which attempts to send all remaining buffered events and then terminates the thread pool executor.

The close() method is not part of the Emitter interface. This makes it clumsy and non-intuitive to stop a tracker:

BatchEmitter emitter = (BatchEmitter) tracker.getEmitter();
emitter.close();

Ideally it would be:

tracker.getEmitter().close();

Or even better:

tracker.close();

This can be achieved by updating the Emitter interface and also adding close() to the Tracker class.

Metadata

Metadata

Labels

category:breaking_changeA breaking change will be introduced if this issue is completed.status:completedCompleted - but might not be released yet.type:enhancementNew features or improvements to existing features.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions