Skip to content

Commit f509bb0

Browse files
committed
complete all netflix samples
1 parent e8107c2 commit f509bb0

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

rxjava/expt1/src/expt1/core.clj

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
(ns expt1.core
2-
(:require [expt1.k2 :as k2])
2+
(:require [expt1.k2 :as k2]
3+
; [expt1.k1 :as k1]
4+
)
35
(:import [rx Observable Observer Subscription]
46
[rx.util AtomicObservableSubscription])
57
(:gen-class)
68
)
79

10+
11+
812
(defn -main
913
"I don't do a whole lot ... yet."
1014
[& args]
@@ -20,4 +24,27 @@
2024
(Observable/filter (fn [x] (= 0 (mod x 2))))
2125
(.subscribe println))
2226

27+
(.subscribe (k2/customObservableBlocking) println)
28+
29+
(.subscribe (k2/customObservableNonBlocking) println)
30+
31+
(->
32+
(k2/fetchWikipediaArticleAsynchronously ["Tiger" "Elephant"])
33+
(.subscribe #(println "--- Article ---\n" (subs (:body %) 0 125) "..."))
34+
)
35+
36+
(k2/simpleComposition)
37+
38+
(->
39+
(k2/getVideoForUser 12345 78965)
40+
(.subscribe
41+
(fn [datum] (println "--- Object ---\n" datum))
42+
(fn [exception] (println "--- Error ---\n" exception))
43+
(fn [] (println "--- Completed ---\n"))))
44+
45+
(->
46+
(k2/fetchWikipediaArticleAsynchronouslyWithErrorHandling ["Tiger" "NonExistentTitle" "Elephant"])
47+
(.subscribe #(println "--- Article ---\n" (subs (:body %) 0 125) "...")
48+
#(println "--- Error ---\n" (.getMessage %))
49+
))
2350
)

rxjava/expt1/src/expt1/k1.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(ns expt1.k1.core ;;rx-clj.core
1+
(ns expt1.k1 ;;rx-clj.core
22
(:refer-clojure :exclude [concat cons drop drop-while empty
33
filter first future
44
interpose into keep keep-indexed last
@@ -83,6 +83,8 @@
8383
(.unsubscribe s)
8484
s)
8585

86+
;;; bbeckman this would not load
87+
8688
(defn ^Subscription subscription
8789
"Create a new subscription that calls the given no-arg handler function"
8890
[handler]

rxjava/expt1/src/expt1/k3.clj

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)