Class Target

java.lang.Object
dev.restate.common.Target

public final class Target extends Object
Represents an invocation target.
  • Method Details

    • virtualObject

      public static Target virtualObject(String name, String key, String handler)
    • virtualObject

      @Experimental public static Target virtualObject(String scope, String name, String key, String handler)
      PREVIEW.
      See Also:
    • workflow

      public static Target workflow(String name, String key, String handler)
    • workflow

      @Experimental public static Target workflow(String scope, String name, String key, String handler)
      PREVIEW.
      See Also:
    • service

      public static Target service(String name, String handler)
    • service

      @Experimental public static Target service(String scope, String name, String handler)
      PREVIEW.
      See Also:
    • scoped

      @Experimental public Target scoped(String scope)
      PREVIEW: Returns a new Target routed within the given scope.

      A scope is a sub-grouping of resources (invocations, virtual object instances, workflow instances, concurrency limits) within the Restate cluster. It becomes part of the target identity and contributes to the partition key, so all resources sharing a scope get co-located. The scope key must consist only of [a-zA-Z0-9_.-] characters, with 1 <= length <= 36.

      Requires Restate >= 1.7. See flow control.

      Parameters:
      scope - the scope key to route this target within
      Returns:
      a new Target with the given scope
    • getScope

      @Experimental public @Nullable String getScope()
      PREVIEW: Scope of the request target.
      Returns:
      the scope. Null if no scope is set.
      See Also:
    • getService

      public String getService()
    • getHandler

      public String getHandler()
    • getKey

      public @Nullable String getKey()
      Returns:
      the virtual object/workflow key. Null if the target is a regular service.
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object