Skip to content

spring cloud stream destroys The readyness state #2083

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

Open
GreenRover opened this issue Jan 15, 2021 · 6 comments
Open

spring cloud stream destroys The readyness state #2083

GreenRover opened this issue Jan 15, 2021 · 6 comments

Comments

@GreenRover
Copy link

Describe the issue
Originally invented @philwebb with: spring-projects/spring-boot#7656
The "readiness" framework, that enables to register "ApplicationRunner" to ensure for example a "cache" is loaded before the application is ready to server.

But when spring cloud stream is used following happend:

@org.springframework.boot.SpringApplication#run(java.lang.String...)
refreshContext(context);
--> ScSt wants to create the binder
--> DefaultBinderFactory starts a new inner SpringApplication
--> It run again: SpringApplication#run(java.lang.String...)
--> callRunners(context, applicationArguments); // will not find any "ApplicationRunner", what is correct
--> listeners.running(context); // called and fire the "ReadinessState.ACCEPT". This is the BUG
--> .... spring cloud stream set up its binders ...
callRunners(context, applicationArguments); // will execute the "ApplicationRunner" that is set up my application cache.
listeners.running(context); // The "ReadinessState.ACCEPT" event gets fired that i expect.

To Reproduce
Steps to reproduce the behavior:

  1. Download: readiness.zip
  2. If you dont like the solace binder replace against what ever you want.
  3. Run the spring application
  4. Wait for "BusinessLogic: load my cache from DB" in log
  5. Open on browser: http://localhost:9007/actuator/health/readinessState
    Expected: status: "OUT_OF_SERVICE"
    Current state: status: "OK"
  6. Wait for "BusinessLogic: cache load complete" in log
    Expected: status: "OK"
    Current state: status: "OK"
@GreenRover
Copy link
Author

@philwebb
Copy link
Contributor

It is a bit of pain that spring.factories are currently all or nothing. I don't particularly like the idea of using the arguments to suppress the listeners. I'd probably prefer dedicated methods on SpringApplication and SpringApplicationBuilder. Perhaps we should offer some kind of SpringFactoriesFilter interface that can accept or reject specific instances. Feel free to raise an issue on the Spring Boot issue tracker for that if you think it would help.

@spencergibb
Copy link
Member

I think that the new config data api could be used rather than Spring application

@wilkinsona
Copy link
Contributor

Yes please, @spencergibb. If using the config data API lets you get rid of the context hierarchy, that sounds ideal to me. It would also simplify some other problems we've seen in SCS (IIRC) with the logging system when there's a child app with a different lifecycle to its parent.

@olegz
Copy link
Contributor

olegz commented Jan 19, 2021

@spencergibb and I talked about this, so it is on my list of things to do, but will admit, low in priority especially with SCSt plans for 4.0.

@GreenRover
Copy link
Author

@olegz Can you give any release estimations? Or better time ranges?
Can i support you some how?

GreenRover pushed a commit to solacecommunity/spring-solace-leader-election that referenced this issue Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants