Skip to content

Commit

Permalink
upgrade to 0.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
MarchLiu committed Aug 13, 2019
1 parent 02c277b commit 9d410d2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ For Leiningen:

## What's New

- 0.2.2 add actor of without name
- 0.2.1 improve for scala partial function constructors
- 0.2.0 add scala partial function implementing use clojure multiFn
- 0.1.11 rename config-value and config-value-to-clj to config-value-from and config-value-to
Expand Down
6 changes: 3 additions & 3 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject liu.mars/akka-clojure "0.2.1"
(defproject liu.mars/akka-clojure "0.2.2"
:description "akka toolkit for clojure programmer"
:url "https://github.com/MarchLiu/akka-clojure"
:license {:name "Eclipse Public License"
Expand All @@ -7,10 +7,10 @@
:java-source-paths ["src/main/java"]
:test-paths ["src/test/clojure"]
:dependencies [[org.clojure/clojure "1.10.0"]
[com.typesafe.akka/akka-actor_2.12 "2.5.22"]
[com.typesafe.akka/akka-actor_2.12 "2.5.23"]
[liu.mars/jaskell "0.2.7"]]
:deploy-repositories [["releases" :clojars]
["snapshots" :clojars]]
:profiles {:test {:dependencies [[com.typesafe.akka/akka-testkit_2.12 "2.5.22"]]
:profiles {:test {:dependencies [[com.typesafe.akka/akka-testkit_2.12 "2.5.23"]]
:plugins [[lein-test-report-junit-xml "0.2.0"]]
:test-report-junit-xml {:output-dir "target/surefire-reports"}}})
32 changes: 32 additions & 0 deletions src/main/clojure/liu/mars/actor.clj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@
(let [timeout (Duration/ofSeconds 1)]
(? actor message timeout))))

(defn ask
"just same as ? "
([actor message ^Duration timeout]
(future (-> actor
(Patterns/ask message timeout)
(.toCompletableFuture)
(.get))))
([actor message]
(let [timeout (Duration/ofSeconds 1)]
(? actor message timeout))))

(defn ??
([actor message ^Duration timeout]
@(? actor message timeout))
Expand All @@ -34,13 +45,33 @@
([actor message sender dispatcher]
(?-> actor message sender dispatcher (Duration/ofSeconds 1))))

(defn forward
"just same as ?->"
([^AbstractActor actor message sender ^ExecutionContext context ^Duration timeout]
(-> actor
(Patterns/ask message timeout)
(.toCompletableFuture)
(Patterns/pipe context)
(.to sender)))
([actor message sender dispatcher]
(?-> actor message sender dispatcher (Duration/ofSeconds 1))))

(defn !
([actor message sender]
(.tell actor message sender))
([actor message]
(.tell actor message (ActorRef/noSender))))

(defn tell
"just same as ! "
([actor message sender]
(.tell actor message sender))
([actor message]
(.tell actor message (ActorRef/noSender))))

(defn actor-of
([^ActorSystem system ^MultiFn receiver]
(.actorOf system (ClojureActor/props receiver)))
([^ActorSystem system ^MultiFn receiver ^String name]
(.actorOf system (ClojureActor/props receiver) name))
([^ActorSystem system ^IFn init ^MultiFn receiver ^String name]
Expand Down Expand Up @@ -83,3 +114,4 @@
(.getValue path)
.unwrapped
keywordize-it)))

0 comments on commit 9d410d2

Please sign in to comment.