spring-cloud / spring-cloud/spring-cloud-stream
Premature ApplicationReadyEvent in main application context
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 646
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 8
Description
As Spring Cloud Stream creates an additional SpringApplication for a binder, application listeners in the application receive events for that SpringApplication instance.
I have an application listener that is supposed to send a message on a message channel with an output binding. This listener receives an ApplicationReadyEvent when the binder context application is started, but before the main application is finished starting.
Depending on the timing, the message is send before the stream infrastructure is subscribed to said message channel, thus leading to an exception that the dispatcher for the channel has no subscriber.
The creation of this application instance is undocumented as far as I can see, receiving events from it is quite surprising. Even know that I know about it, I don't know how to distinguish the events. From an application developer perspective I believe my application should not receive such events.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the binder’s additional SpringApplication creates and publishes ApplicationReadyEvent instances, then examine how application listeners receive those events. Reproduce the startup race with an output binding and verify that application listeners no longer receive readiness events from the binder context before the main application is ready.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend, stream-processing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100