Is your feature request related to a problem? Please describe.
We want to create multiple NATS Jetstream consumer callbacks (with the @EventPattern() decorator) with different replay and ack strategies.
It would be super useful to be able to override the global consumerOptions on specific Message/Event patterns.
The gRPC transport exposes it's own decorator @GrpcMethod() doing the same here could help with types etc, the @GrpcMethod() is in the end just a wrapper for @EventHandler().
Hey there! Thank you for this amazing plugin!
Is your feature request related to a problem? Please describe. We want to create multiple NATS Jetstream consumer callbacks (with the
@EventPattern()
decorator) with different replay and ack strategies. It would be super useful to be able to override the globalconsumerOptions
on specific Message/Event patterns.Describe the solution you'd like The decorators
MessagePattern
andEventPattern
support theextra?: Record<string, any>
property (see https://github.com/nestjs/nest/blob/master/packages/microservices/server/server.ts#L51) that can be used for this kind a needs.IMO, a simple solution could be to use the
extra
property if available in the handler callback object and merge its content with the baseconsumerOptions
in the server config (see https://github.com/Redningsselskapet/nestjs-plugins/blob/master/packages/nestjs-nats-jetstream-transport/src/server.ts#L65).It could be something like this:
What do you think?
Describe alternatives you've considered After looking at the plugin code, I cannot make this work without updating the plugin code.
I can submit a PR if you like, just tell me if you have any recommandation about the solution I gave.