Closed olaurendeau closed 7 years ago
As said in the doc, "Reply queues are usually temporary, [...]". How did you configure this processor?
I think this should do the job:
- configurator: swarrot.processor.rpc_server
extras:
rpc_exchange: ''
This way you should publish in the default exchange IMO. If it works, maybe it's a good idea to update the processor configurator in order to use en empty exchange by default?
Hello Olivier :)
You're absolutely right :) it would work with this configuration, if configurator was allowing it
- configurator: swarrot.processor.rpc_server
extras:
rpc_exchange: ''
and therefore extras.rpc_exchange
key became useless, that's why I've proposed to remove it :
*/
public function getProcessorArguments(array $options)
{
- $exchange = $this->getExtra('rpc_exchange', 'retry');
-
return [
'Swarrot\Processor\RPC\RpcServerProcessor',
- $this->factory->getMessagePublisher($exchange, $options['connection']),
+ $this->factory->getMessagePublisher('', $options['connection']),
$this->logger,
];
}
*/
public function resolveOptions(InputInterface $input)
{
- return $this->getExtras();
+ return [];
}
}
If the exchange MUST be empty, in this case I merge your PR. :) If it's USUALLY empty, in this case I think we should put an empty exchange by default but let the possibility to use a custom one if needed.
Yes it MUST be empty, elsewhere even using a direct exchange it would just produce a message with a routing_key and Client would have to define a binding between exchange and temporary queue. Which is useless :)
Even if it makes no sense for your use case, it's still possible to use a routing_key. :) That's why I would like to keep this option available but not mandatory. Is it OK for you?
No problem for me (I've updated the PR). As it took me a while to understand that "Default exchange" feature of AMQP, would you mind if I document it here : https://github.com/swarrot/swarrot/blob/master/src/Swarrot/Processor/RPC/README.md ?
PR looks good to me. :) Good idea for the documentation! Should I wait for it before merging or you'll make another PR?
Updated documentation => https://github.com/swarrot/swarrot/pull/144
While trying to use the
RpcServerProcessor
I run into the following issueReturning
[]
instead of$this->getExtras();
in RpcServerProcessorConfigurator fixed the issueRabbitMQ example of RPC pattern
AMQP 0.9.1 RFC define that "To publish to a reply queue a producer sends a message to the default exchange"
So RPC exchange should never be defined by configuration, it should always be empty.