Skip to content

[codex] Delay Rqueue startup for Boot web apps#303

Open
sonus21 wants to merge 12 commits into
masterfrom
spring-boot-auto-startup-delay
Open

[codex] Delay Rqueue startup for Boot web apps#303
sonus21 wants to merge 12 commits into
masterfrom
spring-boot-auto-startup-delay

Conversation

@sonus21
Copy link
Copy Markdown
Owner

@sonus21 sonus21 commented May 21, 2026

Summary

Delays Rqueue listener container auto-start in Spring Boot web applications until ApplicationReadyEvent, covering both servlet and reactive web apps through Boot's web application condition. Non-web Boot applications keep the existing SmartLifecycle startup behavior.

Root cause

RqueueMessageListenerContainer is a SmartLifecycle bean, so Spring can auto-start pollers during context refresh before the embedded web server is fully ready. Web apps should let the Boot server finish startup before pollers begin consuming work.

Changes

  • Added RqueueAutoStartupLifecycle to disable container auto-start only for containers that originally opted into auto-start, then start them on ApplicationReadyEvent.
  • Wired the lifecycle bean only for Boot web applications with @ConditionalOnWebApplication, so servlet and WebFlux are covered while non-web workers are unchanged.
  • Made RqueueMessageListenerContainer.start() idempotent and set running only after doStart() succeeds.
  • Added unit coverage for delayed auto-start behavior.

Validation

  • ./gradlew :rqueue-core:test --tests com.github.sonus21.rqueue.listener.RqueueMessageListenerContainerTest :rqueue-spring-boot-starter:test --tests com.github.sonus21.rqueue.spring.boot.tests.unit.RqueueListenerAutoConfigTest
  • After renaming the helper: ./gradlew :rqueue-spring-boot-starter:test --tests com.github.sonus21.rqueue.spring.boot.tests.unit.RqueueListenerAutoConfigTest

@sonus21 sonus21 marked this pull request as ready for review May 21, 2026 11:21
@coveralls
Copy link
Copy Markdown

coveralls commented May 21, 2026

Coverage Report for CI Build 26326038935

Warning

No base build found for commit 0511a8c on master.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 83.426%

Details

  • Patch coverage: 55 of 55 lines across 9 files are fully covered (100%).

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 9121
Covered Lines: 7884
Line Coverage: 86.44%
Relevant Branches: 3513
Covered Branches: 2656
Branch Coverage: 75.6%
Branches in Coverage %: Yes
Coverage Strength: 0.86 hits per line

💛 - Coveralls

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

Successfully merging this pull request may close these issues.

2 participants