@lindorm-io/koa-amqp
v0.1.11
Published
AMQP middleware for @lindorm-io/koa applications
Downloads
13
Readme
@lindorm-io/koa-amqp
AMQP middleware for @lindorm-io/koa applications
Installation
npm install --save @lindorm-io/koa-amqp
Peer Dependencies
This package has the following peer dependencies:
Usage
Amqp Connection Middleware
import amqp from "amqplib";
import { AmqpConnection } from "@lindorm-io/amqp";
const amqpConnection = new AmqpConnection({ ...options });
koaApp.addMiddleware(amqpMiddleware(amqpConnection));
const amqp: amqp = await ctx.connection.amqp.connect();
Repository Middleware
koaApp.addMiddleware(messageBusMiddleware(YourMessageBus));
await ctx.messageBus.publish([yourMessage]);