Skip to content

Commit 9490251

Browse files
tmoermanghaskins
authored andcommitted
Query documentation.
Signed-off-by: Thomas Moerman <[email protected]>
1 parent 0a8d1ad commit 9490251

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

doc/workflows.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ A temporal query is similar to a temporal signal, both are messages sent to a ru
174174
The difference is that a signal intends to change the behaviour of the Workflow, whereas a query intends to inspect the current state of the Workflow.
175175
Querying the state of a Workflow implies that the Workflow must maintain state while running, typically in a clojure [atom](https://clojuredocs.org/clojure.core/atom).
176176

177-
#### Registering a query handler
177+
#### Registering a Query handler
178178

179179
To enable querying a Workflow, you may use [temporal.workflow/register-query-handler!](https://cljdoc.org/d/io.github.manetu/temporal-sdk/CURRENT/api/temporal.workflow#register-query-handler!).
180180
The query handler is a function that has a reference to the Workflow state, usually by closing over it. It interprets the query and returns a response.
@@ -186,16 +186,14 @@ The query handler is a function that has a reference to the Workflow state, usua
186186
(register-query-handler! (fn [query-type args]
187187
(when (= query-type :my-query)
188188
(get-in @state [:path :to :answer]))))
189-
190-
;; e.g. react to signals (perhaps in a loop), update the state atom
191-
189+
;; e.g. react to signals (perhaps in a loop), updating the state atom
192190
))
193191
```
194192

195-
#### Querying a running workflow
193+
#### Querying a Workflow
196194

197195
You may query a Workflow with [temporal.client.core/query](https://cljdoc.org/d/io.github.manetu/temporal-sdk/CURRENT/api/temporal.client.core#query).
198-
A query consists of a `query-type` (keyword) and possibly some `args`.
196+
A query consists of a `query-type` (keyword) and possibly some `args` (any serializable data structure).
199197

200198
```clojure
201199
(query workflow :my-query {:foo "bar"})

0 commit comments

Comments
 (0)