Class HandlerDefinition.Configurator

java.lang.Object
dev.restate.sdk.endpoint.definition.HandlerDefinition.Configurator
Enclosing class:
HandlerDefinition<REQ,RES>

public static final class HandlerDefinition.Configurator extends Object
Configurator for a HandlerDefinition.
  • Method Details

    • acceptContentType

      public @Nullable String acceptContentType()
      Returns:
      configured accepted content type.
      See Also:
    • acceptContentType

      public HandlerDefinition.Configurator acceptContentType(@Nullable String acceptContentType)
      Set the acceptable content type when ingesting HTTP requests. Wildcards can be used, e.g. application / * or * / *.
      Returns:
      this
    • documentation

      public @Nullable String documentation()
      Returns:
      configured documentation.
      See Also:
    • documentation

      public HandlerDefinition.Configurator documentation(@Nullable String documentation)
      Documentation as shown in the UI, Admin REST API, and the generated OpenAPI documentation of this handler.
      Returns:
      this
    • metadata

      public Map<String,String> metadata()
      Returns:
      configured metadata.
      See Also:
    • addMetadata

      public HandlerDefinition.Configurator addMetadata(String key, String value)
      See Also:
    • metadata

      public HandlerDefinition.Configurator metadata(Map<String,String> metadata)
      Handler metadata, as propagated in the Admin REST API.
      Returns:
      this
    • inactivityTimeout

      public @Nullable Duration inactivityTimeout()
      Returns:
      configured inactivity timeout.
      See Also:
    • inactivityTimeout

      public HandlerDefinition.Configurator inactivityTimeout(@Nullable Duration inactivityTimeout)
      This timer guards against stalled invocations. Once it expires, Restate triggers a graceful termination by asking the invocation to suspend (which preserves intermediate progress).

      The abortTimeout(Duration) is used to abort the invocation, in case it doesn't react to the request to suspend.

      This overrides the inactivity timeout set for the service and the default set in restate-server.

      NOTE: You can set this field only if you register this service against restate-server >= 1.4, otherwise the service discovery will fail.

      Returns:
      this
    • abortTimeout

      public @Nullable Duration abortTimeout()
      Returns:
      configured abort timeout.
      See Also:
    • abortTimeout

      public HandlerDefinition.Configurator abortTimeout(@Nullable Duration abortTimeout)
      This timer guards against stalled invocations that are supposed to terminate. The abort timeout is started after the inactivityTimeout(Duration) has expired and the invocation has been asked to gracefully terminate. Once the timer expires, it will abort the invocation.

      This timer potentially interrupts user code. If the user code needs longer to gracefully terminate, then this value needs to be set accordingly.

      This overrides the abort timeout set for the service and the default set in restate-server.

      NOTE: You can set this field only if you register this service against restate-server >= 1.4, otherwise the service discovery will fail.

      Returns:
      this
    • idempotencyRetention

      public @Nullable Duration idempotencyRetention()
      Returns:
      configured idempotency retention.
      See Also:
    • idempotencyRetention

      public HandlerDefinition.Configurator idempotencyRetention(@Nullable Duration idempotencyRetention)
      The retention duration of idempotent requests to this service.

      NOTE: You can set this field only if you register this service against restate-server >= 1.4, otherwise the service discovery will fail.

      Returns:
      this
    • workflowRetention

      public @Nullable Duration workflowRetention()
      Returns:
      configured workflow retention.
      See Also:
    • workflowRetention

      public HandlerDefinition.Configurator workflowRetention(@Nullable Duration workflowRetention)
      The retention duration for this workflow handler.

      NOTE: You can set this field only if you register this service against restate-server >= 1.4, otherwise the service discovery will fail.

      Returns:
      this
    • journalRetention

      public @Nullable Duration journalRetention()
      Returns:
      configured journal retention.
      See Also:
    • journalRetention

      public HandlerDefinition.Configurator journalRetention(@Nullable Duration journalRetention)
      The journal retention for invocations to this handler.

      In case the request has an idempotency key, the idempotencyRetention(Duration) caps the journal retention time.

      NOTE: You can set this field only if you register this service against restate-server >= 1.4, otherwise the service discovery will fail.

      Returns:
      this
    • ingressPrivate

      public @Nullable Boolean ingressPrivate()
      Returns:
      configured ingress private.
      See Also:
    • ingressPrivate

      public HandlerDefinition.Configurator ingressPrivate(@Nullable Boolean ingressPrivate)
      When set to true this handler cannot be invoked from the restate-server HTTP and Kafka ingress, but only from other services.

      NOTE: You can set this field only if you register this service against restate-server >= 1.4, otherwise the service discovery will fail.

      Returns:
      this
    • enableLazyState

      public @Nullable Boolean enableLazyState()
      Returns:
      configured enable lazy state.
      See Also:
    • enableLazyState

      public HandlerDefinition.Configurator enableLazyState(@Nullable Boolean enableLazyState)
      When set to true, lazy state will be enabled for all invocations to this handler. This is relevant only for workflows and virtual objects.

      NOTE: You can set this field only if you register this service against restate-server >= 1.4, otherwise the service discovery will fail.

      Returns:
      this