Package tweetoscope
Class HashtagExtractor
java.lang.Object
tweetoscope.HashtagExtractor
- All Implemented Interfaces:
Flow.Publisher<String>
,Flow.Subscriber<com.twitter.clientlib.model.Tweet>
public class HashtagExtractor
extends Object
implements Flow.Subscriber<com.twitter.clientlib.model.Tweet>, Flow.Publisher<String>
Reacts to the reception of a new Tweet by parsing its text to look for
hashtags. For each hashtag found, if any, notifies its subscribers. Tweets
are received from the upstream component
via Java Flow.
Hashtags are passed downstream to the
via Java Flow.
invalid reference
distributed_tweetoscope.tweetsFilter.TweetFilter
invalid reference
distributed_tweetoscope.HashtagCounter
- Author:
- Virginie Galtier
-
Field Summary
Modifier and TypeFieldDescriptionprotected List
<Flow.Subscriber<? super String>> List of objects to notify when a hashtag is extracted (downstream component = HashtagCounter) -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
onNext
(com.twitter.clientlib.model.Tweet tweet) Triggered when the upstream component (TweetFilter) passes a new Tweet via Java Flowvoid
onSubscribe
(Flow.Subscription subscription) void
subscribe
(Flow.Subscriber<? super String> subscriber)
-
Field Details
-
subscribers
List of objects to notify when a hashtag is extracted (downstream component = HashtagCounter)
-
-
Constructor Details
-
HashtagExtractor
public HashtagExtractor()
-
-
Method Details
-
subscribe
- Specified by:
subscribe
in interfaceFlow.Publisher<String>
-
onNext
public void onNext(com.twitter.clientlib.model.Tweet tweet) Triggered when the upstream component (TweetFilter) passes a new Tweet via Java Flow- Specified by:
onNext
in interfaceFlow.Subscriber<com.twitter.clientlib.model.Tweet>
-
onSubscribe
- Specified by:
onSubscribe
in interfaceFlow.Subscriber<com.twitter.clientlib.model.Tweet>
-
onError
- Specified by:
onError
in interfaceFlow.Subscriber<com.twitter.clientlib.model.Tweet>
-
onComplete
public void onComplete()- Specified by:
onComplete
in interfaceFlow.Subscriber<com.twitter.clientlib.model.Tweet>
-