【问题标题】:How does Spring Micro service know Axon Server PortSpring Micro 服务如何知道 Axon Server Port
【发布时间】:2021-10-02 07:25:23
【问题描述】:

整个代码可在:https://github.com/Naresh-Chaurasia/API-MicroServices-Kafka/tree/master/Microservices-CQRS-SAGA-Kafka/DiscoveryService

我有以下 spring-boot 设置。

  • 客户端/邮递员正在调用 API 网关(也充当负载平衡器)。
  • API 网关和产品是 Spring Boot 应用程序/微服务,已在 Eureka 中注册
  • 发现服务(也称为 Spring Boot 应用程序)。
  • 我按以下顺序运行应用程序:Eureka 发现服务、产品、API 网关

在产品的 pom.xml 文件中,我有以下条目:

<dependency>
    <groupId>org.axonframework</groupId>
    <artifactId>axon-spring-boot-starter</artifactId>
    <version>4.4.7</version>
</dependency>

我正在使用以下Axon Server:AxonServer-4.5.5.jar来运行Axon Server,axonserver.properties条目如下:

server.port=8026
axoniq.axonserver.name=My Axon Server
axoniq.axonserver.hostname=localhost
axoniq.axonserver.devmode.enabled=true

Axon 服务器的默认端口是 8024。我尝试通过更新 axonserver.properties 文件在 8024、8025、8026 上运行它。 Axon 服务器在 localhost 上运行。

每次我通过更新 axonserver.properties 文件更改 Axon 服务器中的端口时,产品微服务都会识别 Axon 服务器,即使 Axon 服务器未在默认端口上运行。我没有在产品微服务中指定 Axon 服务器端口。

我的问题是:即使我不是在产品微服务中指定端口,产品微服务如何识别正确的端口。

【问题讨论】:

    标签: spring-boot event-handling microservices spring-cloud axon


    【解决方案1】:

    我相信你误解了这里的端口。 Axon Server 有 3 个端口:

    • server.port:Axon 服务器控制台的 HTTP 端口。默认为8024
    • port:Axon 服务器节点的 gRPC 端口。默认为8124
    • internal-port:用于集群内 Axon 服务器节点之间通信的 gRPC 端口(仅限 Axon EE)。默认为8224

    因此,默认的 AF 应用程序将始终尝试连接到运行在 8124 的 Axon 服务器,这是 gRPC 端口。 8024 端口用于访问 AS 仪表板(以及其他更具体的内容,例如 Rest API 端点)。

    要添加更多内容,您可以在此处查看参考指南以获取完整的属性和配置列表:https://docs.axoniq.io/reference-guide/axon-server/administration/admin-configuration/configuration#configuration-properties

    【讨论】:

      猜你喜欢
      • 2021-09-20
      • 1970-01-01
      • 2019-07-30
      • 2020-11-06
      • 1970-01-01
      • 2013-10-24
      • 1970-01-01
      • 2016-11-13
      • 1970-01-01
      相关资源
      最近更新 更多