Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RabbitTemplate with SIMPLE correlation causes uncached channels #2572

Closed
artembilan opened this issue Dec 15, 2023 Discussed in #2571 · 1 comment
Closed

RabbitTemplate with SIMPLE correlation causes uncached channels #2572

artembilan opened this issue Dec 15, 2023 Discussed in #2571 · 1 comment

Comments

@artembilan
Copy link
Member

Discussed in #2571

Originally posted by bjoernhaeuser December 15, 2023
Hello everyone,

I hope this discussion is at the right place.

We are using a CachingConnectionFactory with CachingConnectionFactory.ConfirmType.SIMPLE as publisher confirm type setting.

Then we are using the RabbitTemplate something like this:

this.amqpTemplate.invoke(operations -> {
    // send messages

    // operations.waitForConfirmsOrDie(10_000);
}   

I thought this reuses channels, but after looking at the RabbitMQ stats I see a relatively high channel churn (in our case 50-100 channels/sec) and digging into this it looks like the RabbitTemplate is creating a new channel for every .invoke() call.

After a debugging session through the code I saw that the RabbitTemplate::invoke method calls RabbitUtils.setPhysicalCloseRequired(channel, true); Reference, when the connectionFactory says that publisher confirms are deactivated.

Right now the connectionFactory.isPublisherConfirms() would only return true when the ConfirmType is set to CORRELATED Reference.

I am not familiar enough to judge if this is the right condition, but it looks to be that it should be changed to say return !ConfirmType.NONE.equals(this.confirmType).

Changing the value to be of confirmType CORRELATED changes the behaviour and channels are properly cached. Can someone please advise if my findings are correct and/or if I am using it simply wrong?

Thank you very much!

@bjoernhaeuser
Copy link
Contributor

I want ahead and started to work on this in #2717

@artembilan artembilan modified the milestones: Backlog, 3.2.0-M1 May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants