Patterns for resilient service boundaries, message contracts, and operationally useful NestJS microservices.
Microservices become useful when boundaries map to ownership and failure modes. Message contracts, idempotent consumers, retry behavior, and observability matter more than the transport itself.
Consumers should be idempotent and explicit about retryable work.
@MessagePattern("invoice.created")
async handleInvoiceCreated(event: InvoiceCreatedEvent) {
const exists = await this.inbox.seen(event.id);
if (exists) return;
await this.billing.applyInvoice(event);
await this.inbox.markSeen(event.id);
}nestjsmicroserviceskafkaarchitecture