Class ServiceDefinition.Configurator

java.lang.Object
dev.restate.sdk.endpoint.definition.ServiceDefinition.Configurator
Enclosing class:
ServiceDefinition

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

    • documentation

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

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

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

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

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

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

      public ServiceDefinition.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 default inactivity timeout configured in the restate-server for all invocations 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
    • abortTimeout

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

      public ServiceDefinition.Configurator abortTimeout(@Nullable Duration abortTimeout)
      This timer guards against stalled service/handler invocations that are supposed to terminate. The abort timeout is started after the inactivityTimeout(Duration) has expired and the service/handler invocation has been asked to gracefully terminate. Once the timer expires, it will abort the service/handler 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 default abort timeout configured in the restate-server for all invocations 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
    • idempotencyRetention

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

      public ServiceDefinition.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
    • journalRetention

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

      public ServiceDefinition.Configurator journalRetention(@Nullable Duration journalRetention)
      The journal retention. When set, this applies to all requests to all handlers of this service.

      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 ServiceDefinition.Configurator ingressPrivate(@Nullable Boolean ingressPrivate)
      When set to true this service, with all its handlers, 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 ServiceDefinition.Configurator enableLazyState(@Nullable Boolean enableLazyState)
      When set to true, lazy state will be enabled for all invocations to this service. 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
    • configureHandler

      public ServiceDefinition.Configurator configureHandler(String handlerName, Consumer<HandlerDefinition.Configurator> configurator)
      Configure a specific handler of this service.
      Returns:
      this