Class ActorClockEndpoint

java.lang.Object
io.camunda.zeebe.shared.management.ActorClockEndpoint

@Component @WebEndpoint(id="clock", enableByDefault=false) public class ActorClockEndpoint extends Object
An actuator endpoint which exposes the current actor clock, provided there it can resolve a bean of type ActorClockService somewhere, and it's enabled via configuration (which by default it isn't).

NOTE: if the clock is not controllable (set via `zeebe.clock.controlled`), any write or delete operations will result in a 403 response.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static final class 
    A response type for future proofing, in case the format needs to be changed in the future.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.boot.actuate.endpoint.web.WebEndpointResponse<ActorClockEndpoint.Response>
    GET /actuator/clock - returns the current instant of the clock in human-readable format using DateTimeFormatter.ISO_INSTANT.
    org.springframework.boot.actuate.endpoint.web.WebEndpointResponse<?>
    modify(String operationKey, Long epochMilli, Long offsetMilli)
    POST /actuator/clock/{operationKey} - modifies the current clock, either by `pin`ning it to the given `epochMilli` or by `add`ing a relative offset to it.
    org.springframework.boot.actuate.endpoint.web.WebEndpointResponse<?>
    DELETE /actuator/clock - will reset any modification to the current clock, which will unpin (if required) and start using the current system time.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ActorClockEndpoint

      @Autowired public ActorClockEndpoint(ActorClockService service)
  • Method Details

    • getCurrentClock

      @ReadOperation public org.springframework.boot.actuate.endpoint.web.WebEndpointResponse<ActorClockEndpoint.Response> getCurrentClock()
      GET /actuator/clock - returns the current instant of the clock in human-readable format using DateTimeFormatter.ISO_INSTANT.
      Returns:
      a 200 response carrying the current instant of the clock
    • modify

      @WriteOperation public org.springframework.boot.actuate.endpoint.web.WebEndpointResponse<?> modify(@Selector(match=SINGLE) String operationKey, @Nullable Long epochMilli, @Nullable Long offsetMilli)
      POST /actuator/clock/{operationKey} - modifies the current clock, either by `pin`ning it to the given `epochMilli` or by `add`ing a relative offset to it.

      The expected usage is to send a JSON body with at least one of the fields. Both fields can be present as well, but only one will be used depending on the operation key.

      For example, to pin the time to 1635672964533 (or Sun Oct 31 09:36:04 AM UTC 2021):

      
       curl -X POST -H 'Content-Type: application/json' -d '{"epochMilli": 1635672964533}' "http://0.0.0.0:9600/actuator/clock/pin"
       "2021-10-31T09:36:04.533Z"%
       
      To add a relative time offset:
      
       curl -X POST -H 'Content-Type: application/json' -d '{"offsetMilli": 250}' "http://0.0.0.0:9600/actuator/clock/pin"
       "2021-10-31T09:36:04.783Z"%
       
      NOTE: you can pass a negative offset to subtract time as well.
      Parameters:
      operationKey - the operation to execute; must be one of `pin` or `add`
      epochMilli - the time at which the clock should be pinned
      offsetMilli - the offset to add to the current time (pinned or not)
      Returns:
      200 and the current clock time, or 400 if the request is malformed
    • resetTime

      @DeleteOperation public org.springframework.boot.actuate.endpoint.web.WebEndpointResponse<?> resetTime()
      DELETE /actuator/clock - will reset any modification to the current clock, which will unpin (if required) and start using the current system time.
      Returns:
      200 and the current clock time