@hile/micro-dynamic-configs
Persist runtime config in Redis and publish typed changes through @hile/micro.Choose This Package When
Use When
Use the message packages for request/response messaging over WebSocket, process IPC, worker threads, file-system message handlers, service discovery, streaming RPC, and registry-backed pub/sub.Do Not Use When
- Do not use
stream()for normal single-result calls. - Do not rely on message IDs for business idempotency. They are transport IDs.
- Do not bypass
defineMessage()for file-loaded handlers.
Install
Imports
Copy-Paste Example
Message handler file:More Examples
Streaming handler:request() returns a Promise<T>. Await it directly.
Runtime And Lifecycle Notes
MessageLoadermaps*.msg.*files to routes using@hile/loader.MessageLoader.dispatch(path, data, extras?)invokes the matched handler.MessageModem._send()returns aPromise.MessageModem._stream()returns a NodeReadablein object mode.- A stream request requires
exec()to return an async iterable. Application.call(namespace, url, data, options?)returns a promise.Application.stream(namespace, url, data, options?)returns a readable stream.Application.publish(topic, payload)returns an object withupdate()andunpublish().Application.subscribe(topic, callback)returns an unsubscribe function.Registrystores service addresses and retained config/topic state under~/.registry.
Anti-Patterns
- Appending a secondary response getter to
client.request('/x', data) - Returning a plain object from a handler called through
stream(). - Using pub/sub as a durable queue.
- Forgetting to register
shutdown(await app.listen(...)).
Verification Checklist
- Message files default-export
defineMessage(...). - RPC callers use
await app.call(...). - Streaming handlers are async generators.
- Registry is started before application nodes need discovery.
- Micro apps use stable namespaces and advertise reachable hosts.
Related Recipes
Runtime Dynamic Config
Complete Example
Package-Local AI Guide
This package also shipsAI.md in npm so agents can read accurate examples after installation.