Config seed provider
此内容尚不支持你的语言。
ConfigSeedProvider returns a static list of seed addresses
— from a constructor argument or environment variables. No
discovery logic; what you configure is what you get.
import { Cluster, ClusterOptions, ConfigSeedProvider, ConfigSeedProviderOptions } from 'actor-ts';
const configSeedProviderOptions = ConfigSeedProviderOptions.create() .withSeeds(['10.0.0.5:2552', '10.0.0.6:2552', '10.0.0.7:2552']) .withSystemName('my-app');const provider = new ConfigSeedProvider( configSeedProviderOptions,);
const seeds = await provider.lookup();const clusterOptions = ClusterOptions.create() .withHost(host) .withPort(port) .withSeeds(seeds);await Cluster.join(system, clusterOptions);The simplest provider for the simplest case.
Configuration
Section titled “Configuration”type ConfigSeedProviderOptionsType = { seeds: string[]; // "system@host:port" or "host:port" systemName: string; // default system name for seeds omitting it};Two ways to specify:
// Explicit:const configSeedProviderOptions = ConfigSeedProviderOptions.create() .withSeeds(['10.0.0.5:2552', '10.0.0.6:2552']) .withSystemName('my-app');new ConfigSeedProvider( configSeedProviderOptions,);
// From env (CSV):seedsFromEnv('ACTOR_TS_SEEDS', 'my-app');// where ACTOR_TS_SEEDS='10.0.0.5:2552,10.0.0.6:2552'Pick whichever fits your deployment pattern. Env vars are typical for containerized deployments where the list comes from a config map / orchestrator.
When to use it
Section titled “When to use it”Three good fits:
- Docker Compose — known service names + ports;
actor-ts-1:2552,actor-ts-2:2552,actor-ts-3:2552in env. - VMs with fixed IPs — three production VMs, each with a stable address.
- Tests — known peer addresses inline in test setup.
When NOT
Section titled “When NOT”Where to next
Section titled “Where to next”- Discovery overview — the bigger picture.
- DNS seed provider — for DNS-based discovery.
- Kubernetes API seed provider — for K8s deployments.
- Aggregate seed provider — combine multiple providers.
- Joining and seeds — how seeds are consumed by the cluster bootstrap.
