Skip to content

Commit 48c5146

Browse files
Add Azure HTTP client based on Vert.x (Azure#28468)
1 parent b59779c commit 48c5146

35 files changed

+2523
-3
lines changed

eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ the main ServiceBusClientBuilder. -->
127127
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientBuilderCheck" files="com.azure.core.http.netty.NettyAsyncHttpClientBuilder"/>
128128
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientBuilderCheck" files="com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder"/>
129129
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientBuilderCheck" files="com.azure.core.http.jdk.httpclient.JdkAsyncHttpClientBuilder"/>
130+
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientBuilderCheck" files="com.azure.core.http.vertx.VertxAsyncHttpClientBuilder"/>
130131

131132
<!-- Suppress public/private constructor check since BlobClients need protected constructors to create EncryptedClients -->
132133
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientCheck"
@@ -175,11 +176,15 @@ the main ServiceBusClientBuilder. -->
175176
<!-- The constant name is public static. -->
176177
<suppress checks="ConstantNames" files=".*[/\\]azure[/\\]storage[/\\].*LoggingOptions.java"/>
177178

178-
<!-- Suppress external dependency Checkstyle on Netty and OkHttp HttpClient packages -->
179+
<!-- Suppress external dependency Checkstyle on Netty, OkHttp and Vert.x HttpClient packages -->
179180
<suppress checks="com.azure.tools.checkstyle.checks.ExternalDependencyExposedCheck"
180181
files="com.azure.core.http.netty.NettyAsyncHttpClientBuilder"/>
181182
<suppress checks="com.azure.tools.checkstyle.checks.ExternalDependencyExposedCheck"
182183
files="com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder"/>
184+
<suppress checks="com.azure.tools.checkstyle.checks.ExternalDependencyExposedCheck"
185+
files="com.azure.core.http.vertx.VertxAsyncHttpClientBuilder"/>
186+
<suppress checks="com.azure.tools.checkstyle.checks.ExternalDependencyExposedCheck"
187+
files="com.azure.core.http.vertx.VertxProvider"/>
183188
<suppress checks="com.azure.tools.checkstyle.checks.ExternalDependencyExposedCheck"
184189
files="com.azure.monitor.opentelemetry.exporter.AzureMonitorTraceExporter"/>
185190

eng/code-quality-reports/src/main/resources/revapi/revapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
},
6767
{
6868
"matcher": "java-package",
69-
"match": "/(kotlin|okhttp3|okio)(\\..+)?/"
69+
"match": "/(kotlin|okhttp3|okio|io\\.vertx)(\\..+)?/"
7070
},
7171
{
7272
"matcher": "java-package",

eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2263,7 +2263,10 @@
22632263

22642264
<!-- Empty byte array is returned as null to reactor. Reactor transform null from Callable to downstream onComplete -->
22652265
<Match>
2266-
<Class name="~com\.azure\.core\.http\.okhttp\.implementation\.OkHttpAsyncResponse(.*)"/>
2266+
<Or>
2267+
<Class name="~com\.azure\.core\.http\.okhttp\.implementation\.OkHttpAsyncResponse(.*)"/>
2268+
<Class name="~com\.azure\.core\.http\.vertx\.implementation\.VertxHttpAsyncResponse(.*)"/>
2269+
</Or>
22672270
<Method name="~(.*)\$(getBodyAsByteArray|null)\$(.*)"/>
22682271
<Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
22692272
</Match>

eng/versioning/external_dependencies.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ io.projectreactor.netty:reactor-netty;1.0.18
6666
io.projectreactor.netty:reactor-netty-http;1.0.18
6767
io.projectreactor:reactor-core;3.4.17
6868
io.reactivex:rxjava;1.3.8
69+
io.vertx:vertx-codegen;4.2.7
70+
io.vertx:vertx-core;4.2.7
6971
jakarta.validation:jakarta.validation-api;2.0.2
7072
jakarta.xml.bind:jakarta.xml.bind-api;2.3.3
7173
javax.annotation:javax.annotation-api;1.3.2

eng/versioning/version_client.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ com.azure:azure-core-experimental;1.0.0-beta.29;1.0.0-beta.30
7373
com.azure:azure-core-http-jdk-httpclient;1.0.0-beta.1;1.0.0-beta.1
7474
com.azure:azure-core-http-netty;1.12.2;1.13.0-beta.1
7575
com.azure:azure-core-http-okhttp;1.10.1;1.11.0-beta.1
76+
com.azure:azure-core-http-vertx;1.0.0-beta.1;1.0.0-beta.1
7677
com.azure:azure-core-management;1.6.2;1.7.0-beta.1
7778
com.azure:azure-core-perf;1.0.0-beta.1;1.0.0-beta.1
7879
com.azure:azure-core-serializer-avro-apache;1.0.0-beta.25;1.0.0-beta.26

pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<module>sdk/core/azure-core-http-jdk-httpclient</module>
5252
<module>sdk/core/azure-core-http-netty</module>
5353
<!-- <module>sdk/core/azure-core-http-okhttp</module>-->
54+
<module>sdk/core/azure-core-http-vertx</module>
5455
<module>sdk/core/azure-core-management</module>
5556
<module>sdk/core/azure-core-serializer-avro-apache</module>
5657
<module>sdk/core/azure-core-serializer-json-gson</module>
@@ -215,6 +216,7 @@
215216
<module>sdk/core/azure-core-http-jdk-httpclient</module>
216217
<module>sdk/core/azure-core-http-netty</module>
217218
<module>sdk/core/azure-core-http-okhttp</module>
219+
<module>sdk/core/azure-core-http-vertx</module>
218220
<module>sdk/core/azure-core-management</module>
219221
<module>sdk/core/azure-core-serializer-avro-apache</module>
220222
<module>sdk/core/azure-core-serializer-json-gson</module>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Release History
2+
3+
## 1.0.0-beta.1 (Unreleased)
4+
5+
### Features Added
6+
7+
### Breaking Changes
8+
9+
### Bugs Fixed
10+
11+
### Other Changes
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Azure Core Vert.x HTTP plugin library for Java
2+
3+
Azure Core Vert.x HTTP client is a plugin for the `azure-core` HTTP client API.
4+
5+
## Getting started
6+
7+
### Prerequisites
8+
9+
- A [Java Development Kit (JDK)][jdk_link], version 8 or later.
10+
11+
### Include the package
12+
13+
[//]: # ({x-version-update-start;com.azure:azure-core-http-vertx;current})
14+
```xml
15+
<dependencies>
16+
<dependency>
17+
<groupId>com.azure</groupId>
18+
<artifactId>azure-core-http-vertx</artifactId>
19+
<version>1.0.0-beta.1</version>
20+
</dependency>
21+
</dependencies>
22+
```
23+
[//]: # ({x-version-update-end})
24+
25+
## Key concepts
26+
27+
## Examples
28+
29+
The following sections provide several code snippets covering some of the most common client configuration scenarios.
30+
31+
- [Create a Simple Client](#create-a-simple-client)
32+
- [Create a Client with Proxy](#create-a-client-with-proxy)
33+
34+
### Create a Simple Client
35+
36+
Create a Vert.x HttpClient.
37+
38+
```java readme-sample-createBasicClient
39+
HttpClient client = new VertxAsyncHttpClientBuilder().build();
40+
```
41+
42+
Create a Vert.x HttpClient using a connection timeout of 60 seconds.
43+
44+
```java readme-sample-createClientWithConnectionTimeout
45+
HttpClient client = new VertxAsyncHttpClientBuilder().connectTimeout(Duration.ofSeconds(60)).build();
46+
```
47+
48+
### Create a Client with Proxy
49+
50+
Create an Vert.x client that is using a proxy.
51+
52+
```java readme-sample-createProxyClient
53+
HttpClient client = new VertxAsyncHttpClientBuilder()
54+
.proxy(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("<proxy-host>", 8888)))
55+
.build();
56+
```
57+
58+
## Next steps
59+
60+
Get started with Azure libraries that are [built using Azure Core](https://azure.github.io/azure-sdk/releases/latest/#java).
61+
62+
## Troubleshooting
63+
64+
If you encounter any bugs, please file issues via [GitHub Issues](https://github.com/Azure/azure-sdk-for-java/issues/new/choose)
65+
or checkout [StackOverflow for Azure Java SDK](https://stackoverflow.com/questions/tagged/azure-java-sdk).
66+
67+
### Enabling Logging
68+
69+
Azure SDKs for Java provide a consistent logging story to help aid in troubleshooting application errors and expedite
70+
their resolution. The logs produced will capture the flow of an application before reaching the terminal state to help
71+
locate the root issue. View the [logging][logging] wiki for guidance about enabling logging.
72+
73+
## Contributing
74+
75+
For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md).
76+
77+
1. Fork it
78+
1. Create your feature branch (`git checkout -b my-new-feature`)
79+
1. Commit your changes (`git commit -am 'Add some feature'`)
80+
1. Push to the branch (`git push origin my-new-feature`)
81+
1. Create new Pull Request
82+
83+
<!-- Links -->
84+
[logging]: https://github.com/Azure/azure-sdk-for-java/wiki/Logging-with-Azure-SDK
85+
[jdk_link]: https://docs.microsoft.com/java/azure/jdk/?view=azure-java-stable
86+
87+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fcore%2Fazure-core-http-vertx%2FREADME.png)
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
<!--
2+
~ Copyright (c) Microsoft Corporation. All rights reserved.
3+
~ Licensed under the MIT License.
4+
-->
5+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
7+
<modelVersion>4.0.0</modelVersion>
8+
<parent>
9+
<groupId>com.azure</groupId>
10+
<artifactId>azure-client-sdk-parent</artifactId>
11+
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
12+
<relativePath>../../parents/azure-client-sdk-parent</relativePath>
13+
</parent>
14+
15+
<groupId>com.azure</groupId>
16+
<artifactId>azure-core-http-vertx</artifactId>
17+
<packaging>jar</packaging>
18+
<version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:azure-core-http-vertx;current} -->
19+
20+
<name>Microsoft Azure Vert.x HTTP Client Library</name>
21+
<description>This package contains the Vert.x HTTP client plugin for azure-core.</description>
22+
<url>https://github.com/Azure/azure-sdk-for-java</url>
23+
24+
<licenses>
25+
<license>
26+
<name>The MIT License (MIT)</name>
27+
<url>http://opensource.org/licenses/MIT</url>
28+
<distribution>repo</distribution>
29+
</license>
30+
</licenses>
31+
32+
<distributionManagement>
33+
<site>
34+
<id>azure-java-build-docs</id>
35+
<url>${site.url}/site/${project.artifactId}</url>
36+
</site>
37+
</distributionManagement>
38+
39+
<scm>
40+
<url>https://github.com/Azure/azure-sdk-for-java</url>
41+
<connection>scm:git:https://github.com/Azure/azure-sdk-for-java.git</connection>
42+
<developerConnection>scm:git:https://github.com/Azure/azure-sdk-for-java.git</developerConnection>
43+
</scm>
44+
45+
<properties>
46+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
47+
<legal><![CDATA[[INFO] Any downloads listed may be third party software. Microsoft grants you no rights for third party software.]]></legal>
48+
<jacoco.min.linecoverage>0.80</jacoco.min.linecoverage>
49+
<jacoco.min.branchcoverage>0.80</jacoco.min.branchcoverage>
50+
<javaModulesSurefireArgLine>
51+
--add-opens com.azure.core.http.vertx/com.azure.core.http.vertx=ALL-UNNAMED
52+
--add-opens com.azure.core.http.vertx/com.azure.core.http.vertx.implementation=ALL-UNNAMED
53+
</javaModulesSurefireArgLine>
54+
</properties>
55+
56+
<developers>
57+
<developer>
58+
<id>microsoft</id>
59+
<name>Microsoft</name>
60+
</developer>
61+
</developers>
62+
63+
<dependencies>
64+
<dependency>
65+
<groupId>com.azure</groupId>
66+
<artifactId>azure-core</artifactId>
67+
<version>1.30.0-beta.1</version> <!-- {x-version-update;com.azure:azure-core;current} -->
68+
</dependency>
69+
70+
<!-- Required to satisfy the -Xlint:classfile compiler option -->
71+
<dependency>
72+
<groupId>io.vertx</groupId>
73+
<artifactId>vertx-codegen</artifactId>
74+
<version>4.2.7</version> <!-- {x-version-update;io.vertx:vertx-codegen;external_dependency} -->
75+
<scope>provided</scope>
76+
</dependency>
77+
78+
<dependency>
79+
<groupId>io.vertx</groupId>
80+
<artifactId>vertx-core</artifactId>
81+
<version>4.2.7</version> <!-- {x-version-update;io.vertx:vertx-core;external_dependency} -->
82+
</dependency>
83+
84+
<!-- test dependencies on azure-core, because we want to run tests inherited from this module using Vert.x Web Client -->
85+
<dependency>
86+
<groupId>com.azure</groupId>
87+
<artifactId>azure-core</artifactId>
88+
<version>1.30.0-beta.1</version> <!-- {x-version-update;com.azure:azure-core;current} -->
89+
<type>test-jar</type>
90+
<scope>test</scope>
91+
</dependency>
92+
<dependency>
93+
<groupId>com.azure</groupId>
94+
<artifactId>azure-core-test</artifactId>
95+
<version>1.10.0-beta.1</version> <!-- {x-version-update;com.azure:azure-core-test;current} -->
96+
<scope>test</scope>
97+
</dependency>
98+
<dependency>
99+
<groupId>com.azure</groupId>
100+
<artifactId>azure-core-test</artifactId>
101+
<version>1.10.0-beta.1</version> <!-- {x-version-update;com.azure:azure-core-test;current} -->
102+
<type>test-jar</type>
103+
<scope>test</scope>
104+
</dependency>
105+
<dependency>
106+
<groupId>io.projectreactor</groupId>
107+
<artifactId>reactor-test</artifactId>
108+
<version>3.4.17</version> <!-- {x-version-update;io.projectreactor:reactor-test;external_dependency} -->
109+
<scope>test</scope>
110+
</dependency>
111+
112+
<dependency>
113+
<groupId>org.junit.jupiter</groupId>
114+
<artifactId>junit-jupiter-api</artifactId>
115+
<version>5.8.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-api;external_dependency} -->
116+
<scope>test</scope>
117+
</dependency>
118+
<dependency>
119+
<groupId>org.junit.jupiter</groupId>
120+
<artifactId>junit-jupiter-engine</artifactId>
121+
<version>5.8.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-engine;external_dependency} -->
122+
<scope>test</scope>
123+
</dependency>
124+
<dependency>
125+
<groupId>org.junit.jupiter</groupId>
126+
<artifactId>junit-jupiter-params</artifactId>
127+
<version>5.8.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-params;external_dependency} -->
128+
<scope>test</scope>
129+
</dependency>
130+
131+
<dependency>
132+
<groupId>com.github.tomakehurst</groupId>
133+
<artifactId>wiremock-standalone</artifactId>
134+
<version>2.24.1</version> <!-- {x-version-update;com.github.tomakehurst:wiremock-standalone;external_dependency} -->
135+
<scope>test</scope>
136+
</dependency>
137+
<dependency>
138+
<groupId>org.mockito</groupId>
139+
<artifactId>mockito-inline</artifactId>
140+
<version>4.0.0</version><!-- {x-version-update;org.mockito:mockito-inline;external_dependency} -->
141+
<scope>test</scope>
142+
</dependency>
143+
</dependencies>
144+
145+
<build>
146+
<plugins>
147+
<plugin>
148+
<groupId>org.apache.maven.plugins</groupId>
149+
<artifactId>maven-enforcer-plugin</artifactId>
150+
<version>3.0.0-M3</version> <!-- {x-version-update;org.apache.maven.plugins:maven-enforcer-plugin;external_dependency} -->
151+
<configuration>
152+
<rules>
153+
<bannedDependencies>
154+
<includes>
155+
<include>io.vertx:vertx-codegen:[4.2.7]</include> <!-- {x-include-update;io.vertx:vertx-codegen;external_dependency} -->
156+
<include>io.vertx:vertx-core:[4.2.7]</include> <!-- {x-include-update;io.vertx:vertx-core;external_dependency} -->
157+
</includes>
158+
</bannedDependencies>
159+
</rules>
160+
</configuration>
161+
</plugin>
162+
163+
<plugin>
164+
<groupId>org.apache.maven.plugins</groupId>
165+
<artifactId>maven-compiler-plugin</artifactId>
166+
<version>3.8.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-compiler-plugin;external_dependency} -->
167+
<configuration>
168+
<compilerArgs>
169+
<arg>-Xlint:deprecation</arg>
170+
</compilerArgs>
171+
</configuration>
172+
</plugin>
173+
</plugins>
174+
</build>
175+
</project>

0 commit comments

Comments
 (0)