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 提供支持
在本页
  • Plugin development
  • Plugin administration
  • Upload plugin
  • Configuring a plugin
  • Activating a plugin
  • Pausing a plugin
  • Unregistering a plugin
  • Deleting a plugin
  1. Axon Server
  2. 管理

Plugins

上一页Recovery下一页Error Codes

最后更新于2年前

Note

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

Plugins allow you to add specific interceptors in Axon Server. This enables intercepting commands and queries before they are updated and after they are executed, and it enables intercepting events and snapshots before they are stored and when they are read.

A plugin is an OSGi package, that you can upload to Axon Server. The package can implement a number of interceptors, Axon Server will discover these and start using them. The OSGi package runs in an OSGi container, using its own class loader and it only has access to specific Axon Server classes.

A plugin package has a symbolic name and version. This information is part of the information in the manifest file of the package. If you upload a package with the same name and version, it will replace the already available package. You can have multiple versions of the same package available.

Plugins are managed at a context level, you can configure and activate plugins per context. Per context, you can only have one version of a plugin active. In Axon Server Standard Edition there only is one context, you can still active or pause the plugin for the default context.

Axon Server stores plugins on disk on each node. It is important that the location where the plugins are stored is persistent. By default, Axon Server stores the plugin in the directory plugins/bundles. Apart from this directory, there is also a cache directory used by the OSGi container internally (plugins/cache by default). The cache directory does not need to be persistent, Axon Server reinstalls the configured extensions on restart.

Plugin development

For more information on plugin development, check the API module in GitHub .

Plugin administration

You can administer plugins through the UI or using the command-line interface.

Upload plugin

This uploads a plugin to Axon Server and makes it available for further configuration. When you upload the plugin Axon Server will perform some basic validation, to verify that it is a valid OSGi bundle and it can be loaded in the OSGi container. If the uploaded plugin has the same name and version as an already existing plugin, it will immediately replace the existing plugin.

To upload a plugin through the command-line interface, use:

java -jar axonserver-cli.jar upload-plugin -f [file] 

Note that there are default settings for the maximum file size (1M) and maximum request size (10M) for the upload request. If you want to upload larger bundles, increase these limits in axonserver.properties (spring.servlet.multipart.max-file-size and spring.servlet.multipart.max-request-size).

Configuring a plugin

If your plugin contains registered services of the type io.axoniq.axonserver.plugin.ConfigurationListener, you can configure the plugin through Axon Server. In the UI you will see a form with the properties that are defined in the ConfigurationListeners, initially filled with the default values. Note that you set the values per context.

A plugin can have multiple ConfigurationListeners, each one is identified by a name. This name is shown in the Axon Server UI.

If you want to set the configuration values through the command-line interface, you have two options, either specify the values as parameters in the command or provide a YAML file containing the parameter values.

Here’s an example of a configuration listener that defines two properties:

package org.sample;

import io.axoniq.axonserver.plugin.Configuration;
import io.axoniq.axonserver.plugin.ConfigurationListener;
import io.axoniq.axonserver.plugin.PluginPropertyDefinition;

import java.util.Map;

import static java.util.Arrays.asList;

/**
 * @author Marc Gathier
 */
public class SampleConfigurationListener implements ConfigurationListener {

    private final Configuration configuration  = new Configuration(
            asList(
                    PluginPropertyDefinition.newBuilder("mypropid1", "My first property").build(),
                    PluginPropertyDefinition.newBuilder("mypropid2", "My second property").build()
            ),
            "myname"

    );

    @Override
    public Configuration configuration() {
        return configuration;
    }

    @Override
    public void updated(String s, Map<String, ?> map) {

    }

}

To set the properties through the command line using the parameters option use:

java -jar axonserver-cli.jar upload-plugin -p <plugin> -v <version> -c <context> -prop myname:mypropid1=myvalue -prop myname:mypropid2=myvalue2

To do the same using a YAML file create a file with the following content:

myname:
  mypropid1: myvalue
  mypropid2: myvalue3

And use the following command-line command:

java -jar axonserver-cli.jar configure-plugin -p <plugin> -v <version> -c <context> -f <filename>

Activating a plugin

You can activate a plugin through the UI or use the following command-line command:

java -jar axonserver-cli.jar activate-plugin -p <plugin> -v <version> -c <context> 

Pausing a plugin

If you want to stop an plugin being used temporarily for a context, you can pause it through the UI or the command-line interface. This will keep all the configuration for the plugin, so when you later start it again it will use the same configuration as before.

The command-line command for this is:

java -jar axonserver-cli.jar pause-plugin -p <plugin> -v <version> -c <context> 

Unregistering a plugin

This unregisters a plugin for a specific context. The plugin will still be active for other contexts.

The command-line command for this is:

java -jar axonserver-cli.jar unregister-plugin -p <plugin> -v <version> -c <context> 

Deleting a plugin

Deleting a plugin unregisters it from all the contexts and deletes the package from all the nodes.

The command-line command for this is:

java -jar axonserver-cli.jar delete-plugin -p <plugin> -v <version> 
https://github.com/AxonIQ/axon-server-plugin-api