Skip to main content

Migrating from Temporal

FluidGrids durable functions follow Temporal's programming model: deterministic workflow functions replayed from an event history, activities for side effects, signals, timers and child workflows. FluidGrids runs that model as a managed service, on the same engine as its visual builder, so there is no server or worker fleet to operate for managed runs. Existing Temporal code does not run unchanged, because the SDKs differ, but porting is mostly mechanical.

Concept map​

TemporalFluidGrids
Workflow definition (async function in the TypeScript SDK)workflow(name, options, async (ctx, input) => …)
proxyActivities and an activity callctx.run(nodeOperation, options) for a FluidGrids node, or ctx.activity(declaration, options) for your own code on a self-hosted worker
Activity implementations, Worker.createimplementActivity, Worker.create from @fluidgrids/workflows/worker, or fluidgrids worker run
Task queuesTask queues: managed, or self-hosted queues your workers serve
defineQuery, defineUpdate, setHandlerdefineQuery, defineUpdate, ctx.handleQuery, ctx.handleUpdate
Workflow resetfluidgrids runs reset, or Reset on the run page
Search attributes, upsertSearchAttributesSearch attributes, ctx.upsertSearchAttributes
Schedules (overlap policies, catch-up window, backfill)A Schedule Trigger with a schedule policy
Asynchronous activity completioncompleteAsync() and fluidgrids activities complete
Batch operationsBatch in the Runs list, fluidgrids runs batch
sleep, conditionctx.sleep, ctx.condition
defineSignal, setHandler, conditiondefineSignal, ctx.onSignal or ctx.signalReceived
executeChild, startChild, ParentClosePolicyctx.child, ctx.startChild, parentClosePolicy
patched, deprecatePatchctx.patched, ctx.deprecatePatch
CancellationScope, isCancellationctx.cancellationScope, ctx.nonCancellable, ctx.isCancellation
continueAsNewctx.continueAsNew
ApplicationFailureApplicationError with a FluidGrids error type
uuid4, deterministic Date and Math.randomctx.uuid(), ctx.now(), ctx.random()
TestWorkflowEnvironment, Worker.runReplayHistoryTestWorkflowEnvironment, replay, fluidgrids replay
NamespaceWorkspace
Worker build idsThe build id of the version's code bundle
Temporal UI event historyThe run's History tab
temporal CLIfluidgrids CLI

Porting a workflow​

  1. Create a project with fluidgrids init --lang ts and run fluidgrids codegen.
  2. Move the workflow function into workflows/<key>.ts, wrapped in workflow(). Replace the module-level SDK functions with the ctx methods above.
  3. For each activity, check whether a FluidGrids node already does the job (HTTP Request, Data Table, Slack, Stripe and the rest of the Node Store). Call it with ctx.run; credentials then live in FluidGrids connections, not in your code. Keep the rest as user activities: declare them with declareActivity, call them with ctx.activity, and serve them from a self-hosted worker on a task queue of your own.
  4. Write tests with @fluidgrids/workflows/testing, then fluidgrids push.

Differences to plan for​

  • Workflow code is sandboxed. Managed workflow code has no network, clock or filesystem, and may import only pure-JavaScript ES modules.
  • Each version keeps its own code. A run always continues on the bundle it started with, so you rarely need patched(); use it for hotfixes of in-flight runs.
  • Retries use FluidGrids error types. Retry policies take maxRetries, retryDelay, backoffMultiplier, maxDelay and the error types to retry or not.
  • No separate schedule objects. Schedules are triggers on the workflow and are versioned with it, with the same overlap and catch-up policies.
  • TypeScript and Python. Durable functions are written in TypeScript or Python; there are no Go, Java or .NET SDKs.
  • No self-hosted server. FluidGrids is the service. Workers are the only part that runs on your infrastructure, and they connect outbound only.

Workflow ids are unique per workflow key within a workspace, not per namespace.

Next steps​