Skip to main content

Application

View as Markdown

An Application is the service you build with the Dex SDK. Its Workers run your Flows, and its Client starts and calls them.

Flows and the Registry

A Registry holds your Flow definitions. Build the Worker and the Client from the same Registry. The Worker runs those definitions. The Client uses them to encode start input and RPC arguments and to decode results.

Worker

A Worker runs the Steps and RPC handlers of the Flows in its Registry. It connects out to Dex Server and pulls its work. So it needs no inbound port or Worker address.

Each stream runs one task at a time. Workers and the task queue has the settings.

A Worker serves one task queue. An available Worker on that queue that supports the Flow type and Step can take its next eligible task. Dex Server holds Flow state across Worker restarts. Keep state that a later Step needs in Dex, not in Worker memory.

A Worker runs inside your service process, or as its own deployment when Steps need different scaling or release timing than your API.

Client

Your handlers use a Client to start Flows, call their RPCs, read Attributes, wait for progress, and stop a Flow. It encodes with the Flow's registered definition, so a service that only starts Flows still registers them. The Flow writes its own state, and a Client changes it through RPCs. A handler only starts the Flow or calls an RPC, and a Step writes your database row, because writing a row and then starting a Flow is not atomic.

Guarantees

  • A successful start returns only after Dex stores it. The run continues even if your process exits.
  • An Attribute read returns saved values from one moment.
  • A wait reads the Flow's saved state. It can also end before its condition holds; see Wait timeouts and limits.
  • A cancel, fail, or terminate stop closes the run. Once the stop commits, Dex starts no new Steps or cleanup for that run.

Client APIs describes each call, with a runnable example.

Blob cache

Dex sends a large value, such as a big Attribute, as a reference. Each process keeps the values it downloads in a local blob cache. The Client and the Worker of one process can share one blob cache, as they share the Registry. A shared cache can reuse a value while it is cached. Blob cache says how to open one.

Next