Managing Service Orchestration

1. Orchestration Pattern

AspectDetail
Central BrainOrchestrator decides next step
vs ChoreographyExplicit control flow vs emergent
ProsVisibility, easier change, single audit
ConsSingle point of complexity if not careful

2. Process Manager Pattern

AspectDetail
DefinitionStateful component managing long-running business process
Driven ByEvents; emits commands
PersistsWorkflow state, history, timers
ToolsCamunda, Temporal, Conductor

3. Routing Slip Pattern

AspectDetail
MechanismMessage carries list of steps; each service does its work and forwards
DynamicSlip can be customized per message
No Central CoordinatorState travels with message

4. Centralized Workflow Pattern

AspectDetail
DefinitionOne workflow engine governs many processes across the org
ProsReuse engine, common observability, BPM tooling
ConsBecomes shared platform; team contention; vendor lock-in

5. Workflow State Machine Pattern

ConceptDetail
StatesValid lifecycle stages
TransitionsTriggered by events/commands
GuardsConditions to allow transition
ActionsSide-effects on entry/exit
PersistenceState + version stored per instance

6. Compensation Workflow Pattern

AspectDetail
DefinitionWorkflow that runs on failure to undo prior steps
OrderReverse of forward steps (LIFO)
TrackedEach forward step records its compensation
Re-runnableEach compensation idempotent

7. Long-Running Transaction Pattern

PropertyDetail
DurationHours, days, weeks (e.g., loan approval)
StatePersisted; survives restarts
TimersSchedule waits, deadlines, escalations
EnginesTemporal, Camunda, Step Functions, Cadence

Example: Temporal Workflow

@WorkflowInterface
public interface OnboardingWorkflow {
    @WorkflowMethod
    OnboardingResult run(OnboardingRequest req);
}

public class OnboardingWorkflowImpl implements OnboardingWorkflow {
    public OnboardingResult run(OnboardingRequest req) {
        identity.verify(req);
        Workflow.sleep(Duration.ofDays(2)); // wait for KYC
        kyc.runChecks(req);
        return account.create(req);
    }
}

8. Pipeline Pattern

AspectDetail
DefinitionSequence of processing stages; output of stage N → input of N+1
ImplementationTopic per stage, microservice consumer per stage
ProsIndependent scaling; clear stage boundaries
ExamplesImage processing, ETL, video transcoding

9. Orchestration Engine Pattern

CapabilityDetail
Workflow DSLBPMN, code-as-workflow, JSON DSL
State PersistenceDurable storage of running workflows
Timers / SignalsWait for time / external event
VisibilityUI for inspection, retry, terminate
Worker ModelWorkers poll engine for tasks

10. Process Choreography Pattern

AspectDetail
DefinitionDecentralized; each service knows its inputs/outputs
CoordinationVia events through broker
VisibilityAchieved via tracing + event monitoring tools
Best ForDomain-aligned events; loose coupling priority