sezaru
I have the following scenario I want to solve with Oban:
A job will be created that will fetch a list of users
For that list, I want to chunk them and create a job for each job that will do send an email for the users.
This seems like a good use of workflows, basically I start my workflow with just one job:
Workflow.new()
|> Workflow.add(:chunk_investors, new_chunk_investors(buy_lists_ids, actor_id))
|> Oban.insert_all()
Now, inside the job, I will have the chunked lists and append jobs to the workflow, something like this:
@job [queue: :email]
def chunk_investors(buy_lists_ids, actor_id) do
lists = ...
{:ok, jobs} = Workflow.all_jobs(job)
lists
Enum.with_index()
Enum.reduce(Workflow.append(jobs), fn {list, index}, jobs ->
Workflow.add("send_email_#{index}", new_send_email(list, actor_id))
end)
|> Oban.insert_all()
:ok
end
I think this should probably work fine, the issue is that i don’t have the job struct to call Workflow.all_jobs when my job is decorated… Is there some way to retrieve it so this can work? If not, is there some other way to recover the workflow?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Marked As Solved- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
sorenone
Thank you for posting here on the forum!
For your scenario:
There’s a new current_job/0 function in Pro v1.6 for this exact purpose! From within your decorated job:
There’s also an add_many/4 function to streamline adding a group of jobs as a sub-workflow and add_cascade/4 for the new cascade-mode.
Also Liked
sorenone
It’s still an rc because want people to be aware of the changes when they upgrade and to be sure to do the db migrations. We use it in production, others do, too.
If you proceed, you’ll surely follow the upgrade guide and let us know if you have any issues.