← All Articles

Oban Pro v1.5 Launch Week—Day 3

Oban Pro v1.5 Launch Week—Day 3

Welcome to the third day of Pro v1.5 Launch Week!

Today, we’re focused on a single, powerful new feature. One that simplifies how applications can define, configure, and compose jobs.

Job Decorator

The new Oban.Pro.Decorator module converts functions into Oban jobs with a teeny-tiny @job true annotation. Decorated functions, such as those in contexts or other non-worker modules, can be executed as fully fledged background jobs with retries, priority, scheduling, uniqueness, and all the other guarantees you have come to expect from Oban jobs.

See the decorator in action:

Decorated jobs are a convenient way to run functions in the background, but there’s abundance within.

Advanced Decorators

The @job decorator also supports most standard Job options, validated at compile time. As expected, the options can be overridden at runtime through an additional generated clause. Along with generated insert_ functions, there’s also a new_ variant that be used to build up job changesets for bulk insert, and a relay_ variant that operates like a distributed async/await.

Any Elixir term may be passed as an argument, not just JSON encodable values. That enables passing native data-types such as tuples, keywords, or structs that can’t easily be used in regular jobs.

Finally, the generated functions also respect patterns and guards, so you can write assertive clauses that defend against bad inputs or break logic into multiple clauses.

Check it out:

Imagine the possibilities when you combine the flexibility of decorated functions with distributed execution with FLAME. Dramatic pause… You can take a standard Elixir function and make it asynchronous, persistent, and scale it elastically with a few lines of code 🪄🧙. More on that soon…

More Launch Week

  • Day 1 — Unified Migrations, Preemptive Chaining, and Worker Aliases
  • Day 2 — Enhanced Uniqueness and Distributed PostgreSQL
  • Day 4 — Overhauled Batches and Improved Workflows
  • Day 5 — Hybrid Compositions and Release Day

See you again tomorrow!


As usual, if you have any questions or comments, ask in the Elixir Forum or the #oban channel on Elixir Slack. For future announcements and insight into what we're working on next, subscribe to our newsletter.