 
 (defn reduce-by-key [dstream f]
   "Call reduceByKey on dstream of type JavaDStream or JavaPairDStream"
-  (if (instance? org.apache.spark.streaming.api.java.JavaDStream dstream)
+  (if (instance? JavaDStream dstream)
     ;; JavaDStream doesn't have a .reduceByKey so cast to JavaPairDStream first
     (-> dstream
       (.mapToPair (pair-function identity))

                                     function2
                                     pair-function
                                     void-function]])
  (:import [org.apache.spark.streaming.api.java JavaStreamingContext]
           [org.apache.spark.streaming.kafka KafkaUtils]
           [org.apache.spark.streaming Duration Time]))


    (streaming-context conf duration)))

(defmulti checkpoint (fn [context arg] (class arg)))
(defmethod checkpoint String [streaming-context path] (.checkpoint streaming-context path))
(defmethod checkpoint Long [dstream interval] (.checkpoint dstream (duration interval)))

(defn text-file-stream [context file-path]
  (.textFileStream context file-path))
