nestx-amqp
nestx-amqp copied to clipboard
feature: suggest to pass all arguments to consumer
Innestx-amqp
, PublishQueue
and PublishExchange
just send the first argument to consumer now. I don't understand why it is designed like this. I strongly recommend that I should send all arguments to consumer.
sorry for late reply,
@PublishQueue
/@PublishExchange
currently only pass first argument to the handling method.
belows are my concern:
- as producer handler, developer can customize produce options at
options
property in decorators - and the might use other decorator like
@PublishEvent
,@Broadcast
at the same time (setting options in handler method and pass all arguments to decorator might broke other decorators. - as decorator options, like
PublishExchangeOptions
, it can perform type-safe checking
for dynamic options, it's better to design an extra decorator binding queue and exchange. like below code
@InjectedQueue(queue)
someQueue: Queue;
queue.send(content, options, otherArgs); // pass all arguments to internal producer
you can refer to @Payload
, @Header
in spring-messaging
. T
these decorators is design to be detected in @PublishQueue/Exchange
and covert to runtime arguments.
https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/messaging/handler/annotation/Payload.html