Alina Didenko
Alina Didenko

Reputation: 178

Spring Cloud Stream 3.1.2 RabbitMQ consumer not working

Using spring cloud stream with RabbitMQ with config:

spring:
  rabbitmq:
    host: localhost
    port: 5672
    username: rabbitmq
    password: rabbitmq
  cloud:
    stream:
      rabbit:
        bindings:
          organization-created-in-0:
            consumer:
              autoBindDlq: true
              republishToDlq: true
      bindings:
        organization-created-in-0:
          destination: vs.organizations.organization-created
          content-type: application/json
          group: requestGroup
          maxAttempts: 3

The application does not connect to RabbitMQ. Exchange and Queue are not created when the application is running. If they have already been created, there is no connection anyway. If spring.cloud.function.declaration: organizationCreated is added, the Exchange and Queue are created, but with the wrong name: enter image description here

Exchange organizationCreated-in-0 instead vs.organizations.organization-created and Queue organizationCreated-in-0.anonymous.z5pgPh4BT3SmlObBPQF4gw instead vs.organizations.organization-created.requestGroup. How fix it?

Upvotes: 0

Views: 264

Answers (1)

Gary Russell
Gary Russell

Reputation: 174729

Given the declaration is defined as organizationCreated (the method name), the binding name is organizationCreated-in-0 not organization-created-in-0.

The method name is not hyphenated in the binding name, it is used unchanged.

Upvotes: 0

Related Questions