Skip to content

Do not confirmSelect more than once per channel #1056

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

Closed
sergio91pt opened this issue Jun 8, 2023 · 1 comment · Fixed by #1057
Closed

Do not confirmSelect more than once per channel #1056

sergio91pt opened this issue Jun 8, 2023 · 1 comment · Fixed by #1057

Comments

@sergio91pt
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Reactor's RabbitMQ sendWithTypedPublishConfirms() always invokes the confirmSelect() method of the underlying channel which causes a blocking RPC call.

This is especially detrimental to performance when sending a small amount of messages per Publisher/Flux, as the channel is put into confirm mode even if it already was (when using a channel pool).

Following RabbitMQ's best practices, confirms should be enabled once per channel. In fact, there's no API to disable confirms once enabled on a channel.

Describe the solution you'd like

ChannelN should keep track if confirmSelect() was successfully enabled, and if so, future invocations of this method return a Confirm.SelectOk without making a RPC call.

I can contribute a PR if there's interest in this solution 🙂

Describe alternatives you've considered

No response

Additional context

No response

@acogoluegnes
Copy link
Contributor

That's a fair improvement, feel free to submit a PR. Thanks!

sergio91pt added a commit to sergio91pt/rabbitmq-java-client that referenced this issue Jun 8, 2023
In order to avoid unnecessary blocking RPC calls and conform to best
practices, the Channel now checks if it is already activated confirm
mode before sending a confirm.select RPC call.

If confirm mode is already activated, calling confirmSelect() again
returns immediately without sending an RPC call.

Closes rabbitmq#1056
acogoluegnes pushed a commit that referenced this issue Jun 13, 2023
In order to avoid unnecessary blocking RPC calls and conform to best
practices, the Channel now checks if it is already activated confirm
mode before sending a confirm.select RPC call.

If confirm mode is already activated, calling confirmSelect() again
returns immediately without sending an RPC call.

Closes #1056

(cherry picked from commit 7253c94)

Conflicts:
	src/test/java/com/rabbitmq/client/test/ChannelNTest.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants