Documentation previewThese docs are actively being built. Some pages may change as the framework and examples are finalized.
Skip to content

Runtime Processes

Runtime processes are the long-running execution surfaces of an App.

Each runtime starts through a command and participates in App startup and shutdown.

Common Processes

ProcessBuilt binaryDevelopment alias
Combined runtime./bin/app runforj app
HTTP./bin/app apiforj api
Queue workers./bin/app workerforj worker
Scheduler./bin/app schedulerforj scheduler

Both forms start the same App command. Use the built binary form for deployment and process supervision. Use the forj <command> development surface when you want GoForj to refresh generated code before running the App command. Use forj run <command> when you need to force App command execution explicitly.

Combined Runtime

run starts enabled runtimes together.

The runtime host cancels sibling runtimes when one fails and returns the first runtime failure with the runtime name.

Split Runtime

Split runtime commands are useful when production needs:

  • independent scaling
  • separate restart policy
  • scheduler singleton control
  • queue worker resource isolation
  • source-specific metrics scrape targets

Shutdown

Shutdown should be bounded and predictable.

Common variables:

text
APP_SHUTDOWN_TIMEOUT=30s
QUEUE_SHUTDOWN_TIMEOUT=10s
SCHEDULER_SUBPROCESS_SHUTDOWN_TIMEOUT=90s

Common Mistakes

Common mistakes

  • Do not start long-running work from constructors.
  • Do not make business behavior depend on process topology.
  • Do not assume worker shutdown is instant when jobs are in flight.
  • Do not scale scheduler processes like stateless HTTP processes without locks or singleton control.

Next Steps