diff --git a/pom.xml b/pom.xml index 53cc1fd..27dc920 100644 --- a/pom.xml +++ b/pom.xml @@ -101,6 +101,62 @@ pom import + + pl.tkowalcz.tjahzi + logback-appender + 0.9.23 + + + com.github.loki4j + loki-logback-appender-jdk8 + 1.4.2 + + + org.apache.httpcomponents + httpclient + 4.5.13 + + + dev.failsafe + failsafe + 3.2.4 + + + org.eclipse.collections + eclipse-collections + 10.4.0 + runtime + + + org.eclipse.collections + eclipse-collections-api + 10.4.0 + + + com.fasterxml.jackson.datatype + jackson-datatype-eclipse-collections + 2.13.5 + + + cn.hutool + hutool-all + 5.7.16 + + + com.github.ulisesbocchio + jasypt-spring-boot-starter + 3.0.4 + + + org.apache.pulsar + pulsar-client + 2.8.0 + + + org.apache.pulsar + pulsar-client-admin + 2.8.0 + diff --git a/service-configuration/src/main/java/com/lanyuanxiaoyao/service/configuration/entity/pulsar/PulsarInfo.java b/service-configuration/src/main/java/com/lanyuanxiaoyao/service/configuration/entity/pulsar/PulsarInfo.java index e1ab254..4823549 100644 --- a/service-configuration/src/main/java/com/lanyuanxiaoyao/service/configuration/entity/pulsar/PulsarInfo.java +++ b/service-configuration/src/main/java/com/lanyuanxiaoyao/service/configuration/entity/pulsar/PulsarInfo.java @@ -1,9 +1,8 @@ package com.lanyuanxiaoyao.service.configuration.entity.pulsar; -import cn.hutool.core.collection.ListUtil; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.ImmutableList; +import org.eclipse.collections.api.map.ImmutableMap; /** * Pulsar 信息 @@ -12,10 +11,10 @@ import java.util.stream.Collectors; * @date 2023-04-28 */ public class PulsarInfo { - public static final List DEFAULT_INFOS = ListUtil.of( + public static final ImmutableList DEFAULT_INFOS = Lists.immutable.of( new PulsarInfo( "main", - ListUtil.of( + Lists.immutable.of( "132.122.113.167:16680", "132.122.113.168:16680", "132.122.113.169:16680", @@ -32,7 +31,7 @@ public class PulsarInfo { ), new PulsarInfo( "acct", - ListUtil.of( + Lists.immutable.of( "132.122.115.158:16650", "132.122.115.159:16650", "132.122.115.160:16650", @@ -45,7 +44,7 @@ public class PulsarInfo { ), new PulsarInfo( "order", - ListUtil.of( + Lists.immutable.of( "132.122.115.158:16660", "132.122.115.159:16660", "132.122.115.160:16660", @@ -58,7 +57,7 @@ public class PulsarInfo { ), new PulsarInfo( "cust", - ListUtil.of( + Lists.immutable.of( "132.122.113.167:16670", "132.122.113.168:16670", "132.122.113.169:16670", @@ -74,34 +73,24 @@ public class PulsarInfo { "132.122.113.167:18108" ) ); - public static final Map PULSAR_CLIENT_INFO_MAPPING = DEFAULT_INFOS.stream() - .flatMap(info -> info.getBrokers() - .stream() - .map(url -> new Pair<>(url, info))) - .collect(Collectors.toMap(Pair::getLeft, Pair::getRight)); - public static final Map PULSAR_CLIENT_NAME_MAPPING = PULSAR_CLIENT_INFO_MAPPING.entrySet() - .stream() - .map(entry -> new Pair<>(entry.getKey(), entry.getValue().name)) - .collect(Collectors.toMap(Pair::getLeft, Pair::getRight)); - public static final Map PULSAR_CLIENT_ADMIN_MAPPING = PULSAR_CLIENT_INFO_MAPPING.entrySet() - .stream() - .map(entry -> new Pair<>(entry.getKey(), entry.getValue().admin)) - .collect(Collectors.toMap(Pair::getLeft, Pair::getRight)); - public static final Map PULSAR_CLIENT_PRESTO_MAPPING = PULSAR_CLIENT_INFO_MAPPING.entrySet() - .stream() - .map(entry -> new Pair<>(entry.getKey(), entry.getValue().presto)) - .collect(Collectors.toMap(Pair::getLeft, Pair::getRight)); - public static final Map PULSAR_NAME_INFO_MAPPING = DEFAULT_INFOS.stream() - .collect(Collectors.toMap(PulsarInfo::getName, info -> info)); + public static final ImmutableMap PULSAR_CLIENT_INFO_MAPPING = DEFAULT_INFOS + .flatCollect(info -> info.getBrokers() + .collect(url -> new Pair<>(url, info))) + .toMap(Pair::getLeft, Pair::getRight) + .toImmutable(); + public static final ImmutableMap PULSAR_CLIENT_NAME_MAPPING = PULSAR_CLIENT_INFO_MAPPING.collectValues((key, value) -> value.getName()); + public static final ImmutableMap PULSAR_CLIENT_ADMIN_MAPPING = PULSAR_CLIENT_INFO_MAPPING.collectValues((key, value) -> value.getAdmin()); + public static final ImmutableMap PULSAR_CLIENT_PRESTO_MAPPING = PULSAR_CLIENT_INFO_MAPPING.collectValues((key, value) -> value.getPresto()); + public static final ImmutableMap PULSAR_NAME_INFO_MAPPING = DEFAULT_INFOS.toMap(PulsarInfo::getName, info -> info).toImmutable(); private String name; - private List brokers; + private ImmutableList brokers; private String presto; private String admin; public PulsarInfo() { } - public PulsarInfo(String name, List brokers, String presto, String admin) { + public PulsarInfo(String name, ImmutableList brokers, String presto, String admin) { this.name = name; this.brokers = brokers; this.presto = presto; @@ -112,7 +101,7 @@ public class PulsarInfo { return name; } - public List getBrokers() { + public ImmutableList getBrokers() { return brokers; } diff --git a/service-dependencies/pom.xml b/service-dependencies/pom.xml index 19a7656..78f1c0b 100644 --- a/service-dependencies/pom.xml +++ b/service-dependencies/pom.xml @@ -61,48 +61,39 @@ pl.tkowalcz.tjahzi logback-appender - 0.9.23 com.github.loki4j loki-logback-appender-jdk8 - 1.4.2 org.apache.httpcomponents httpclient - 4.5.13 dev.failsafe failsafe - 3.2.4 org.eclipse.collections eclipse-collections - 10.4.0 runtime org.eclipse.collections eclipse-collections-api - 10.4.0 com.fasterxml.jackson.datatype jackson-datatype-eclipse-collections - 2.13.5 cn.hutool hutool-all - 5.7.16 com.github.ulisesbocchio jasypt-spring-boot-starter - 3.0.4 \ No newline at end of file diff --git a/service-pulsar-query/pom.xml b/service-pulsar-query/pom.xml index 9d01984..6711137 100644 --- a/service-pulsar-query/pom.xml +++ b/service-pulsar-query/pom.xml @@ -25,7 +25,6 @@ org.apache.pulsar pulsar-client - 2.8.0 javax.validation @@ -36,7 +35,6 @@ org.apache.pulsar pulsar-client-admin - 2.8.0 javax.validation