Herald
Standalone — usable in any Node project, no
@warlock.js/corerequired.
@warlock.js/herald is the messaging layer. Publish events from one
service, consume them in workers anywhere on your network, do
request-and-respond over a queue for cross-service RPC without HTTP
overhead. Backed by RabbitMQ (amqplib).
Connect once, grab a typed channel, and you have a publish→consume loop — manual-ack by default, so a crash redelivers the message instead of dropping it:
import { connectToBroker, herald } from "@warlock.js/herald";
type UserCreated = { userId: number; email: string };
await connectToBroker({ driver: "rabbitmq", host: "localhost", port: 5672 });
const channel = herald().channel<UserCreated>("user.created");
// Consumer — runs in a worker anywhere on your networkawait channel.subscribe(async (message, ctx) => { await sendWelcomeEmail(message.payload.email); await ctx.ack();});
// Producerawait channel.publish({ userId: 1, email: "ada@example.com" });The queue is asserted lazily on first access — you never pre-create one. Need a reply instead of fire-and-forget? Herald does typed request-and-respond (RPC over the queue, with a timeout) too.
What it gives you
Section titled “What it gives you”- Publish — fire-and-forget events with a typed payload.
- Consume — long-running worker subscribers with backpressure and acknowledgement semantics.
- Request + respond — RPC over the queue: send a message, await a typed reply, with timeout. Great for service-to-service calls when HTTP isn’t the right tool.
- Routing — exchanges, routing keys, dead-letter queues.
- Reconnection + retry — survives broker restarts gracefully.
Read by intent
Section titled “Read by intent”- New here? Start with getting-started / introduction, then your first message for a publish→consume loop end to end.
- Mental model — what brokers, channels, and the message envelope map to in RabbitMQ: essentials / the messaging model.
- Production setup — connection options, multi-broker, reconnects, graceful shutdown: essentials / connection and config.
- Task guides — publish, consume, request and respond, errors and retries.
- Recipes — dead-letter queue, end to end.
- Reference — every public export in the API reference.
Source: @warlock.js/herald/.