Class MemberCapabilitiesController

java.lang.Object
io.axoniq.framework.springcloud.discovery.MemberCapabilitiesController

@RestController @RequestMapping("${axon.springcloud.capabilities-endpoint:/axoniq-springcloud/member-capabilities}") public class MemberCapabilitiesController extends Object
Serves this application's own 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 Details

    • MemberCapabilitiesController

      public MemberCapabilitiesController(CapabilityDiscoveryMode discoveryMode)
      Constructs a MemberCapabilitiesController serving the capabilities published to the given discoveryMode.
      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, or 304 Not Modified when the given ifNoneMatch already identifies them.
      Parameters:
      ifNoneMatch - the If-None-Match header of the request, carrying the entity tag the requesting member last saw, or null when it has not seen these capabilities before
      Returns:
      this application's capabilities with their entity tag, or an empty 304 Not Modified response