This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-10-15
Channels
- # admin-announcements (3)
- # aws (1)
- # beginners (1)
- # boot (73)
- # cider (1)
- # clojure (146)
- # clojure-japan (4)
- # clojure-nl (3)
- # clojure-russia (90)
- # clojurescript (72)
- # community-development (17)
- # core-async (10)
- # cursive (60)
- # datomic (15)
- # devcards (7)
- # emacs (5)
- # events (5)
- # hoplon (3)
- # instaparse (3)
- # ldnclj (48)
- # leiningen (5)
- # off-topic (27)
- # om (120)
- # onyx (31)
- # re-frame (7)
- # reagent (7)
- # ring-swagger (17)
- # yada (3)
First off, everything (mostly!) makes sense, but I am having trouble figuring out how to get channels in and out of jobs
All the examples I see just (def in-chan (chan capacity))
in the same ns as the lifecycles onyx is using for this job
First, if I am submitting many jobs, won't all the messages for all the jobs come through that channel? How do I access just the messages for a particular job?
It seems I would need an input and output channel for each job, so I am wondering how this works in practice
When you start a job and inject the channels into the lifecycle with the core.async
plugin, those channels will be input’s and outputs for that specific job
If you want to run multiple jobs, you need multiple channels
@gardnervickers Yes, that is what I was hoping
Hold on a second, it’s been a while since I used onyx. Let me verify my assumptions
So do you want to run two sets of channels in the same job or two seperate jobs?
Yea, I remember that was a sticking point for me early on too
essentially you need a lifecycle map for each job
(def lifecycles
[{:lifecycle/task :in
:lifecycle/calls :flat-workflow.core/in-calls}
{:lifecycle/task :in
:lifecycle/calls :onyx.plugin.core-async/reader-calls}
{:lifecycle/task :out
:lifecycle/calls :flat-workflow.core/out-calls}
{:lifecycle/task :out
:lifecycle/calls :onyx.plugin.core-async/writer-calls}])
where in-calls and out-calls are maps that exist somewhere in some namespace on the running JVM.
those maps are where you put your ref's
you cant submit the pure ref’s
you’d have to define maps for each job
so like in the sample, where
(def in-calls
{:lifecycle/before-task-start inject-in-ch})
(def out-calls
{:lifecycle/before-task-start inject-out-ch})
you have that, you’d have to make two of themin-calls1
and in-calls2
then you have to create a seperate lifecycles
map
(def lifecycles
[{:lifecycle/task :in
:lifecycle/calls :flat-workflow.core/in-calls}
{:lifecycle/task :in
:lifecycle/calls :onyx.plugin.core-async/reader-calls}
{:lifecycle/task :out
:lifecycle/calls :flat-workflow.core/out-calls}
{:lifecycle/task :out
:lifecycle/calls :onyx.plugin.core-async/writer-calls}])
for each job