diff options
| author | Ivar Refsdal <ivar.refsdal@nsd.no> | 2021-09-23 14:33:09 +0200 |
|---|---|---|
| committer | Ivar Refsdal <ivar.refsdal@nsd.no> | 2021-09-23 14:33:09 +0200 |
| commit | 74ef39824b6eb0f8f69720e2f6209ec3de0cefbe (patch) | |
| tree | 12f72cf9a26f0e1139e6eaaafd056d51660865fe /README.md | |
| parent | Release 0.2.22 (diff) | |
| download | fiinha-74ef39824b6eb0f8f69720e2f6209ec3de0cefbe.tar.gz fiinha-74ef39824b6eb0f8f69720e2f6209ec3de0cefbe.tar.xz | |
Document ordering and depends on as well as add license
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 38 |
1 files changed, 31 insertions, 7 deletions
@@ -239,6 +239,37 @@ You may invoke `yq/add-consumer!` and `yq/init!` on a live system as you like. If you change `:pool-size` or `:poll-delay` you will have to `(yq/stop!)` and `(yq/start!)` to make changes take effect. +## Queue job dependencies and ordering + +It is possible to specify that one queue job must wait for another queue +job to complete before it will be executed: + +```clojure +@(d/transact conn [(yq/put :a + ; Payload: + {:id "a1"} + ; Job options: + {:id "a1"})]) + +@(d/transact conn [(yq/put :b + ; Payload: + {:id "b1"} + ; Jobs options: + {:depends-on [:a "a1"]})]) +``` + +Here queue job `b1` will not execute before `:a1` is `:done`. + +Note that queue-name plus `:id` in job options must be an unique value. +In the example above that means `:a` plus `a1` must be unique. + +When specifying `:depends-on`, the job must at least exist in the database, +otherwise `yq/put` will throw an exception. + +Other than this there is no attempt at ordering the execution of queue jobs. +In fact the opposite is done in the poller to guard against the case that a single failing queue job +could effectively take down the entire retry polling job. + # Testing For testing you will probably want determinism over an extra threadpool @@ -273,13 +304,6 @@ by using the test queue: ``` -### Ordering - -There is no attempt at ordering the execution of queue jobs. -In fact the opposite is done to guard against the case that a single failing queue job -could effectively take down the entire retry polling job. - - ## License Copyright © 2021 Ivar Refsdal |
