nestx-amqp icon indicating copy to clipboard operation
nestx-amqp copied to clipboard

feature: suggest to pass all arguments to consumer

Open GuihaiHU opened this issue 4 years ago • 2 comments

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.

GuihaiHU avatar Mar 31 '20 10:03 GuihaiHU

sorry for late reply, @PublishQueue/@PublishExchangecurrently 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

aquariuslt avatar Apr 01 '20 18:04 aquariuslt

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

aquariuslt avatar Apr 01 '20 18:04 aquariuslt