krakend / krakend-amqp

AMQP compatible backend for the KrakenD framework
https://www.krakend.io
Apache License 2.0
10 stars 16 forks source link

Cannot produce message for exchange of type fanout. #14

Closed shi-rudo closed 2 years ago

shi-rudo commented 2 years ago

Unfortunately I can't send messages to an Exchange configured as type fanout ... inequivalent arg 'type' for exchange 'user.events' in vhost '/': received 'topic' but current is 'fanout'. In the documentation I can't find a parameter where I can configure the type. Is fanout not supported or am I missing something?

krakend.json

{
  "version":3,
  "port":8080,
  "endpoints":[
    {
      "endpoint":"/api/user/event/signedUp",
      "method":"POST",
      "backend":[
        {
          "extra_config": {
            "backend/amqp/producer": {
              "name": "user.event.UserSignedUp",
              "exchange": "user.events",
              "durable": true,
              "delete": false,
              "no_wait": true,
              "no_local": false,
              "routing_key": "userSignedUp",
              "prefetch_count": 10,
              "mandatory": false,
              "immediate": false
            }
          },
          "host":[
            "amqp://guest:guest@host.docker.internal:5672/"
          ],
          "disable_host_sanitize":true
        }
      ]
    }
  ]
}

KrakenD

krakend_ce_1 | 2022/04/25 14:15:52 KRAKEND ERROR: [ENDPOINT: /api/user/event/signedUp] Exception (504) Reason: "channel/connection is not open"
krakend_ce_1 | [GIN] 2022/04/25 - 14:15:52 | 500 |     293.667µs |      172.26.0.1 | POST     "/api/user/event/signedUp"

rabbitMq

rabbitmq | 2022-04-25 14:15:52.230932+00:00 [error] <0.4687.0> Channel error on connection <0.4678.0> (172.28.0.1:64784 -> 172.28.0.2:5672, vhost: '/', user: 'guest'), channel 1:
rabbitmq | 2022-04-25 14:15:52.230932+00:00 [error] <0.4687.0> operation exchange.declare caused a channel exception precondition_failed: inequivalent arg 'type' for exchange 'user.events' in vhost '/': received 'topic' but current is 'fanout'
kpacha commented 2 years ago

You are right, krakend is trying to connect (and create if needed) an exchange with the type topic. That's the only type supported and there is no way to change it by configuration