Scrivio Interview library
LeadershipPrincipal7 min read · updated 12 November 2026

Your company implements long-running business processes with home-grown command queues and state machines. Should it adopt a durable workflow engine across teams? Frame the multi-year decision.

Home-grown command queues and state machines give full control, but each team ends up re-implementing retries, timers, visibility into running processes and versioning of in-flight instances, often badly. A durable workflow engine provides durable execution, history and tooling out of the box, at the price of licences or operations, lock-in, a learning curve and, for some engines, rules such as deterministic workflow code that constrain how teams write logic. The multi-year decision should start with the most critical or complex processes, measure effort and incidents against the home-grown baseline, and plan versioning of in-flight workflows and an exit strategy before broad adoption.

Why this question is asked

Long-running business processes, such as onboarding a customer over two weeks, settling a trade, or handling an insurance claim with human approvals, are where distributed systems hurt most. Every team that builds one from queues and state tables discovers the same problems: what happens to step 4 when the service restarts, how to wait three days for a document, how to see where 2,000 stuck orders are, and how to change the process while 50,000 instances are in the middle of it. Interviewers ask senior leaders this because the choice shapes how dozens of teams build software for years, and because both doing nothing and adopting an engine everywhere are expensive mistakes. In this answer, we will look at what home-grown solutions really cost, what an engine gives and takes, how deterministic execution changes coding, how to adopt in stages with measurement, and how to plan for versioning and exit.

1What the Home-Grown Approach Really Costs

A home-grown process engine usually starts as a status column and a scheduled job. It is fully under our control, uses technology everyone knows, and has no licence. Over time, though, each team adds the same capabilities: retries with backoff for each step, timers for waits and deadlines, compensation when a later step fails, a way to see the state of one instance, a way to find all instances stuck in a state, and migration code when the process changes. Each team writes them differently, and each one becomes a source of incidents.

The cost is spread out, which makes it easy to miss. Before deciding, we gather it: how many services implement their own workflow logic, how many engineer-weeks a year go into it, and how many incidents in the last year traced back to lost timers, double execution, stuck instances or broken migrations. Numbers like twelve services, three engineers' worth of maintenance and nine incidents make the conversation concrete.

2What a Durable Workflow Engine Gives and Takes

A durable workflow engine runs a process definition and records every step it takes in persistent history. If a worker crashes, the engine resumes the process from the last recorded step on another worker, which is what durable execution means. Timers of days or months are first-class, retries are configuration, and there is tooling to search running instances, see their history and retry or cancel them. Examples include Temporal, which uses workflows written as code, and Camunda, which uses BPMN process models; check each product's current editions and licensing.

The engine also takes something. It is a new platform to run, either a cluster we operate or a hosted service we pay for. Workflows written against its SDK or model are hard to move to another engine, which is lock-in. Teams must learn a new programming model, and debugging moves partly into the engine's tools. And the engine becomes critical infrastructure: if it is down, every process that depends on it stops progressing.

Home-grown queues and state machines versus a workflow engine
ConcernHome-grownDurable workflow engine
Retries and timersEach team builds themBuilt in, configurable
Visibility of running instancesAd hoc queries and logsHistory and search UI
Versioning in-flight processesCustom migration codeEngine support, still needs discipline
Operations and costOur existing databaseCluster to run or service to pay for
Coding constraintsNone beyond our ownSome engines need deterministic code
Lock-inOnly to our own codeProcess code tied to the engine's SDK

3How Deterministic Workflow Code Changes Coding

Some engines, Temporal among them, recover a workflow by replaying its history through the workflow code: the code runs again from the start, and the engine feeds it the recorded results of past steps instead of executing them again. For that to work, the workflow code must make exactly the same decisions on every replay. So it must not read the system clock, generate random numbers, call external services or use threads directly; those things go into activities, separate steps whose results are recorded, or through the SDK's own replacements, such as its time and sleep functions.

This is a real constraint on how teams write logic. A developer who calls LocalDate.now() or a REST client inside the workflow code will create a bug that only shows up on replay, often weeks later. Engines provide tests that replay recorded histories against new code to catch this, and training must cover it explicitly. Model-based engines like BPMN-driven ones have different constraints, such as keeping logic in service tasks and expressions, so whichever engine we evaluate, we should understand its programming model before committing.

Java
// Inside a replay-based workflow: deterministic
public void onboard(Customer c) {
activities.createAccount(c); // recorded; not re-executed on replay
Workflow.sleep(Duration.ofDays(3)); // durable timer from the SDK
if (!activities.documentsReceived(c.id())) { // result read from history on replay
activities.sendReminder(c);
}
}
// Not allowed in workflow code: LocalDate.now(), new Random(), restClient.get(...), new Thread(...)

4Adopting in Stages and Measuring

We would not mandate an engine across all teams at once. Instead, we pick one or two processes that are both critical and complex, the ones with long waits, many steps and the worst incident history, and build them on the chosen engine with a team willing to learn it. For a quarter or two we measure the same things we measured for the home-grown baseline: engineering effort to build and change the process, incidents, time to diagnose a stuck instance, and the operational effort of the engine itself.

If the numbers show a clear gain, we build a paved road: a platform team owns the engine, publishes templates, libraries and runbooks, and other teams adopt it when they build or significantly change a long-running process. Simple processes, a status column with two transitions, stay as they are, because an engine would add more than it saves. If the numbers do not show a gain, we stop, and what we learned improves the home-grown approach instead.

Step throughMulti-year adoption path
  1. Measure today's costServices, effort, incidents per year
  2. Pick one or two critical, complex processesLong waits, many steps, bad incident history
  3. Build them on the engineOne team, with replay tests
  4. Do effort and incidents improve?Compared with the baseline
    YesPlatform team and paved roadNoStop, improve home-grown tooling
  5. Teams adopt when building or changing processesSimple ones stay as they are
  6. Review yearlyCost, lock-in, exit plan

6 steps in order. Play them, or step through them one at a time.

5Planning for Versioning and Exit Before Adoption

Two questions must be answered before the first production workflow, not after. The first is versioning. Processes run for weeks, so at any time thousands of instances are in the middle of the old definition when we deploy a new one. We need a policy: let running instances finish on the old version and start new ones on the new version, or patch running instances with the engine's versioning features, or migrate them explicitly. Each engine has mechanisms for this, and teams must practise them early, because getting it wrong breaks in-flight customer processes.

The second is exit. Lock-in is acceptable if it is a choice we understand. We keep business logic in plain activities or services that do not depend on the engine, so the workflow layer is mostly orchestration, which is the part we would rewrite if we moved. We check that history and state can be exported, we watch the vendor's licensing and support terms, and we write down what moving away would cost. Revisiting that estimate each year keeps the commitment honest.

6Follow-up questions

Would you allow teams to keep their own state machines?

Yes, for simple and short processes where a status column and a transition table are clearer than an engine. The guidance is about which problems belong on the engine, long-running, multi-step, timer-heavy processes, not about banning state machines.

Who should own the workflow engine?

A platform team, with an on-call rotation and service-level objectives, because the engine becomes shared critical infrastructure. Product teams own their workflows and activities, just as they own their services on a shared Kubernetes cluster.

How do you convince teams that have working home-grown solutions?

With their own numbers and a successful pilot, not a mandate. When a team sees that the pilot process needed no custom retry, timer or migration code and had fewer incidents, the engine competes on merit. Teams with simple, stable processes may reasonably never move.

7Conclusion

In this answer, we saw that home-grown command queues give control but make every team re-implement retries, timers, visibility and versioning of running processes, while a durable workflow engine provides durable execution, history and tooling at the cost of operations or licences, lock-in, a learning curve and, for replay-based engines, deterministic workflow code. The decision should start with the most critical and complex processes, be measured against today's effort and incidents, and include a versioning policy for in-flight workflows and an exit strategy before broad adoption.

What to say in the interviewAbout 100 seconds aloud

Open with

I would frame this as a multi-year platform decision and start with data. Home-grown command queues and state machines give us full control and no new infrastructure, but every team ends up rebuilding retries, timers, compensation, visibility into running instances and migration of in-flight processes, and that hidden cost shows up as engineering time and incidents.

Then, if they want more

So first I would measure it: how many services do this, how much effort goes into it, how many incidents came from lost timers or stuck instances. A durable workflow engine gives durable execution, step history, built-in timers and retries, and tooling to find and fix stuck instances.

The costs are real too: a cluster to run or a service to pay for, lock-in to its SDK or model, a learning curve, and for replay-based engines like Temporal, a rule that workflow code must be deterministic, so no clock, randomness or I/O directly in workflow code, which teams need training and replay tests for.

I would not mandate it everywhere. I would pick one or two of the most critical, complex processes, build them on the engine, and compare effort and incidents with the baseline over a couple of quarters.

If it clearly wins, a platform team builds a paved road and teams adopt it when they build or change long-running processes, while simple ones stay as they are. And before the first production workflow, I would settle how we version in-flight workflows and keep business logic in engine-independent activities, so we have a realistic exit strategy.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Your company implements long-running business processes with home-grown command queues...": https://scrivio-interview-library.netlify.app/java/behavioral-patterns/d7ac56efd6/