Skip to content

Conversation

@alzimmermsft
Copy link
Member

Description

Fixes #45386

Use reflection to create Vert.x HttpClient to properly support Vert.x 5.x while keeping dependency on Vert.x 4.5.

While Vert.x 5.x and Vert.x 4.5 both have Vertx.createHttpClient(HttpClientOptions), there is binary incompatibility which results in an exception thrown when azure-core-http-vertx's Vert.x 4.5 version is overridden to use Vert.x 5.x. Using reflection to create the Vert.x HttpClient resolves this issue.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@alzimmermsft alzimmermsft self-assigned this Jun 16, 2025
Copilot AI review requested due to automatic review settings June 16, 2025 13:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables compatibility with both Vert.x 4.5 and 5.x by using reflection to invoke Vertx.createHttpClient(HttpClientOptions) instead of a direct call.

  • Exports the com.azure.core.http.vertx package in module-info.java to allow internal implementation access.
  • Introduces a static reflection-based factory (VERTX_HTTP_CLIENT_FACTORY) in VertxHttpClientBuilder.
  • Replaces the direct configuredVertx.createHttpClient(...) call with the reflective factory invocation.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
sdk/core/azure-core/src/main/java/module-info.java Added com.azure.core.http.vertx to exports in com.azure.core.implementation.
sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/VertxHttpClientBuilder.java Added static reflective factory for HttpClient creation and updated build() to use it.
Comments suppressed due to low confidence (1)

sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/VertxHttpClientBuilder.java:44

  • Add unit tests for the reflection-based HttpClient factory to verify both successful invocation and error paths, ensuring it works reliably under Vert.x 4.x and 5.x.
static {

@github-actions
Copy link
Contributor

github-actions bot commented Jun 16, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

com.azure:azure-core

@alzimmermsft
Copy link
Member Author

/check-enforcer override

@alzimmermsft alzimmermsft merged commit c9ba960 into Azure:main Jun 16, 2025
22 of 24 checks passed
@alzimmermsft alzimmermsft deleted the AzVertx_UseReflectionToProperlySupport5.x branch June 16, 2025 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Support Vert.x v5 in azure-core-http-vertx

2 participants