-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement PublisherManager convenience wrapper #136
Conversation
kibertoad
commented
May 3, 2024
- Automatically spawn publishers on demand
- Automatically fill metadata fields
|
||
constructor(options: MetadataFillerOptions) { | ||
this.serviceId = options.serviceId | ||
this.defaultVersion = options.defaultVersion ?? '1.0.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to migrate to SemVer for the schemaVersion
field? to me, it sounds like the best approach but asking just to confirm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if could be beneficial, on consumer, to differentiate between schemaVersion
to use one handler or the other 🤔 (definitely not part of this PR, sorry for raising things not relevant here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm, interesting idea! and yes, that would be awesome for the compatibility. will implement in a separate PR
|
||
import { AbstractSnsSqsConsumer } from '../../lib/sns/AbstractSnsSqsConsumer' | ||
|
||
export class FakeConsumer<T extends BaseMessageType> extends AbstractSnsSqsConsumer<T, unknown> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could make sense to expose this class to provide an easy way to replace real consumers on tests? I am not sure tbh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do!
handlers: new MessageHandlerConfigBuilder<T, unknown>() | ||
.addConfig(messageSchema, (message) => this._processMessage(message)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This could be simplified with
.addConfig(messageSchema, (message) => Promise.resolve({result: 'success'}))
Outstanding work 🚀! |