Skip to content

CAMEL-25939: camel-milo - the retry of refused monitored items follows reconnectTimeout in its docs and tests - #28254

Merged
davsclaus merged 2 commits into
apache:mainfrom
etzel-mes:fix/CAMEL-25939-milo-retry-interval
Oct 22, 2026
Merged

davsclaus merged 2 commits into
apache:mainfrom
etzel-mes:fix/CAMEL-25939-milo-retry-interval

Conversation

@etzel-mes

Copy link
Copy Markdown
Contributor

Description

The follow-up agreed in the review of #28212. Since CAMEL-25692 (#28212) and CAMEL-25873 (#28219), a monitored item that the server refused is created again every reconnectTimeout milliseconds (10000 by default), as the WARN of the refusal already logs. This aligns the texts and the tests with it:

  • The milo-client component page and the 4.24 upgrade note of CAMEL-25692 said "every 10 seconds"; they now say every reconnectTimeout (10 seconds by default). The 4.24 note on server certificate validation said the client "tries again every 10 seconds"; connection attempts follow reconnectTimeout too, so it now uses the wording of the component page.
  • The description of the reconnectTimeout option named only the connection attempts; it now names the retry of refused monitored items as well (generated JSON, catalog and DSL updated).
  • MonitoredItemRetryTest and the two consumers of CommunicationLossTest that share the connection of the refused node set reconnectTimeout=1000, with waits to match: quiet periods of 15 and 12 s become 3 s, and upper bounds of 30 s become 10 s.

No change in behaviour; the main code changes are javadoc only.

Tests, run locally on JDK 21 with -Dsurefire.rerunFailingTestsCount=0:

before after
MonitoredItemRetryTest 52 s 13 s
CommunicationLossTest#refusedNodeIsCreatedOnceTheSessionIsActiveAgain 31 s 30 s

In the second test the retry now creates the node within a second after the session is back. The node's value still arrives about 10 s later, because the embedded server first answers the Publish requests it had queued for the dropped channel. That queue, not the retry interval, sets the test's duration.

Module -Psourcecheck verify: 99 tests, 0 failures, 1 skipped.

Fixes CAMEL-25939.

@davsclaus @oscerd

Target

  • I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.
  • I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.

AI-assisted contributions

  • If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., Co-authored-by trailers) and the PR description identifies the AI tool used.

Claude Code on behalf of etzel-mes

…s reconnectTimeout in its docs and tests

Since CAMEL-25692 and CAMEL-25873, a monitored item that the server refused is created again every reconnectTimeout
milliseconds, as the WARN of the refusal already logs. The component page and the 4.24 upgrade notes still said every
10 seconds, and the description of the option named only the connection attempts; they now name reconnectTimeout.
MonitoredItemRetryTest and the consumers of CommunicationLossTest that share the connection of the refused node set
reconnectTimeout to one second, with waits to match.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Docs and tests are consistent with the existing behavior; no production code changes.

  • Documentation updates (Javadoc, component page, upgrade guide, catalog JSON, DSL factories) all correctly describe reconnectTimeout as governing both reconnect attempts and the retry interval for server-refused monitored items — consistent with what the code already does.
  • Test changes set reconnectTimeout=1000 so the retry fires within a 1-second window, and the await() timeouts are reduced proportionally (15s → 3s, 12s → 3s, 30s → 10s). The throughRelay() helper is used consistently for both route registration and endpoint lookup, so the endpoint identity is preserved.
  • ⚠️ Pre-fix test validation: dynamic check skipped (docs/test-only PR, no production path change). Static trace: reconnectTimeout=1000 via URI → MiloClientConfiguration.setReconnectTimeout() (validated > 0, stored) → retry loop uses the field. With a 1s retry interval the refused node would be re-created within 1s; the 3s await().during() window makes the test reliable. The timing improvement reported in the PR description (52s → 13s for MonitoredItemRetryTest) corroborates that the parameter is wired correctly.
  • Static analysis flagged pre-existing findings (empty-catch blocks and broad-exception in MiloClientConfiguration.setAllowedSecurityPolicies(), autocloseable sockets in relay infrastructure) — none introduced by this PR.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks etzel-mes, this is the follow-up agreed in #28212 and it matches the code: SubscriptionManager.Connected.scheduleRetry() and the reconnect in connect() both schedule on reconnectTimeout, and retryRefused skips an attempt while the session is not active, so the new wording of the option ("Neither attempt is made while the OPC UA client recovers a lost session on its own") is correct. The description is the same in the generated JSON, the catalog copy and the component and endpoint DSL. No option is renamed, removed or given a new default, so the 4.24 notes are wording fixes only.

The tests keep their meaning with the shorter interval. Every endpoint that shares a connection gets reconnectTimeout=1000: all of MonitoredItemRetryTest goes through MILO_CLIENT_BASE, and all of the relay consumers of CommunicationLossTest now go through throughRelay. That matters, because toCacheId() does not include reconnectTimeout, so an endpoint without it would take the default if it opened the connection first. The quiet periods of 3 s still cover several retry attempts.

  1. Optional: the note of CAMEL-25873 in the 4.24 upgrade guide ("the reconnectTimeout of the components sets the delay between connection attempts") still names only the connection attempts. Consider one sentence there saying the same option sets how often refused monitored items are created again. A user who lowers reconnectTimeout to reconnect faster also gets one CreateMonitoredItems call per interval for every refused node, for example a node id with a typo, for as long as the connection lasts.

LGTM once the build jobs are green.

Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

… names the retry of refused monitored items

A lower reconnectTimeout also repeats the CreateMonitoredItems request for
refused nodes more often, which the note of CAMEL-25873 did not say.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@etzel-mes

Copy link
Copy Markdown
Contributor Author

Thanks @davsclaus. Added one sentence to the CAMEL-25873 note in 14806b5: the option also sets how often refused monitored items are created again, so a lower value repeats the CreateMonitoredItems request for them, for example for a node ID with a typo, more often while the connection lasts. Docs only.

Claude Code on behalf of etzel-mes

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Serdar,

The earlier optional point is addressed in 14806b5. The CAMEL-25873 note in the 4.24 upgrade guide now says that reconnectTimeout also sets how often refused monitored items are created again, and what a lower value costs. That matches scheduleRetry(). The commit only touches the guide. It still merges cleanly with main and with #28252, which adds its note right after this one. There were no inline threads to resolve.

LGTM, to merge once CI is green.

Claude Code on behalf of @davsclaus.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • catalog/camel-catalog
  • components/camel-milo
  • docs
  • dsl/camel-componentdsl
  • dsl/camel-endpointdsl

🔁 1 test passed only after a retry on JDK 21 (1 retried attempt)

Recovered flaky tests on JDK 21 (1)
Module Test Failed attempts First failure
dsl/camel-jbang/camel-jbang-plugin-tui LaunchManagerOutcomeTest.startedWhenTheStatusFileSaysSo 1 expected: null but was: LaunchOutcome[ok=false, log=null]

ℹ️ These tests did not fail the build. Surefire retried them and they passed.
Retries are enabled project-wide by surefire.rerunFailingTestsCount in parent/pom.xml.


🔬 Scalpel shadow comparison — Scalpel: 8 of 707 tested, 23 compile-only — current: 8 all tested

Maveniverse Scalpel detected 8 affected modules (current approach: 8).

Skip-tests mode would test 8 modules (5 direct + 7 downstream), skip tests for 23 (generated code, meta-modules)

Modules Scalpel would test (8)
  • camel-jbang-mcp ← downstream of org.apache.camel:camel-catalog
  • camel-jbang-plugin-mcp ← downstream of org.apache.camel:camel-jbang-core
  • camel-jbang-plugin-tui ← downstream of org.apache.camel:camel-catalog
  • camel-jbang-plugin-validate ← downstream of org.apache.camel:camel-yaml-dsl-validator
  • camel-launcher-container ← downstream of org.apache.camel:camel-launcher
  • camel-milo ← components/camel-milo/src/generated/resources/META-INF/org/apache/camel/component/milo/browse/milo-browse.json, components/camel-milo/src/generated/resources/META-INF/org/apache/camel/component/milo/client/milo-client.json, components/camel-milo/src/main/docs/milo-client-component.adoc, components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientComponent.java, components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConfiguration.java, components/camel-milo/src/test/java/org/apache/camel/component/milo/CommunicationLossTest.java, components/camel-milo/src/test/java/org/apache/camel/component/milo/MonitoredItemRetryTest.java
  • camel-yaml-dsl-validator ← downstream of org.apache.camel:camel-catalog
  • camel-yaml-dsl-validator-maven-plugin ← downstream of org.apache.camel:camel-yaml-dsl-validator
Modules with tests skipped (23)
  • apache-camel
  • camel-allcomponents
  • camel-catalog-console
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

All tested modules (35 modules, 5m 48s total)

Total reactor time: 5m 48s

Module Duration Status
Camel :: Launcher 53.3s SUCCESS
Camel :: JBang :: MCP 44.8s SUCCESS
Camel :: JBang :: Plugin :: Validate 29.7s SUCCESS
Camel :: YAML DSL :: Validator 26.8s SUCCESS
Camel :: Catalog :: Camel Catalog 24.2s SUCCESS
Camel :: YAML DSL 23.3s SUCCESS
Camel :: Component DSL 20.6s SUCCESS
Camel :: Kamelet Main 18.8s SUCCESS
Camel :: Docs 14.8s SUCCESS
Camel :: JBang :: Plugin :: Testing 14.2s SUCCESS
Camel :: JBang :: Plugin :: Kubernetes 13.3s SUCCESS
Camel :: Catalog :: Camel Route Parser 8.4s SUCCESS
Camel :: YAML DSL :: Deserializers 8.3s SUCCESS
Camel :: Catalog :: Camel Report Maven Plugin 8.2s SUCCESS
Camel :: Assembly 7.3s SUCCESS
Camel :: All Components Sync point 5.4s SUCCESS
Camel :: YAML DSL :: Validator Maven Plugin 5.1s SUCCESS
Camel :: Catalog :: Maven 3.6s SUCCESS
Camel :: YAML DSL :: Maven Plugins 3.5s SUCCESS
Camel :: Catalog :: Suggest (deprecated) 2.8s SUCCESS
Camel :: JBang :: Plugin :: Edit 1.8s SUCCESS
Camel :: Coverage 1.3s SUCCESS
Camel :: Catalog :: Dummy Component 1.3s SUCCESS
Camel :: Catalog :: Console 1.2s SUCCESS
Camel :: JBang :: Plugin :: Generate 1.1s SUCCESS
Camel :: JBang :: Main 1.0s SUCCESS
Camel :: Endpoint DSL :: Support 1.0s SUCCESS
Camel :: JBang :: Plugin :: MCP 0.8s SUCCESS
Camel :: Launcher :: Container 0.7s SUCCESS
Camel :: JBang :: Integration tests 0.7s SUCCESS
Camel :: Endpoint DSL n/a
Camel :: Integration Tests n/a
Camel :: JBang :: Core n/a
Camel :: JBang :: Plugin :: TUI n/a
Camel :: Milo n/a

Top 20 slowest modules:

  • Camel :: Launcher (53.3s)
  • Camel :: JBang :: MCP (44.8s)
  • Camel :: JBang :: Plugin :: Validate (29.7s)
  • Camel :: YAML DSL :: Validator (26.8s)
  • Camel :: Catalog :: Camel Catalog (24.2s)
  • Camel :: YAML DSL (23.3s)
  • Camel :: Component DSL (20.6s)
  • Camel :: Kamelet Main (18.8s)
  • Camel :: Docs (14.8s)
  • Camel :: JBang :: Plugin :: Testing (14.2s)
  • Camel :: JBang :: Plugin :: Kubernetes (13.3s)
  • Camel :: Catalog :: Camel Route Parser (8.4s)
  • Camel :: YAML DSL :: Deserializers (8.3s)
  • Camel :: Catalog :: Camel Report Maven Plugin (8.2s)
  • Camel :: Assembly (7.3s)
  • Camel :: All Components Sync point (5.4s)
  • Camel :: YAML DSL :: Validator Maven Plugin (5.1s)
  • Camel :: Catalog :: Maven (3.6s)
  • Camel :: YAML DSL :: Maven Plugins (3.5s)
  • Camel :: Catalog :: Suggest (deprecated) (2.8s)

⚙️ View full build and test results

@davsclaus davsclaus added this to the 4.24.0 milestone Oct 22, 2026
@davsclaus davsclaus added the task label Oct 22, 2026
@davsclaus
davsclaus merged commit 1975e38 into apache:main Oct 22, 2026
7 checks passed
@etzel-mes
etzel-mes deleted the fix/CAMEL-25939-milo-retry-interval branch October 23, 2026 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants