0.0.10 • Published 4 years ago
@ccmos/nestjs-amqplib v0.0.10
Description
Nest framework TypeScript starter repository.
Installation
$ npm install @ccmos/nestjs-amqplib
Quick Start
// import
import { Module } from '@nestjs/common';
import { AmqplibModule } from '@ccmos/nestjs-amqplib';
@Module({
imports: [
AmqplibModule.forRoot({
url: 'amqp://localhost'
}),
],
})
export class AppModule {}
// service
import { Injectable } from '@nestjs/common';
import { AmqplibService } from '@ccmos/nestjs-amqplib';
@Injectable()
export class MyService {
constructor(
private amqplib: AmqplibService,
) { }
async helloWorld() {
await amqplib.sendToQueue('testQueue', { hello: 'queue' });
await service.publish('testExchange', 'testRoutingKey', {
hello: 'exchange',
});
}
}
License
Nest is MIT licensed.