diff --git a/micrometer-core/build.gradle b/micrometer-core/build.gradle index 643ca983e0..5c894dd4b5 100644 --- a/micrometer-core/build.gradle +++ b/micrometer-core/build.gradle @@ -38,10 +38,6 @@ dependencies { optionalApi 'ch.qos.logback:logback-classic' optionalApi 'org.apache.logging.log4j:log4j-core' - // reactor - optionalApi 'io.projectreactor:reactor-core' - optionalApi 'io.projectreactor.netty:reactor-netty-http' - // @Timed AOP optionalApi 'org.aspectj:aspectjweaver' diff --git a/micrometer-core/src/main/java/io/micrometer/core/ipc/http/ReactorNettySender.java b/micrometer-core/src/main/java/io/micrometer/core/ipc/http/ReactorNettySender.java deleted file mode 100644 index 4a6cdb710e..0000000000 --- a/micrometer-core/src/main/java/io/micrometer/core/ipc/http/ReactorNettySender.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright 2018 VMware, Inc. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * https://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.micrometer.core.ipc.http; - -import io.netty.handler.codec.http.HttpMethod; -import reactor.core.publisher.Mono; -import reactor.netty.http.client.HttpClient; -import reactor.util.function.Tuple2; - -/** - * {@link HttpSender} implementation based on the Reactor Netty {@link HttpClient}. - * - * @author Jon Schneider - * @since 1.1.0 - * @deprecated use a different {@link HttpSender} implementation or report your use case for this to the Micrometer project maintainers - */ -@Deprecated -public class ReactorNettySender implements HttpSender { - private final HttpClient httpClient; - - public ReactorNettySender(HttpClient httpClient) { - this.httpClient = httpClient; - } - - public ReactorNettySender() { - this(HttpClient.create()); - } - - @Override - public Response send(Request request) { - Tuple2 response = httpClient - .request(toNettyHttpMethod(request.getMethod())) - .uri(request.getUrl().toString()) - .send((httpClientRequest, nettyOutbound) -> { - request.getRequestHeaders().forEach(httpClientRequest::addHeader); - return nettyOutbound.sendByteArray(Mono.just(request.getEntity())); - }) - .responseSingle((r, body) -> Mono.just(r.status().code()).zipWith(body.asString().defaultIfEmpty(""))) - .block(); - - return new Response(response.getT1(), response.getT2()); - } - - private HttpMethod toNettyHttpMethod(Method method) { - switch (method) { - case PUT: - return HttpMethod.PUT; - case POST: - return HttpMethod.POST; - case HEAD: - return HttpMethod.HEAD; - case GET: - return HttpMethod.GET; - case DELETE: - return HttpMethod.DELETE; - case OPTIONS: - return HttpMethod.OPTIONS; - default: - throw new UnsupportedOperationException("http method " + method.toString() + " is not supported by the reactor netty client"); - } - } -} diff --git a/micrometer-core/src/test/java/io/micrometer/core/ipc/http/ReactorNettySenderTests.java b/micrometer-core/src/test/java/io/micrometer/core/ipc/http/ReactorNettySenderTests.java deleted file mode 100644 index cc640872ac..0000000000 --- a/micrometer-core/src/test/java/io/micrometer/core/ipc/http/ReactorNettySenderTests.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright 2019 VMware, Inc. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * https://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.micrometer.core.ipc.http; - -import com.github.tomakehurst.wiremock.WireMockServer; -import io.netty.handler.timeout.ReadTimeoutException; -import io.netty.handler.timeout.ReadTimeoutHandler; -import io.netty.handler.timeout.WriteTimeoutHandler; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import reactor.netty.http.client.HttpClient; -import ru.lanwen.wiremock.ext.WiremockResolver; - -import java.util.concurrent.TimeUnit; - -import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -@SuppressWarnings("deprecation") -@ExtendWith(WiremockResolver.class) -class ReactorNettySenderTests { - HttpSender httpSender = new ReactorNettySender(); - - @Test - void customReadTimeoutHonored(@WiremockResolver.Wiremock WireMockServer server) { - this.httpSender = new ReactorNettySender(HttpClient.create() - .doOnConnected(connection -> - connection.addHandlerLast(new ReadTimeoutHandler(1, TimeUnit.MILLISECONDS)) - .addHandlerLast(new WriteTimeoutHandler(1, TimeUnit.MILLISECONDS)))); - server.stubFor(any(urlEqualTo("/metrics")).willReturn(ok().withFixedDelay(5))); - - assertThatExceptionOfType(ReadTimeoutException.class) - .isThrownBy(() -> httpSender.post(server.baseUrl() + "/metrics").send()); - } -} diff --git a/micrometer-test/src/test/java/io/micrometer/core/ipc/http/ReactorNettySenderTest.java b/micrometer-test/src/test/java/io/micrometer/core/ipc/http/ReactorNettySenderTest.java deleted file mode 100644 index 824f12eddf..0000000000 --- a/micrometer-test/src/test/java/io/micrometer/core/ipc/http/ReactorNettySenderTest.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright 2018 VMware, Inc. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * https://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.micrometer.core.ipc.http; - -@Deprecated -class ReactorNettySenderTest extends HttpSenderCompatibilityKit { - @Override - public HttpSender httpClient() { - return new ReactorNettySender(); - } -}