Is there a way to “return” a value from a sub workflow? Suppose I have a sub workflow that creates a db record and I need to access this record ID in a downstream job in the parent workflow. Here’s an example I have that attempts to recover it through recorded values but with no success:
defmodule ChildJob do
use Oban.Pro.Worker, recorded: true
alias Oban.Pro.Workflow
def workflow() do
Workflow.new()
|> Workflow.add(:child, new(%{}))
end
@impl true
def process(job) do
{:ok, "secret_id"}
end
end
defmodule ParentJob do
use Oban.Pro.Worker, recorded: true
alias Oban.Pro.Workflow
def workflow() do
Workflow.new()
|> Workflow.add_workflow(:a, ChildJob.workflow())
|> Workflow.add(:b, new(%{}), deps: :a)
end
@impl true
def process(job) do
Workflow.all_recorded(job) |> IO.inspect()
:ok
end
end
iex(3)> ParentJob.workflow() |> Oban.insert_all()
%{"b" => nil}






















