DEV Community

GoWind Dev
GoWind Dev

Posted on

Workflow orchestration in Go: four engines behind one plugin layer - and when a Redis queue is all you need

Part 23 of the GoWind series, and the last stop on the framework internals tour (YAML assembly → custom plugins → AI plugins → this).

"Add workflow orchestration" is where Go backends usually pick a religion early and pay for it late. The go-wind-plugins workflow layer takes a different position: support four engines behind one plugin boundary, and make the lightweight case explicitly lightweight.

The four engines

Adapter Import path Framework
Temporal plugins/workflow/temporal temporal.io/sdk — long-running orchestration, state persistence
Argo plugins/workflow/argo Argo Workflows REST API
Conductor plugins/workflow/conductor conductor-sdk/conductor-go
GoWorkflows plugins/workflow/goworkflows cschleiden/go-workflows

Same design rule as the AI plugins: the four engines' parameter/return types are mutually incompatible, so the shared surface stays a minimal interface —

type Client interface {
    Close() error
}

type Worker interface {
    Stop()        // stop polling
    IsRunning() bool
}
Enter fullscreen mode Exit fullscreen mode

— and engine-specific operations (start, cancel, signal, query) stay on the concrete types where they belong. No fake common denominator that fits nobody.

Temporal in practice

The recommended path for order flows and approvals. Configured from YAML like every plugin in the framework:

workflow:
  temporal:
    host_port: "localhost:7233"
    namespace: "default"
    task_queue: "my-queue"
    worker:
      max_concurrent_activities: 10
      max_concurrent_workflows: 5
Enter fullscreen mode Exit fullscreen mode

A workflow is plain Go — activities as functions:

func OrderWorkflow(ctx workflow.Context, order Order) error {
    var inventoryOK bool
    workflow.ExecuteActivity(ctx, DeductInventoryActivity, order).Get(ctx, &inventoryOK)
    if !inventoryOK {
        return errors.New("inventory deduction failed")
    }
    var paymentResult PaymentResult
    workflow.ExecuteActivity(ctx, PaymentActivity, order).Get(ctx, &paymentResult)
    workflow.ExecuteActivity(ctx, SendConfirmationActivity, order).Get(ctx, nil)
    return nil
}
Enter fullscreen mode Exit fullscreen mode

Workers register workflows+activities and start; triggering supports both async (Execute → workflowID) and sync (ExecuteSync), with signal / query / cancel / describe on the client. WithTracing() wires native OpenTelemetry tracing — which the framework's observability plugins correlate with the rest of the service's traces.

The other three adapters stay closer to their ecosystems: Argo speaks the REST API (Submit / Get / Suspend / Resume / Terminate) for the Kubernetes-CRD world; Conductor and GoWorkflows expose start/create, pause/resume/cancel, signal, and worker registration.

And when you don't need an engine at all

The layer's most useful opinion is the one it doesn't include: Asynq — async tasks on a Redis queue — lives under transport, not workflow/, because cron jobs and task queues aren't workflow engines and pretending otherwise is how teams end up running Temporal for a nightly email:

srv := asynqPlugin.NewServer(
    asynqPlugin.WithRedisAddress("127.0.0.1:6379"),
    asynqPlugin.WithConcurrency(10),
    asynqPlugin.WithCodec("json"),
)

// Generic registration with automatic payload deserialization
_ = asynqPlugin.RegisterSubscriber[emailPayload](
    srv, "email:send",
    func(taskType string, msg *emailPayload) error {
        return sendEmail(msg.To, msg.Subject, msg.Body)
    },
)

// One-off and periodic tasks
_, _ = srv.NewTask("email:send", &emailPayload{})
_, _ = srv.NewPeriodicTask("0 9 * * *", "email:send", &emailPayload{})
Enter fullscreen mode Exit fullscreen mode

The selection table

Scenario Recommendation Why
Async tasks Asynq (transport) lightweight; Redis is enough
Scheduled cron Cron (transport) robfig/cron expressions
Order flows / approvals Temporal state persistence, compensating rollback, long-running
Batch processing Asynq priority queues
Cross-service orchestration Temporal / Conductor global orchestration
K8s batch Argo native CRD ecosystem

The honest summary: most "we need workflow" moments are Asynq moments; the long-running, compensable, multi-day ones are Temporal moments; the Kubernetes-batch ones are Argo moments. The plugin layer keeps the door open to all three without rewriting your service, because the engine sits behind a boundary your business code barely touches.


That closes the framework internals arc — and the 23-post series spans the full GoWind family: framework, open-source products, commercial products, and the Rust sibling. If one of these posts solved something for you, the issues tabs at github.com/tx7do are where the useful feedback goes.

Top comments (0)