You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering how the team envisioned a configurable event bus that can delegate to an external pub/sub and queueing mechanism like AMQP, Amazon SQS/SNS, Google Cloud Pub/Sub (I believe it's queued internally).
I was planning to just extend the event bus and override certain methods. However, I believe if we can instead allow injection of a publisher/subscriber in the event bus, it would allow users to do as they please on the event handling.
export class EventBus extends ObservableBus<IEvent> implements IEventBus {
publish<T extends IEvent>(event: T) {
if(this.eventPublisher){
...publish to external queue...
} else {
this.subject$.next(event);
}
}
bind<T extends IEvent>(handler: IEventHandler<IEvent>, name: string) {
const stream$ = name ? this.ofEventName(name) : this.subject$;
stream$.subscribe(event => handler.handle(event));
if(this.eventSubscriber){
...subscribe a worker to the external queue...
...once a message is consumed call "this.subject$.next(event);"...
}
}
}
Instead of the clunky if-else blocks, we can have a "DefaultPublisher" and "DefaultSubscriber" that immediately consumes a published messaged and thus, immediately triggering this.subject$.next(event) similar to how it is right now.
Any thoughts?
The text was updated successfully, but these errors were encountered:
I'm currently testing some changes for this on my fork but when I tried using it in the example, I'm getting the error Error: Cannot find module 'multer'.
This is after I tried installing @types/node on nest-cqrs since running npm run compile fails due to
node_modules/@nestjs/common/interfaces/external/multer-options.interface.d.ts(1,23): error TS2688: Cannot find type definition file for 'node'.
node_modules/@nestjs/common/interfaces/external/multer-options.interface.d.ts(46,17): error TS2304: Cannot find name 'Buffer'.
It's actually the first time I've tried using local typescript modules; always been a leecher. Any tips on how you guys test this locally?
I was wondering how the team envisioned a configurable event bus that can delegate to an external pub/sub and queueing mechanism like AMQP, Amazon SQS/SNS, Google Cloud Pub/Sub (I believe it's queued internally).
I was planning to just extend the event bus and override certain methods. However, I believe if we can instead allow injection of a publisher/subscriber in the event bus, it would allow users to do as they please on the event handling.
Instead of the clunky if-else blocks, we can have a "DefaultPublisher" and "DefaultSubscriber" that immediately consumes a published messaged and thus, immediately triggering
this.subject$.next(event)
similar to how it is right now.Any thoughts?
The text was updated successfully, but these errors were encountered: