I've been working on a NestJS project where I'm using a Kafka server to emit events and NestJS to consume them. My goal is to create a consumer with the topic my-topic
that is triggered only when a specific value is present in the header variable my-header-variable
.
This is what I have in mind:
@MyEventPattern('my-pattern', { 'my-header-variable': 'secret'})
function index(@Payload() data: any) {
// ... Do it only if 'my-header-variable' == 'secret'
}
Can someone guide me on how to achieve this behavior? Perhaps there is already some existing code or solution available for this?