I have tried to publish to kafka in NestJs
async publish<T extends IEvent>(event: T) {
await this.client.connect();
await this.client.send('topic', event);
}
But yet not found the correct method, dispatchEvent is protected.
Edit: using cqrs so this is inside a eventpublisher subscribed to the eventbus.