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 ClassesModifier and TypeClassDescriptionprotected static final classA response type for future proofing, in case the format needs to be changed in the future. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.boot.actuate.endpoint.web.WebEndpointResponse<ActorClockEndpoint.Response>GET /actuator/clock - returns the current instant of the clock in human-readable format usingDateTimeFormatter.ISO_INSTANT.org.springframework.boot.actuate.endpoint.web.WebEndpointResponse<?>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.
-
Constructor Details
-
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 usingDateTimeFormatter.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):
To add a relative time offset: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"%
NOTE: you can pass a negative offset to subtract time as well.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"%- Parameters:
operationKey- the operation to execute; must be one of `pin` or `add`epochMilli- the time at which the clock should be pinnedoffsetMilli- 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
-