Ash Oban trigger after action
@Rebecca Le continuing from ash oban channel;
getting back to this, I have
and
super simple, just figuring it out. But nothing happens when I run
super simple, just figuring it out. But nothing happens when I run
update_about_me
function regarding oban trigger š¤
I was expecting that action my_action
was run in an oban job.
Am I still missing something?11 Replies
change set_attribute(:about_me, "Test")
missing change
?okay, added it, still nothing
just a sec, let me try more thoroughly
wait it's good now it seems, awesome šø
of course it was just a silly mistake from my end š¤
š it happens
one more question: what is
worker_read_action
? I can't find anything in the docs on AshOban/Oban hexdocs searching it.
I'm wondering, if the first action updates a resource, could I get that updated resource in the triggered action? š¤
I made a custom action and in input I found params: %{"primary_key" => %{"id" => "e5e821fb-43d9-4244-8072-ae5dea8efcf7"}}
So I guess I could fetch it with that š¤
but I'm wondering if the result of the first action can be the input of the triggered actionI'm not sure I understand.
The way jobs are triggered is that they are triggered by storing the primary key
It's more likely I don't understand. š so if I understand correctly: first action is done, triggers oban action, oban action get's the id, does a read (presumably related to
worker_read_action
and then the second oban action is executed. so does the worker make the read and sends that to the action?
I'm trying to understand what goes on behind the scenes. Because I turned my oban triggered update action into a generic action and found those params but not the whole resource struct. š¤ Now I could fetch my resource with input.params["primary_key"]["id"]
, would that be the ash way?Yeah, so for generic actions, its your job to fetch the record.
For update actions, it happens automatically as needed for the update action.
ah, cool, thanks for the info š
We insert an oban job w/ that primary key in an after action hook, and oban triggers the job
So if I want to do an LLM prompt that does translation for instance but also process the response so that I may store the translations through AshTrans on the same resource, could I do that through an update action? š¤
You could store the original message with the thing that is triggering
and then the update action could translate it and store the translation