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

Disable Backoff when connection is lost [SPR-17290] #21823

Open
spring-issuemaster opened this issue Sep 19, 2018 · 0 comments
Open

Disable Backoff when connection is lost [SPR-17290] #21823

spring-issuemaster opened this issue Sep 19, 2018 · 0 comments

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Sep 19, 2018

Guillaume opened SPR-17290 and commented

In my app, I have hundreds of JMS listeners which are plugged on the same topic. I would like these listeners to stop immediately when an error occurs, for example when the JMS provider is down.

 

I've created my own implementation of org.springframework.util.backoff.BackOff so that the method nextBackOff always return STOP, and I set that BackOff to all my listeners :

this.jmsContainer.setBackOff(new DisabledBackOff());

 

The problem is in the DefaultMessageListenerContainer.refreshConnectionUntilSuccessful() :

BackOffExecution execution = this.backOff.start();
 while (isRunning()) {
 try {
 if (sharedConnectionEnabled()) {
 refreshSharedConnection();

This code start the BackOffExecution and then immediately try to recover the connection. Then the method BackOffExecution.nextBackOff() is called and the recoverring is stopped.

To avoid the first refresh, I've no choice to raise an Exception when this.backOff.start() is called, but my JMS listener won't be stopped. And it's not a clean solution...

I think nextBackOff should be called before any refresh is intended.
Or maybe there is another solution ?


Affects: 5.0.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.