Skip to content

Comments

fix(httpclient): correct factory priorities and add Vert.x 5 runtime validation#7442

Merged
manusa merged 2 commits intofabric8io:mainfrom
manusa:fix/verrtx-priority-convergence
Feb 18, 2026
Merged

fix(httpclient): correct factory priorities and add Vert.x 5 runtime validation#7442
manusa merged 2 commits intofabric8io:mainfrom
manusa:fix/verrtx-priority-convergence

Conversation

@manusa
Copy link
Member

@manusa manusa commented Feb 17, 2026

Summary

  • Fix HTTP client factory priority: VertxHttpClientFactory (default) now has priority -1, OkHttpClientFactory restored to priority 0
  • Add runtime validation in Vertx5HttpClientFactory to detect Vert.x version mismatch with clear error message
  • Add detailed documentation in CHANGELOG explaining Vert.x 4/5 mutual exclusivity

Problem

When Vert.x became the default HTTP client, the priority was not updated correctly:

  • OkHttpClientFactory still had priority -1 (old default marker)
  • VertxHttpClientFactory used default priority 0

This caused non-deterministic factory selection when multiple clients were on the classpath.

Additionally, when both kubernetes-httpclient-vertx and kubernetes-httpclient-vertx-5 are present, users get cryptic NoClassDefFoundError for io.vertx.core.impl.SysProps.

Solution

  1. Priority fix: VertxHttpClientFactory now returns -1 (project default), OkHttpClientFactory uses default 0
  2. Runtime check: Vertx5HttpClientFactory.newBuilder() validates Vert.x 5 classes are available, providing clear error message if not
  3. Documentation: CHANGELOG explains the mutual exclusivity and proper configuration

Test plan

  • Verify deterministic HTTP client selection when multiple clients present
  • Verify clear error message when Vert.x 4/5 conflict occurs
  • CI passes for all HTTP client variants

Fixes #7174

🤖 Generated with Claude Code

manusa and others added 2 commits February 17, 2026 15:27
VertxHttpClientFactory is now the default HTTP client but was missing
the priority -1 that indicates it's the project default. OkHttpClientFactory
was still using priority -1 from when it was the default.

This fix:
- Adds priority() returning -1 to VertxHttpClientFactory (new default)
- Removes priority() override from OkHttpClientFactory (now uses default 0)

This ensures deterministic factory selection when multiple HTTP clients
are on the classpath - the default Vert.x client will always be preferred
unless a higher priority client is present.

Fixes fabric8io#7174

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
….x version compatibility

Add runtime validation in Vertx5HttpClientFactory.newBuilder() to detect
when Vert.x 5 classes are not available on the classpath.
This provides a clear error message instead of cryptic NoClassDefFoundError
when both kubernetes-httpclient-vertx (Vert.x 4) and kubernetes-httpclient-vertx-5
(Vert.x 5) are present but Maven resolves Vert.x 4 JARs.

Also add detailed documentation in CHANGELOG explaining:
- The mutual exclusivity of the two Vert.x HTTP client modules
- How to properly configure Vert.x 5 with exclusions and property override
- The root cause of the classpath conflict

Fixes fabric8io#7174

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@manusa manusa added this to the 7.6.0 milestone Feb 17, 2026 — with automated-tasks
Copy link
Member

@ash-thakur-rh ash-thakur-rh left a comment

Choose a reason for hiding this comment

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

LGTM!

@manusa manusa merged commit 29ff211 into fabric8io:main Feb 18, 2026
16 of 17 checks passed
@manusa manusa deleted the fix/verrtx-priority-convergence branch February 18, 2026 05:16
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.

Bump Vertx version

2 participants