Package Exports
- @twaice/nestjs-kinesis-producer
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@twaice/nestjs-kinesis-producer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
NestJS Kinesis Producer
Description
Kinesis Producer library for NestJS based on Node-Kinesis-Producer.
Installation
$ npm install @twaice/nestjs-kinesis-producerUsage
- Register Module
KinesisProducerModule.registerfor synchronous configuration orKinesisProducerModule.registerAsyncAsynchronous configuration.
import { HttpModule } from '@nestjs/common';
import { KinesisProducerModule } from '@twaice/nestjs-kinesis-producer';
@Module({
imports: [
KinesisProducerModule.registerAsync({
useFactory: (configService: ConfigService) => {
return {
streamName: configService.get<string>('streamName')
};
},
inject: [ConfigService],
}),
],
controllers: [SampleController],
providers: [SampleService],
exports: [SampleService],
})
export class SampleModule {}- Use module in your service
import { KinesisProducerService } from '@twaice/nestjs-kinesis-producer';
@Injectable()
export class KinesisAggregatorPublisher {
constructor(private readonly kinesisPublisher: KinesisProducerService) {
}
async putDataIntoKinesis() {
await this.kinesisPublisher.getProducer().putRecords([{
Data: 'test-record'
}]);
}
}