March 18, 2026
Use @nestjs/microservices with Redis/RabbitMQ; orchestrate via Saga class. Compensating actions on failure; Saga.of().step().commit/compensate().
Example:-
Code
Saga.of({ createOrder: (ctx) => ({ order: ctx.data }), decreaseStock: (ctx) => ({ stock: ctx.order }), // compensate: refund }).commit();
5 min read