Working with multiple Oban queue

I have 2 worker MyApp.Worker which has use Oban.Worker, queue: :app_queue

and another worker MyFile.Worker which has use Oban.Worker, queue: :file_queue.

In MyApp.Worker, I have a list as

list = [%User{id: 1,name: “James”},%User{id: 2,name: “Jack”},%User{id: 3,name: “Andy”}]

and I want to add this list to queue file_queue , so that I can pick the content of the list from MyFile.Worker. In this way, both the Workers can work in isolation.

Can anyone help me with this?..
Thanks in advance :grinning:

Perhaps I’m misunderstanding your question, but this seems like a very straightforward use of Oban:

[%User{id: 1}, %User{id: 2}, %User{id: 3}]
|> Enum.map(&MyFile.Worker.new(%{id: &1.id}))
|> Oban.insert_all()

Note that only the user id is passed through because args are serialized as JSON and you can’t simply serialize a struct.

2 Likes