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 提供支持
在本页
  • Evolutionary microservices
  • Strategies for applying Axon
  • Axon based microservices
  • Axon within a single service only
  • Hybrid / polyglot environments
  1. 架构概览

事件驱动的微服务

Event-Driven Microservices

上一页事件溯源下一页Axon Server

最后更新于2年前

The concepts described in the chapter are highly applicable when designing and creating (event-driven) microservices systems. In this chapter, we will explicitly name a few common strategies for applying Axon in such environments.

Evolutionary microservices

At AxonIQ, we believe systems evolve their way into microservices, instead of attempting to build a microservices system from scratch. The main reason is that the exploration of sensible Context Boundaries (see ) and models takes time. Changing these boundaries is much more difficult in distributed systems than it is in a monolith.

Axon leverages the separation of components and uses explicit messaging between them, which makes these components . Unlike the use of service discovery, the approach Axon takes for messaging doesn't require a component to know the destination of a message at all. They are automatically routed to a component that advertises the capability to handle such messages. This makes these systems much more flexible to change than "regular" microservices based systems.

Strategies for applying Axon

There are different strategies for applying Axon in Microservices environments. One could adopt the Axon philosophy on a system level and build all services using Axon. However, Axon is also already useful when just applying it within a single application/service. Lastly, we'll also discuss specific strategies when using Axon in a polyglot environment. To that end, Axon is built with integration in mind.

Axon based microservices

When using the Axon on a system level, meaning that several services run Axon (or compatible APIs), one can use the messaging concepts to their fullest extent. Applications can simply make use of the different message buses to send and receive messages from other components. This makes the system very flexible when it comes to changing the deployment strategy of components.

Axon within a single service only

When building a single Axon based service within an existing Microservices system, you may want to expose your API using "traditional" rest endpoints. In such case, your Axon based application would need a small API layer that transforms REST calls into commands, which are then dispatched to a command bus internally. Do take into account, however, that requests may not be routed consistently, and that commands for the same aggregate may then be routed to different instances.

If an Axon based service has several instances deployed, you may still benefit from using distributed implementations of the buses, to allow these instances to properly balance message handling between them.

Hybrid / polyglot environments

In practice, many microservices based systems run in a polyglot environment. Different services will run on a different technology stack. In these environments, it is even more important to ensure Contexts Boundaries are properly guarded and provide decent anti-corruption layers, where applicable.

It is unlikely that all used technology stacks follow the same messaging based approach that Axon applications do. However, that doesn't mean the concepts need to be abandoned. You can still benefit from many of the advantages of explicit messaging. In such environments, anti-corruption layers could be implemented as components that handle commands, events and queries, and execute other types of calls (e.g. REST calls) to the external services. This way, components that work with explicit messaging do not need to worry about polling external services for changes, or be influenced by the technical challenges caused by different types of APIs.

Axon supports different types of connectors that allow Events (and in certain cases other message types, too) to be published to third party message brokers. By default, Axon will make assumptions on the format of these external events, but they can always be overridden. Read the chapters about these specific extensions for more details.

DDD and CQRS Concepts
Location Transparent
Bounded Context