From 32fe92d0a7ff08e2eb61c5ac1d0084af65f99800 Mon Sep 17 00:00:00 2001 From: ZhangJian He Date: Fri, 30 Aug 2024 11:20:25 +0800 Subject: [PATCH] feat: init reactor client (#12) Signed-off-by: ZhangJian He --- bookkeeper-admin-api/pom.xml | 2 +- bookkeeper-admin-jdk/pom.xml | 2 +- bookkeeper-admin-reactor/pom.xml | 2 +- .../bookkeeper/admin/reactor/Configuration.java | 17 +++++++++++++++++ .../admin/reactor/InnerReactorClient.java | 17 +++++++++++++++++ pom.xml | 2 +- 6 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 bookkeeper-admin-reactor/src/main/java/io/github/protocol/bookkeeper/admin/reactor/Configuration.java diff --git a/bookkeeper-admin-api/pom.xml b/bookkeeper-admin-api/pom.xml index 87da934..f909fdd 100644 --- a/bookkeeper-admin-api/pom.xml +++ b/bookkeeper-admin-api/pom.xml @@ -6,7 +6,7 @@ io.github.protocol-laboratory bookkeeper-admin-parent - 0.0.2 + 0.0.3 bookkeeper-admin-api diff --git a/bookkeeper-admin-jdk/pom.xml b/bookkeeper-admin-jdk/pom.xml index 95dbb29..86b0b3c 100644 --- a/bookkeeper-admin-jdk/pom.xml +++ b/bookkeeper-admin-jdk/pom.xml @@ -6,7 +6,7 @@ io.github.protocol-laboratory bookkeeper-admin-parent - 0.0.2 + 0.0.3 bookkeeper-admin-jdk diff --git a/bookkeeper-admin-reactor/pom.xml b/bookkeeper-admin-reactor/pom.xml index 341ab2a..dc62f75 100644 --- a/bookkeeper-admin-reactor/pom.xml +++ b/bookkeeper-admin-reactor/pom.xml @@ -6,7 +6,7 @@ io.github.protocol-laboratory bookkeeper-admin-parent - 0.0.2 + 0.0.3 bookkeeper-admin-reactor diff --git a/bookkeeper-admin-reactor/src/main/java/io/github/protocol/bookkeeper/admin/reactor/Configuration.java b/bookkeeper-admin-reactor/src/main/java/io/github/protocol/bookkeeper/admin/reactor/Configuration.java new file mode 100644 index 0000000..7878eb4 --- /dev/null +++ b/bookkeeper-admin-reactor/src/main/java/io/github/protocol/bookkeeper/admin/reactor/Configuration.java @@ -0,0 +1,17 @@ +package io.github.protocol.bookkeeper.admin.reactor; + +import lombok.Getter; +import lombok.Setter; + +@Setter +@Getter +public class Configuration { + private String host = "localhost"; + + private int port; + + public boolean tlsEnable; + + public Configuration() { + } +} diff --git a/bookkeeper-admin-reactor/src/main/java/io/github/protocol/bookkeeper/admin/reactor/InnerReactorClient.java b/bookkeeper-admin-reactor/src/main/java/io/github/protocol/bookkeeper/admin/reactor/InnerReactorClient.java index 7c0f234..1bbd8c2 100644 --- a/bookkeeper-admin-reactor/src/main/java/io/github/protocol/bookkeeper/admin/reactor/InnerReactorClient.java +++ b/bookkeeper-admin-reactor/src/main/java/io/github/protocol/bookkeeper/admin/reactor/InnerReactorClient.java @@ -1,4 +1,21 @@ package io.github.protocol.bookkeeper.admin.reactor; +import reactor.netty.http.client.HttpClient; + public class InnerReactorClient { + private final HttpClient httpClient; + + private final String httpPrefix; + + public InnerReactorClient(Configuration conf) { + HttpClient client = HttpClient.create(); + + if (conf.isTlsEnable()) { + this.httpPrefix = "https://" + conf.getHost() + ":" + conf.getPort(); + } else { + this.httpPrefix = "http://" + conf.getHost() + ":" + conf.getPort(); + } + + this.httpClient = client; + } } diff --git a/pom.xml b/pom.xml index befb3d9..d865c00 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.github.protocol-laboratory bookkeeper-admin-parent - 0.0.2 + 0.0.3 pom