Add connectionStartupTimeout for resilience against Siri ET MQTT broker unavailability #7489
Merged
jessicaKoehnke merged 2 commits intoopentripplanner:dev-2.xfrom Apr 10, 2026
Conversation
ab6fc6e to
6515c00
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #7489 +/- ##
=============================================
- Coverage 71.39% 71.01% -0.38%
+ Complexity 21112 21004 -108
=============================================
Files 2344 2352 +8
Lines 87167 87294 +127
Branches 8633 8637 +4
=============================================
- Hits 62231 61994 -237
- Misses 21936 22312 +376
+ Partials 3000 2988 -12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
MaxGosau
approved these changes
Apr 8, 2026
Contributor
MaxGosau
left a comment
There was a problem hiding this comment.
MqttEstimatedTimetableSource could be seperated into multiple classes (e.g. Clientfactory, MetricsConfiguration, Orchestration) but we should do that in a seperate PR, therefore approved.
habrahamsson-skanetrafiken
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a connectionStartupTimeout configuration parameter to the SIRI MQTT updater so that OTP can start routing without real-time data when the MQTT broker is unavailable at startup, instead of blocking indefinitely. The MQTT client continues retrying in the background and resumes processing live messages once the broker becomes available.
Issue
No related issue.
Motivation
Previously, if the MQTT broker was unreachable when OTP started, the blocking .join() call in connectAndSubscribeToClient() would hang OTP startup indefinitely with no fallback.
How the code works
The HiveMQ client connection is now initiated non-blocking. At startup, OTP waits up to connectionStartupTimeout (default: 30s) for the broker to connect. If the broker connects in time, normal priming proceeds (retained messages are processed before routing is enabled). If not, OTP logs a warning and marks the updater as primed immediately, allowing routing to start without real-time data. Subscription setup is moved into the onConnect callback so it is correctly re-established on every reconnect, including after a broker restart.
New optional parameter in
router-config.json:{ "type": "siri-et-mqtt", "connectionStartupTimeout": "PT30S" }Unit tests
No unit tests were added. The change is primarily a resilience/configuration improvement to the MQTT connection lifecycle. Manual verification was done to confirm OTP starts correctly both when the broker is available and when it is not.
Documentation