File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 2727 ([^Duration duration pred]
2828 (Workflow/await duration (->supplier pred))))
2929
30+ (defn sleep
31+ " Efficiently parks the workflow for 'duration'"
32+ [^Duration duration]
33+ (Workflow/sleep duration))
34+
3035(defmacro defworkflow
3136 "
3237Defines a new workflow, similar to defn, expecting a 2-arity parameter list and body. Should evaluate to something
Original file line number Diff line number Diff line change 1+ ; ; Copyright © 2022 Manetu, Inc. All rights reserved
2+
3+ (ns temporal.test.sleep
4+ (:require [clojure.test :refer :all ]
5+ [taoensso.timbre :as log]
6+ [temporal.client.core :as c]
7+ [temporal.workflow :refer [defworkflow ] :as w]
8+ [temporal.test.utils :as t])
9+ (:import [java.time Duration]))
10+
11+ (use-fixtures :once t/wrap-service)
12+
13+ (defworkflow sleep-workflow
14+ [ctx {:keys [signals] :as args}]
15+ (log/info " sleep-workflow:" args)
16+ (w/sleep (Duration/ofSeconds 1 ))
17+ :ok )
18+
19+ (defn create []
20+ (let [wf (c/create-workflow (t/get-client ) sleep-workflow {:task-queue t/task-queue})]
21+ (c/start wf nil )
22+ wf))
23+
24+ (deftest the-test
25+ (testing " Verifies that signals may timeout properly"
26+ (let [wf (create )]
27+ (is (= @(c/get-result wf) :ok )))))
You can’t perform that action at this time.
0 commit comments