Package kafka

Class Kafka


  • public class Kafka
    extends java.lang.Object
    Class to connect to Apache Kafka server.
    • Constructor Summary

      Constructors 
      Constructor Description
      Kafka()  
    • Method Summary

      Modifier and Type Method Description
      static void connectStream​(java.lang.String bearerToken)
      This method calls the filtered stream endpoint and streams Tweets from it.
      static void setupRules​(java.lang.String bearerToken, java.util.Map<java.lang.String,​java.lang.String> rules)
      Helper method to setup rules before streaming data.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Kafka

        public Kafka()
    • Method Detail

      • connectStream

        public static void connectStream​(java.lang.String bearerToken)
                                  throws java.net.URISyntaxException,
                                         java.io.IOException
        This method calls the filtered stream endpoint and streams Tweets from it.
        Parameters:
        bearerToken - Authorization token to connect to Twitter API.
        Throws:
        java.net.URISyntaxException - during the http request.
        java.io.IOException - trying to get the content from the stream or to read the line.
      • setupRules

        public static void setupRules​(java.lang.String bearerToken,
                                      java.util.Map<java.lang.String,​java.lang.String> rules)
                               throws java.io.IOException,
                                      java.net.URISyntaxException
        Helper method to setup rules before streaming data.
        Parameters:
        bearerToken - Authorization token to connect to Twitter API.
        rules - Rules for streaming data.
        Throws:
        java.net.URISyntaxException - during the http request.
        java.io.IOException - trying to get the content from the request.