Skip to content

Configuration

actor-ts uses HOCON for configuration — the same superset of JSON that Akka uses, with substitutions, durations, sizes, and includes. Three layers, resolved highest-first:

  1. Constructor arguments to ActorSystem.create(name, settings) — explicit code overrides.
  2. User configapplication.conf at the project root, or an explicit path via configFile, or an inline config object in the settings.
  3. Reference defaults — bundled in the framework as REFERENCE_CONF (see src/config/reference.ts).

Anything not specified in layers 1 or 2 falls through to the reference default.

actor-ts {
system { name = "my-app" }
logger { level = "info" }
dispatcher {
default = "immediate" # immediate | microtask | throughput
throughput = 16
}
cluster {
gossip-interval = 1s
seed-retry-interval = 3s
failure-detector {
heartbeat-interval = 500ms
unreachable-after = 2s
down-after = 5s
}
}
remote {
transport = "tcp"
tcp {
hostname = "0.0.0.0"
port = ${?ACTOR_TS_PORT} # env-var substitution; falls back to default
}
max-frame-size = 1M
}
persistence {
journal { plugin = "actor-ts.persistence.journal.in-memory" }
snapshot-store { plugin = "actor-ts.persistence.snapshot-store.in-memory" }
}
sharding {
number-of-shards = 64
rebalance-interval = 2s
remember-entities = false
}
}

Place this at the project root. The framework auto-loads it on ActorSystem.create.

KeyDefaultPurpose
system.name"default"System name — used in actor paths and cluster identification.
KeyDefaultPurpose
logger.level"info"One of debug / info / warn / error / off.
KeyDefaultPurpose
dispatcher.default"immediate"immediate (default) / microtask / throughput.
dispatcher.throughput16Messages a ThroughputDispatcher processes before yielding.
KeyDefaultPurpose
cluster.gossip-interval1sHow often gossip is exchanged with a random peer.
cluster.seed-retry-interval3sHow often to retry seed connections during join.
cluster.leader-election"lowest-address"Strategy for picking a new leader.
cluster.failure-detector.heartbeat-interval500msHow often heartbeats are sent.
cluster.failure-detector.unreachable-after2sSuspicion threshold for unreachable status.
cluster.failure-detector.down-after5sSuspicion threshold for forced down.
KeyDefaultPurpose
remote.transport"tcp"Currently only "tcp" and the in-memory test transport.
remote.tcp.hostname"0.0.0.0"TCP bind address.
remote.tcp.port2552TCP bind port.
remote.tls.enabledfalseToggle TLS on the cluster transport.
remote.max-frame-size1MMaximum allowed wire frame size.
KeyDefaultPurpose
http.backend"fastify"One of fastify / bun / express.
http.shutdown-grace-period5sTime to drain in-flight requests on shutdown.
KeyDefaultPurpose
persistence.journal.plugin"...in-memory"Fully-qualified key to the journal’s config.
persistence.snapshot-store.plugin"...in-memory"Fully-qualified key to the snapshot store’s config.
persistence.recovery.mode"eager"eager (default) — replay all events on preStart. parallel — replay in chunks.

The plugin keys point to another config section that holds that plugin’s settings. E.g. actor-ts.persistence.journal.sqlite contains the SQLite journal’s path, pragmas, etc. See each journal page in Persistence for the per-plugin keys.

KeyDefaultPurpose
sharding.number-of-shards64How many shards the entity space is divided into.
sharding.rebalance-interval2sGap between coordinator-driven rebalance passes.
sharding.hand-off-timeout10sHow long to wait for HandOffComplete before force-reallocating.
sharding.remember-entitiesfalsePersist the set of active entity IDs.
sharding.passivation-idle0msAuto-passivate an entity after this idle window. 0 = disabled.
KeyDefaultPurpose
coordinated-shutdown.default-phase-timeout5sDefault per-phase timeout.
coordinated-shutdown.terminate-actor-systemtrueWhether to call system.terminate() in the final phase.
coordinated-shutdown.exit-jvmfalseWhether to call process.exit() after shutdown.
KeyDefaultPurpose
worker.count"auto"Number of workers — "auto" uses navigator.hardwareConcurrency.
worker.restart-policy"on-failure"always / on-failure / never.

Each broker actor reads from its own subtree. See the per-protocol pages for the keys:

SubtreePage
io.broker.kafkaKafka
io.broker.mqttMQTT
io.broker.amqpAMQP
io.broker.natsNATS
io.broker.jetstreamJetStream (same page, JetStream variant)
io.broker.redis-streamsRedis Streams
io.broker.grpc.{client,server}gRPC
io.broker.websocketWebSocket client
io.broker.sseSSE
io.broker.tcpTCP
io.broker.udpUDP
gossip-interval = 1s # 1000 ms
unreachable-after = 2.5s # 2500 ms
down-after = 5000ms # explicit ms
gc-cadence = 10m # minutes
ttl = 24h # hours

Recognized units: ns, us, ms, s, m, h, d.

max-frame-size = 1M # 1 048 576 bytes
buffer = 64K
heap = 2G

Recognized units: B, K, M, G, T — binary (1024) by default.

port = ${?ACTOR_TS_PORT} # use env if set, else fall through
log-level = ${?LOG_LEVEL} # same
api-key = ${API_KEY} # required — error if env is unset
fallback-port = ${?ENV_PORT}
fallback-port = ${fallback-port:-2552} # default-if-empty syntax

Use ${?ENV} for optional, ${ENV} for required.

include "shared-cluster.conf"
actor-ts.cluster.failure-detector.heartbeat-interval = 250ms

Loads shared-cluster.conf and overlays your local section on top.

const system = ActorSystem.create('my-app', {
config: {
'actor-ts.cluster.gossip-interval': '500ms',
},
});
// Inside an actor / extension:
const cfg = system.config;
const interval = cfg.getDuration('actor-ts.cluster.gossip-interval');
// → 500 (in ms)

The Config interface has typed getters: getString, getNumber, getBoolean, getDuration, getSize, getStringList, etc. Missing keys throw unless you check first with hasPath.

1. REFERENCE_CONF ← bundled defaults
2. application.conf (CWD) ← project root, auto-loaded
3. file path from `configFile` setting ← explicit override
4. ENV var ACTOR_TS_CONFIG ← path or inline HOCON
5. constructor `config: { ... }` ← code-level override
6. constructor field overrides ← explicit fields beat config
(logLevel, dispatcher, scheduler, …)

Each layer overlays on top of the previous. Layer 6 (constructor fields) always wins for the fields it covers; everything else flows through the HOCON merge.