Class TwitterSampledStreamReaderSingleton

All Implemented Interfaces:
Runnable, Flow.Publisher<com.twitter.clientlib.model.Tweet>

public final class TwitterSampledStreamReaderSingleton extends OnlineTweetsProducer
Connects to the Twitter sampled stream endpoint that delivers a roughly 1% random sample of publicly available Tweets in read-time. As Tweets are received, Tweet subscribers are notified.

Requires the BEARER_TOKEN environment variable to be set to connect to the Twitter API endpoint.

To ensure only one instance of this class is created at any time, it implements the Singleton pattern.

Author:
Virginie Galtier