@yourrentals/cloudevent-publisher-nestjs
v0.7.2
Published
This library defines a JS library to publish messages to the message bus.
Downloads
215
Keywords
Readme
@yourrentals/cloudevent-publisher-nestjs
This library defines a JS library to publish messages to the message bus.
Installation
yarn add @yourrentals/cloudevent-publisher-nestjs
Usage
import { CloudeventPublisherModule } from '@yourrentals/cloudevent-publisher-nestjs';
@Injectable()
export class FeatureService {
constructor(private readonly publisher: CloudEventPublisherService) {}
async doSomething() {
await this.publisher.publish('my-event', {
data: {
foo: 'bar',
},
});
}
}
@Module({
imports: [
CloudeventPublisherModule.forFeature({
topics: [
{
eventType: 'my-event',
topicArn: 'arn:aws:sns:eu-west-1:123456789012:my-topic',
},
],
}),
],
providers: [FeatureService],
})
export class FeatureModule {}
@Module({
imports: [
CloudeventPublisherModule.forRoot({
source: 'publisher',
}),
FeatureModule,
],
})
export class AppModule {}