Kafka publisher#284
Conversation
| { | ||
| "name": "@message-queue-toolkit/core", | ||
| "version": "21.2.0", | ||
| "version": "21.2.1", |
There was a problem hiding this comment.
Will publish core once this PR is merged
| init(): Promise<void> { | ||
| if (this.producer) return Promise.resolve() | ||
|
|
||
| this.producer = new Producer({ |
There was a problem hiding this comment.
is connection established lazily?
There was a problem hiding this comment.
The connection is currently established using the produce method.
Although this method is not really async now, it would be ideal to verify the validity of the connection at this point. However, the library doesn't provide a built-in way to do this at the moment.
To maintain flexibility for future improvements, I have kept this method returning a promise. This approach allows us to introduce connection validation later on without breaking changes to the interface. For now, since the publisher will primarily be used for testing, I believe we can proceed without immediate connection checks and plan to implement the validation mechanism in the future.
There was a problem hiding this comment.
can you create a ticket on platformatic repo for the feature?
There was a problem hiding this comment.
Actually I have an idea to achieve the connection check, I will try to implement it in a follow-up PR if it is fine
| const NO_MESSAGE_TYPE = 'NO_MESSAGE_TYPE' | ||
|
|
||
| export class MessageSchemaContainer<MessagePayloadSchemas extends object> { | ||
| public readonly messageDefinitions: Record<string, CommonEventDefinition> |
There was a problem hiding this comment.
@kibertoad I think this is not used, so I decided to remove it, but if I am wrong, please let me know, and I will revert the removal
There was a problem hiding this comment.
I think it's used for introspection, e. g. for populating EventCatalog
There was a problem hiding this comment.
You are absolutely true!
const messageDefinition = consumer._messageSchemaContainer?.messageDefinitions[type]
It is not a good approach to use private properties, but not going to rework it now 😅 so I will revert that change
No description provided.