制御バスコントローラー
バージョン 6.4 以降、HTTP モジュールは、/control-bus
パスで ControlBusController
を REST サービスとして公開するための @EnableControlBusController
構成クラスアノテーションを提供します。その ControlBusControllerConfiguration
は、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
インスタンスのリストです。各エントリは、制御バス対応メソッドのリスト (詳細については ControlBusMethodFilter
を参照) と、そのパラメーター型および @ManagedOperation
または @ManagedAttribute
の説明 (それ以外の場合はメソッド名にフォールバック) を含む Bean です。
/control-bus/{beanName.methodName}
への POST メソッドはコマンドを呼び出します。リクエストの本文には、実行するコマンドの値とその型のリストが含まれる場合があります。例: クラスの int
引数を持つ operation
コマンド:
@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;
}
}
本文を含む mention POST メソッドを使用して /testManagementComponent.operation
のように呼び出すことができます:
[
{
"value": "1",
"parameterType": "int"
}
]
詳細については、制御バスを参照してください。