Skip to content

rabbitmnq: Can't declare binding with routing keyΒ #5346

@oneiros-de

Description

@oneiros-de

I'm using org.testcontainers:rabbitmq 1.17.1 with Spring Boot 2.6.7.
I'm trying to create a test container with a binding with a routing key:

  private static final String RABBITMQ_VHOST = "mo_messaging";
  private static final String RABBITMQ_USER = "hermesmo";
  private static final String RABBITMQ_EXCHANGE = "inboundExchange";
  private static final String RABBITMQ_QUEUE = "ss7InboundQueue";
  @Container
  private static final RabbitMQContainer RABBIT_MQ_CONTAINER =
      new RabbitMQContainer(DockerImageName.parse("rabbitmq:3.7.25-management-alpine"))
          .withVhost(RABBITMQ_VHOST, true)
          .withUser(RABBITMQ_USER, "password")
          .withPermission(RABBITMQ_VHOST, RABBITMQ_USER, ".*", ".*", ".*")
          .withExchange(RABBITMQ_VHOST, RABBITMQ_EXCHANGE, ExchangeTypes.TOPIC, false, false, true,
              Collections.emptyMap())
          .withQueue(RABBITMQ_QUEUE)
          .withBinding(RABBITMQ_EXCHANGE, RABBITMQ_QUEUE, Collections.emptyMap(), "ss7", DestinationType.QUEUE.name());

This fails. The (extensive) log shows an error:

15:20:43.585 [main] ERROR 🐳 [rabbitmq:3.7.25-management-alpine] - Could not execute command [rabbitmqadmin, declare, binding, source=inboundExchange, destination=ss7InboundQueue, routing_key=ss7, destination_type=QUEUE, arguments={}]: Traceback (most recent call last):
  File "/usr/local/bin/rabbitmqadmin", line 1150, in <module>
    main()
  File "/usr/local/bin/rabbitmqadmin", line 494, in main
    method()
  File "/usr/local/bin/rabbitmqadmin", line 733, in invoke_declare
    self.post(uri, json.dumps(upload))
  File "/usr/local/bin/rabbitmqadmin", line 529, in post
    return self.http("POST", "%s/api%s" % (self.options.path_prefix, path), body)
  File "/usr/local/bin/rabbitmqadmin", line 609, in http
    raise Exception("Received response %d %s for path %s\n%s"
Exception: Received response 500 Internal Server Error for path /api/bindings/%2F/e/inboundExchange/Q/ss7InboundQueue
b''

When I use

.withBinding(RABBITMQ_EXCHANGE, RABBITMQ_QUEUE);

this fails with

15:31:19.997 [main] ERROR 🐳 [rabbitmq:3.7.25-management-alpine] - Could not execute command [rabbitmqadmin, declare, binding, source=inboundExchange, destination=ss7InboundQueue]: *** Not found: /api/bindings/%2F/e/inboundExchange/q/ss7InboundQueue

Am I doing something wrong or is this a bug?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions