Ash FrameworkAF
Ash Framework6mo ago
10 replies
Shahryar

Is It Possible to Track Create and Update Operations at the Domain Level for AshOban?

Hi, sorry, Is it possible to track
create
and
update
operations at the domain level of all resources under this domain, so that whenever such actions occur, their information is sent to AshOban for further processing?

Something like

defmodule MishkaCms.Runtime do
  use Ash.Domain,
    otp_app: :mishka_cms
...

  oban do
    triggers do
  
      trigger :runtime_preload_compiler do
      
        action [:create, :update]
        worker_module_name MyObanModuleWorker.RuntimeCompiler
      end
    end
  end

...
end


The data for example:

resource: xxx
action: create
data: xxx # after saved in database
Solution
Yeah nothing builtin to help you do that. Your best bet is likely to have custom Oban jobs for the compilation you want to do and then to use global changes to start those jobs in the same transaction on each resource.
Was this page helpful?