components-contrib icon indicating copy to clipboard operation
components-contrib copied to clipboard

Possibility to publish messages to a specific RoutingKey

Open DannyO-dev opened this issue 2 years ago • 3 comments

Hello all,

I am looking for a way to publish a message to RabbitMQ using a RoutingKey. With the help of PublishEventAsync() I can assign the message to the topic, but only without RoutingKey. Is there any possibility?

Also, when I automatically create the exchange in RabbitMQ, the type is always set to 'fanout', even if I have set the exchangeKind to 'topic'.

Thank you in advance, BR Daniel

DannyO-dev avatar Jul 13 '22 12:07 DannyO-dev

Please check the document

saber-wang avatar Jul 15 '22 02:07 saber-wang

Thanks for the answer, but I think I need to describe my problem more in detail:

My problem is that I am not creating a subscription via another Dapr client. Following scenario: An application implements a listener on the exchange 'cadcam...machine.changed.v1'. The exchange is automatically created in my RabbitMQ of type 'topic' and a queue is automatically generated which binds to the exchange .

image

If I now want to send a message to the exchange via the Dapr client, I get the error message that the preconditions are not met, because a topic of the type 'fanout' is expected.

"Exception (406) Reason: PRECONDITION_FAILED - inequivalent arg 'type' for exchange xy received 'fanout' but current is 'topic'"

The question for me is how to send the message to an exchange of type 'topic'? However, if I first send a message via the Dapr client and the exchange is generated autmoatically of type 'fanout', then I can start my listener afterwards (which automatically changes the type to 'topic'), and it works.

Thank you in advance. BR Daniel

DannyO-dev avatar Jul 18 '22 14:07 DannyO-dev

There should be clear settings in the documents provide. for example exchangeKind: topic

saber-wang avatar Jul 18 '22 16:07 saber-wang

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

dapr-bot avatar Aug 17 '22 16:08 dapr-bot

In case anyone should ever have the same problem: The error was due to an old daprd version (1.6.0). With a more recent version (>= 1.7.4) it works as desired. BR Daniel

DannyO-dev avatar Aug 18 '22 10:08 DannyO-dev