Class MemberCapabilitiesController
capabilities over
HTTP, so that other members of the cluster can learn which commands and queries this one handles.
The capabilities are served along with this application's node id, which is what other members identify this one by. This application asks its own instance as well, and recognizes itself by that id.
Every member of a cluster using RestCapabilityDiscoveryMode must expose this endpoint, since that is the
only way capabilities travel: they cannot be published through
service instance metadata, which is fixed at
registration time.
The response carries an ETag derived from the node id and capabilities. A member polling this endpoint on
every refresh sends its last-seen tag as If-None-Match, and an unchanged member is answered with
304 Not Modified and no body. Steady-state polling therefore costs a round trip and nothing more.
This controller is registered by the Spring Boot autoconfiguration; the path it is mapped to is the value of the
axon.springcloud.capabilities-endpoint property, defaulting to
RestCapabilityDiscoveryMode.DEFAULT_CAPABILITIES_ENDPOINT. Every member of the cluster must agree on it.
- Since:
- 5.4.0
- Author:
- Allard Buijze, Steven van Beelen
-
Constructor Summary
ConstructorsConstructorDescriptionMemberCapabilitiesController(CapabilityDiscoveryMode discoveryMode) Constructs aMemberCapabilitiesControllerserving the capabilities published to the givendiscoveryMode. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<MemberCapabilitiesPayload> localMemberCapabilities(@Nullable String ifNoneMatch) Returns this application's node id and capabilities, or304 Not Modifiedwhen the givenifNoneMatchalready identifies them.
-
Constructor Details
-
MemberCapabilitiesController
Constructs aMemberCapabilitiesControllerserving the capabilities published to the givendiscoveryMode.- Parameters:
discoveryMode- the mode holding this application's own capabilities
-
-
Method Details
-
localMemberCapabilities
@GetMapping public org.springframework.http.ResponseEntity<MemberCapabilitiesPayload> localMemberCapabilities(@RequestHeader(value="If-None-Match",required=false) @Nullable String ifNoneMatch) Returns this application's node id and capabilities, or304 Not Modifiedwhen the givenifNoneMatchalready identifies them.- Parameters:
ifNoneMatch- theIf-None-Matchheader of the request, carrying the entity tag the requesting member last saw, ornullwhen it has not seen these capabilities before- Returns:
- this application's capabilities with their entity tag, or an empty
304 Not Modifiedresponse
-