Package tweetoscope.tweetsProxy
Class TwitterProxy
java.lang.Object
tweetoscope.tweetsProducer.TweetsProducer
tweetoscope.tweetsProducer.OfflineTweetsProducer
tweetoscope.tweetsProxy.TwitterProxy
- All Implemented Interfaces:
Runnable
,Flow.Publisher<com.twitter.clientlib.model.Tweet>
Acts as a proxy to Twitter changes web stream for a Kafka-based
application: Reads the stream of Tweets flow and writes them to
a Kafka topic.
-
Field Summary
Fields inherited from class tweetoscope.tweetsProducer.TweetsProducer
subscribers
-
Constructor Summary
ConstructorDescriptionTwitterProxy
(String fileName, String bootstrapServers, String topicName) Class constructor : Creates a web stream listener and a Kafka producer, the producer publishes to the Kafka topic the events received from the web stream (until it is interrupted). -
Method Summary
Methods inherited from class tweetoscope.tweetsProducer.TweetsProducer
subscribe
-
Constructor Details
-
TwitterProxy
Class constructor : Creates a web stream listener and a Kafka producer, the producer publishes to the Kafka topic the events received from the web stream (until it is interrupted).- Parameters:
fileName
- name of the file containing tweets to send to kafka.bootstrapServers
- Kafka servers.topicName
- Tweets topic name.
-
-
Method Details
-
main
Creates the proxy (provoking infinite execution).- Parameters:
args
- first argument is the file name, second argument is a list of Kafka bootstrap servers, third argument is the name of the destination Kafka topic
-
run
public void run() -
onClosed
Called if session closed.- Throws:
Exception
- exception in case of error.
-
onOpen
Called if session opened.- Throws:
Exception
- throw exception.
-
onComment
Called if comment.- Parameters:
comment
- Commentaire reçu (n'importe quelle ligne commençant par deux-points).- Throws:
Exception
- Exception en cas d'erreur.
-
onError
Called if error.- Parameters:
t
- represent error.
-