Limit concurrency in a message worker
Stop a worker pulling more messages than it can process, so a burst waits at the broker where an operator can see it instead of inside your process.
How-to › Section 14
The services behind an API: choosing an architecture, message-based services and pattern routing, entity persistence, providers for external APIs, and HTTP or edge exposure, with Seneca as one option beside NestJS, Moleculer, tRPC, NATS, Temporal and Hono.
6 guides in 4 topics. Every guide compares its approaches and shows the output its commands printed.
Services where everything is a message: Seneca (actions by pattern, plugins and priors, transports and seneca-mesh, this branch owns transports, seneca-user, seneca-petition, structured message tracing, seneca-msg-test, seneca-doc, seneca-repl), @voxgig/system and create-system (services loaded by convention, model-driven CLI adding entity, srv, msg, field, env), and ordu for ordered task pipelines, against NestJS modules, Moleculer actions, tRPC routers, Fastify plus a message bus, NATS services and Temporal.
Stop a worker pulling more messages than it can process, so a burst waits at the broker where an operator can see it instead of inside your process.
Turn an improvised startup function into an ordered list of named steps that can stop the boot and say why, and pin readiness to the store actually being open.
Dispatch by matching properties inside a service: patrun (most-specific match wins, trie keyed by sorted property names, gex globs, add, find, list, remove), bloomrun, router libraries, rules engines (json-rules-engine, Drools), decision tables (the decide utility) and plain switch or if chains, with benchmarks for your message mix.
Replace a switch on message.type with a Map of handlers, so that adding one is a registration call, unknown types reach a fallback, and prototype keys stay out.
Route messages in a Python worker with the match statement, using mapping and class patterns, guards, and a fallback, tested over a table of messages.
Entity data in services: seneca-entity and its store plugins (Postgres, Mongo, DynamoDB, seneca-d1-store on Cloudflare) against Prisma, Drizzle, TypeORM, Knex and raw drivers; the repository pattern, store-agnostic tests, migrations, multi-store setups.
Decide who mints an entity id, the service or the database, then choose a sequence, UUIDv4, UUIDv7, ULID, or nanoid by measuring index locality and order.
HTTP and edge fronts for message services: seneca-gateway-* (including seneca-gateway-cloudflare) and seneca-web-adapter-express against Hono on Cloudflare Workers, Express and Fastify routers, API gateways (Kong, APISIX) and serverless adapters; auth at the gateway, running the same service locally and at the edge.
Write the HTTP front once in the fetch shape, give Node a twenty-line adapter, and run one request suite against both fronts and a stand-in that has no Node globals.
Retries, timeouts, pagination and auth are the same problems in every client. Voxgig generates them from your OpenAPI description, in 23 languages, from one model.