Skip to content

Receive without destination in RabbitMessagingTemplate tries to receive from defaultDestination which is a routing key #1412

Closed
@aspan

Description

@aspan

When receiving messages with RabbitMessagingTemplate.receive() method it tries to receive messages from the default destination set in the RabbitMessagingTemplate which in my case is a routing key since I also use it for sending. I solved the issue by subclassing the RabbitMessagingTemplate with the following implementation of receive which uses the receive queue configured in the RabbitTemplate.

    @Override
    public Message<?> receive() {
        try {
            var amqpMessage = getRabbitTemplate().receive();
            return convertAmqpMessage(amqpMessage);
        } catch (RuntimeException ex) {
            throw convertAmqpException(ex);
        }
    }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions