Class SpringCloudCommandController
java.lang.Object
io.axoniq.framework.springcloud.command.SpringCloudCommandController
@RestController
@RequestMapping("${axon.springcloud.command-endpoint:/axoniq-springcloud/command}")
public class SpringCloudCommandController
extends Object
Receives commands sent by other members of the cluster over HTTP.
Every member must expose this endpoint under the same path, since that is how members reach each other; the path is
the value of the axon.springcloud.command-endpoint property, defaulting to
DEFAULT_COMMAND_ENDPOINT. This controller is registered by the Spring Boot autoconfiguration.
Returning a CompletableFuture puts the request into Spring MVC's asynchronous handling, releasing the
container thread while the command is processed on the command bus's own executor. That matters because a member
receiving commands has no reason to tie up one container thread per command in flight.
- Since:
- 5.4.0
- Author:
- Allard Buijze
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe path commands are received under when none is configured. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs aSpringCloudCommandControllerhanding received commands to the giveninvoker. -
Method Summary
Modifier and TypeMethodDescriptionreceiveCommand(CommandDispatchRequest request) Handles the givenrequest, sent by another member of the cluster.
-
Field Details
-
DEFAULT_COMMAND_ENDPOINT
The path commands are received under when none is configured.- See Also:
-
-
Constructor Details
-
SpringCloudCommandController
Constructs aSpringCloudCommandControllerhanding received commands to the giveninvoker.- Parameters:
invoker- the component invoking this application's local command handler
-
-
Method Details
-
receiveCommand
@PostMapping public CompletableFuture<CommandDispatchReply> receiveCommand(@RequestBody CommandDispatchRequest request) Handles the givenrequest, sent by another member of the cluster.Answers with
200 OKwhether handling succeeded or failed; a failure is reported in the body of the reply. SeeCommandDispatchReplyfor why.- Parameters:
request- the command sent by another member- Returns:
- a future completing with the outcome of handling the command
-