此版本仍在开发中,尚不被认为是稳定的。对于最新的稳定版本,请使用 Spring Integration 6.5.1! |
控制总线控制器
从 6.4 版开始,HTTP 模块提供了一个@EnableControlBusController
配置类注释以公开ControlBusController
作为 REST 服务,在/control-bus
路径。 这ControlBusControllerConfiguration
underneath 启用ControlBusCommandRegistry
以公开上述 REST 服务的所有可用控制总线命令。 这/control-bus
GET 请求以如下格式返回应用程序的所有控制总线命令:
[
{
"beanName": "errorChannel",
"commands": [
{
"command": "errorChannel.setShouldTrack",
"description": "setShouldTrack",
"parameterTypes": [
"boolean"
]
},
{
"command": "errorChannel.setLoggingEnabled",
"description": "Use to disable debug logging during normal message flow",
"parameterTypes": [
"boolean"
]
},
{
"command": "errorChannel.isLoggingEnabled",
"description": "isLoggingEnabled",
"parameterTypes": []
}
]
},
{
"beanName": "testManagementComponent",
"commands": [
{
"command": "testManagementComponent.operation2",
"description": "operation2",
"parameterTypes": []
},
{
"command": "testManagementComponent.operation",
"description": "operation",
"parameterTypes": []
},
{
"command": "testManagementComponent.operation",
"description": "operation",
"parameterTypes": [
"int",
"java.lang.String"
]
},
{
"command": "testManagementComponent.operation",
"description": "operation",
"parameterTypes": [
"int"
]
}
]
}
]
本质上,JSON 序列化列表ControlBusController.ControlBusBean
实例。 每个条目都是一个 bean,其中包含控制总线合格方法的列表(请参阅ControlBusMethodFilter
更多信息),其参数类型和描述来自@ManagedOperation
或@ManagedAttribute
(否则回退到方法名称)。
POST 方法设置为/control-bus/{beanName.methodName}
调用命令。请求的正文可能包含命令执行的值及其类型列表。例如,operation
命令替换为int
类的参数:
@ManagedResource
class TestManagementComponent {
@ManagedOperation
public void operation() {
}
@ManagedOperation(description = "The overloaded operation with int argument")
public void operation(int input) {
}
@ManagedOperation(description = "The overloaded operation with two arguments")
public void operation(int input1, String input2) {
}
@ManagedOperation
public int operation2() {
return 123;
}
}
可以称为/testManagementComponent.operation
使用带有正文的提及 POST 方法:
[
{
"value": "1",
"parameterType": "int"
}
]
请参阅控制总线以了解更多信息。