Axon 参考指南
  • 介绍
  • 架构概览
    • DDD & CQRS 概念
    • 事件溯源
    • 事件驱动的微服务
  • Axon Server
  • 发行说明
    • Axon Framework
      • Major Releases
      • Minor Releases
    • Axon Server
      • Major Releases
      • Minor Releases Standard Edition
      • Minor Releases Enterprise Edition
    • Axon Framework Extensions
      • AMQP
        • Major Releases
      • CDI
        • Major Releases
      • JGroups
        • Major Releases
      • Kafka
        • Major Releases
        • Minor Releases
      • Kotlin
        • Experimental Releases
      • Mongo
        • Major Releases
        • Minor Releases
      • Reactor
        • Major Releases
        • Minor Releases
      • Spring Cloud
        • Major Releases
        • Minor Releases
      • Tracing
        • Major Releases
        • Minor Releases
  • Getting Started
    • 快速开始
  • Axon Framework
    • 介绍
    • 消息传递概念
      • 消息剖析
      • 消息关联
      • 消息拦截
      • 支持带注解的处理程序
      • 异常处理
      • 工作单元
    • 命令
      • 建模
        • 聚合
        • 多实体聚合
        • 聚合状态存储
        • 从另一个聚合创建聚合
        • 聚合多态性
        • 解决冲突
      • 命令调度器
      • 命令处理程序
      • 基础设施
      • 配置
    • 事件
      • 事件调度器
      • 事件处理程序
      • 事件处理器
        • 订阅事件处理器
        • 流式事件处理器
      • 事件总线和事件存储
      • 事件版本控制
    • 查询
      • 查询处理
      • 查询调度器
      • 查询处理程序
      • 实现
      • 配置
    • 长时处理过程(Sagas)
      • 实现
      • 关联
      • 基础设施
    • Deadlines
      • Deadline Managers
      • Event Schedulers
    • 测试
      • 命令 / 事件
      • 长时处理过程(Sagas)
    • 序列化
    • 调整
      • 事件快照
      • 事件处理
      • 命令处理
    • 监控和指标
    • Spring Boot 集成
    • 模块
  • Axon Server
    • 介绍
    • 安装
      • 本地安装
        • Axon Server SE
        • Axon Server EE
      • Docker / K8s
        • Axon Server SE
        • Axon Server EE
    • 管理
      • 配置
        • System Properties
        • Command Line Interface
        • REST API
        • GRPC API
      • Monitoring
        • Actuator Endpoints
        • gRPC Metrics
        • Heartbeat Monitoring
      • Clusters
      • Replication Groups
      • Multi-Context
      • Tagging
      • Backup and Messaging-only Nodes
      • Backups
      • Recovery
      • Plugins
      • Error Codes
    • 安全
      • SSL
      • 访问控制
      • 访问控制 - 标准版
      • 访问控制 - 企业版
      • 访问控制 - 客户端应用程序
      • 访问控制 - 命令行
      • 访问控制 - REST API
      • 访问控制 - LDAP
      • 访问控制 - OAuth 2.0
    • 性能
      • 事件段
      • 流量控制
    • 迁移
      • Standard to Enterprise Edition
      • Non-Axon Server to Axon Server
  • Extensions
    • Spring AMQP
    • JGroups
    • Kafka
    • Kotlin
    • Mongo
    • Reactor
      • Reactor Gateways
    • Spring Cloud
    • Tracing
  • Appendices
    • A. RDBMS Tuning
    • B. Message Handler Tuning
      • 参数解析器
      • 处理程序增强
    • C. 元数据注解
    • D. 标识符生成
    • E. Axon Server Query Language
由 GitBook 提供支持
在本页
  • Tag based routing
  • Connection distribution
  • Tag Matching
  • Enabling tagging
  • Axon Server
  • Client
  1. Axon Server
  2. 管理

Tagging

You can use tagging in Axon for 2 different scenarios:

  1. You want to control which command handler or query handler executes a command or query, or

  2. You want to control to which Axon Server node a particular client connects.

Tag based routing

Note

This feature is only available with Axon Server version 4.4 onwards.

Axon Server matches metadata elements provided in a command or a query to tags defined on the command and client handling applications. For instance, you could tag commands with a country code and set the country code in the tags of the handler application. In this case, Axon Server will try to find a command handler with the same country code and send the command to that handler. If there are multiple applications found with a command handler for the requested command and matching tags, Axon Server will pick one based on the provided routing key. The same will happen if there are no applications found with matching tags, so commands will not fail because there are no matching tags. You can, of course, have multiple tags on an application, Axon Server will select the one with most the matching tags.

Connection distribution

Note

This feature is only available in Axon Server Enterprise and compatible with version 4.2 onwards of Axon.

To optimize the connections between framework clients and Axon Server, it is possible to tag both clients and Axon Server with information which describes properties of those clients and nodes. Axon Server will then use these tags to make a connection to the client.‌

A typical tag could describe where the respective client and server node are running (e.g. a cloud provider's region) encouraging that the nearest, and therefore fastest, connections are made.‌

Tag Matching

A match is made when the the label and the value of the tag matches. For example, a server tagged with computeRegion=europe will match with a client tag of computeRegion=europe. Similarly if a server is tagged with computeRegion=europe and client is tagged with computeRegion=asia then this is not considered a match.‌

If both client and server are tagged with multiple tags then the connection that is made will be based on the highest number of matches. If multiple nodes have a equal number of matching tags then the node with the lightest load is chosen.‌

If no matching tags are available at all, it will connect to any available node.

Enabling tagging

To enable tagging you must configure both the client and server.

Axon Server

You can configure the tags that you would like for each node through properties using axoniq.axonserver.tags.computeRegion=europe. Additional tags can be specified by adding to the tags element (e.g. axoniq.axonserver.tags.networkSpeed=fast).‌

Client

On the client side, there are two approaches through which you can specify tags. Either the properties file is expanded (similar to server configuration, also allowing additional tags to be added) in a Spring Boot environment, or a TagsConfiguration object is registered to the Configurer.

Map<String, String> tags = new HashMap();
// Insert tags
DefaultConfigurer.defaultConfiguration()
    .configureTags(config -> new TagsConfiguration(tags));
axon.tags.computeRegion=europe
上一页Multi-Context下一页Backup and Messaging-only Nodes

最后更新于2年前