-
Notifications
You must be signed in to change notification settings - Fork 626
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
add RetryableConnection for the case for wait a moment when The channelMaxlimit is reached #2556
add RetryableConnection for the case for wait a moment when The channelMaxlimit is reached #2556
Conversation
…elMax limit is reached. Try later.
@javaecrainbow Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@javaecrainbow Thank you for signing the Contributor License Agreement! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an entry to whats-new.adoc
and update the connection section in amqp.adoc
.
spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/RetryableConnection.java
Outdated
Show resolved
Hide resolved
...bbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java
Outdated
Show resolved
Hide resolved
spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/RetryableConnection.java
Outdated
Show resolved
Hide resolved
I assume you mean by adding a suitably configured So why did you re-open it? |
Indeed, there are scenarios where the RetryTemplate in RabbitTemplate can be used to handle custom exception retries at a higher level. However, there are some use cases not triggered from RabbitTemplate. For instance, in BlockingQueueConsumer, there is also a business scenario for obtaining a channel, but it does not support RetryTemplate. Therefore, it is necessary to support RetryTemplate uniformly in the lower-level Connection module to cater to various upper-level business use cases that involve retrying channel acquisition exceptions. @garyrussell |
…tive retry policy
The
Which works as a retry on connection failure as well. So, looks like we have both passive and active connection covered with retries. Any thought why do we need this extra one exactly in the connection? Either way, if we really need, I'd prefer to make it based on that Let us know if that is OK with you and we close this as |
I encountered the problem in the case of the connection is shared between producers and consumers, and enabled producer reliability delivery . In the case of large concurrent message delivery, the connection cannot be obtained intermittently from RabbitTemplate . From the code you referred, I think that the solution you provide is actually a retry mechanism for consuming modules. I don't know whether there's a problem with my understanding, or whether spring-rabbit already has a solution for my problem in message delivery |
But you said it yourself before:
So, for Not sure what else you'd like to have on top of existing functionality without over-confusing framework users with paradox of choice. |
Thanks, I understand you way you provided can solve my problem I encountered before. Just I think the exception handling function at the network level should belong to the low-level design, so it should also has its own exception handling strategy mechanism at the bottom layer, and RetryTemplate and BackOff are modules at the upper level. |
OK. I see your point:
Can we then still look into that Thanks |
ok,i agree that. Wish backoff injection function in connection module. whether i close the pr ? |
I think you can just make a change and push the next commit. |
…WithRetry # Conflicts: # src/reference/antora/modules/ROOT/pages/whats-new.adoc # src/reference/asciidoc/amqp.adoc
@artembilan i have changed the retry template to backoff util and commited |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the progress in PR!
There is a number of Checkstyle violations:
Error: eckstyle] [ERROR] /home/runner/work/spring-amqp/spring-amqp/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java:66:1: Wrong order for 'org.springframework.util.backoff.BackOff' import. [ImportOrder]
Error: eckstyle] [ERROR] /home/runner/work/spring-amqp/spring-amqp/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java:168: Line matches the illegal pattern 'Trailing whitespace'. [Regexp]
Error: eckstyle] [ERROR] /home/runner/work/spring-amqp/spring-amqp/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java:591:41: Reference to instance variable 'connectionCreatingBackOff' needs "this.". [RequireThis]
Error: eckstyle] [ERROR] /home/runner/work/spring-amqp/spring-amqp/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java:591:84: Reference to instance variable 'connectionCreatingBackOff' needs "this.". [RequireThis]
Error: eckstyle] [ERROR] /home/runner/work/spring-amqp/spring-amqp/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/SimpleConnection.java:4: Line does not match expected header line of '^\Q * Licensed under the Apache License, Version 2.0 (the "License");\E$'. [RegexpHeader]
Error: eckstyle] [ERROR] /home/runner/work/spring-amqp/spring-amqp/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/SimpleConnection.java:28:1: Wrong order for 'org.springframework.util.backoff.BackOffExecution' import. [ImportOrder]
Error: eckstyle] [ERROR] /home/runner/work/spring-amqp/spring-amqp/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/SimpleConnection.java:65:51: Reference to instance variable 'backOffExecution' needs "this.". [RequireThis]
Error: eckstyle] [ERROR] /home/runner/work/spring-amqp/spring-amqp/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/SimpleConnection.java:66:49: Reference to instance variable 'backOffExecution' needs "this.". [RequireThis]
Error: eckstyle] [ERROR] /home/runner/work/spring-amqp/spring-amqp/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/SimpleConnection.java:108: Line matches the illegal pattern 'Trailing whitespace'. [Regexp]
Please, use gradlew check
command locally before pushing commits to PR.
...bbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java
Outdated
Show resolved
Hide resolved
...bbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java
Outdated
Show resolved
Hide resolved
spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/SimpleConnection.java
Outdated
Show resolved
Hide resolved
spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/SimpleConnection.java
Outdated
Show resolved
Hide resolved
spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/SimpleConnection.java
Outdated
Show resolved
Hide resolved
spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/SimpleConnection.java
Outdated
Show resolved
Hide resolved
...src/test/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactoryTests.java
Outdated
Show resolved
Hide resolved
.../src/test/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactoryTests.java
Outdated
Show resolved
Hide resolved
...bbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java
Outdated
Show resolved
Hide resolved
...bbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java
Outdated
Show resolved
Hide resolved
spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/SimpleConnection.java
Outdated
Show resolved
Hide resolved
spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/SimpleConnection.java
Outdated
Show resolved
Hide resolved
...src/test/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactoryTests.java
Outdated
Show resolved
Hide resolved
.../src/test/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactoryTests.java
Outdated
Show resolved
Hide resolved
…ction channel. ref:spring-projects#2556 content:review modify
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add your name to the @author
list of all the affected classes.
...src/test/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactoryTests.java
Show resolved
Hide resolved
...bbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java
Outdated
Show resolved
Hide resolved
spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/SimpleConnection.java
Show resolved
Hide resolved
...bbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java
Show resolved
Hide resolved
…ction channel. ref:spring-projects#2556 content:review modify
…ction channel. ref:spring-projects#2556 content:review modify
...bbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java
Show resolved
Hide resolved
...bbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java
Outdated
Show resolved
Hide resolved
...bbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractConnectionFactory.java
Outdated
Show resolved
Hide resolved
…ction channel. ref:spring-projects#2556 content:review modify
…ction channel. ref:spring-projects#2556 content:review modify
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple minor comments.
Fixing on merge...
Thanks
When I encounter message sending in high-concurrency scenarios in the actual project, I often encounter 'The channelMax limit is reached. Try later.' However, I need to handle this kind of retry compatibility at different parts of the business logic. So, I'm considering extending support for retry connection types in Spring RabbitMQ