Differences between Oban Workflows and Batches

I’m trying to wrap my head around some Oban workflows. You can group multiple jobs under a single workflow (I assume they share the same workflow ID). From the point of observability, is this any different than batching a group of jobs under a shared batch ID? From db queries, we can see which jobs were grouped together in either case… workflows allow us to specify dependencies… is there any other fundamental difference between workflows and batches? Is a workflow with no dependencies more or less the same as a batch? Is a batch basically a workflow with no special options?

Workflows are about dependencies between jobs, like a directed graph. Batches are about events when job states change. The purpose of a batch isn’t just to group the jobs, but to have handler callback jobs when all jobs are attempted, completed, etc.

A workflow with no dependencies is less useful than a batch, because there aren’t any callbacks. Workflows are entirely meant for dependencies between jobs.

There’s an older, slightly outdated, Composing Jobs with Oban Pro article that outlines the differences. That article is becoming a guide in the upcoming Pro v1.5, and the differences should be much clearer.

1 Like