Interface WorkflowStub

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void cancel()
      Request cancellation.
      static <T> WorkflowStub fromTyped​(T typed)
      Extracts untyped WorkflowStub from a typed workflow stub created through WorkflowClient.newWorkflowStub(Class).
      WorkflowExecution getExecution()  
      java.util.Optional<WorkflowOptions> getOptions()  
      <R> R getResult​(long timeout, java.util.concurrent.TimeUnit unit, java.lang.Class<R> resultClass)
      Returns workflow result potentially waiting for workflow to complete.
      <R> R getResult​(long timeout, java.util.concurrent.TimeUnit unit, java.lang.Class<R> resultClass, java.lang.reflect.Type resultType)
      Returns workflow result potentially waiting for workflow to complete.
      <R> R getResult​(java.lang.Class<R> resultClass)
      Returns workflow result potentially waiting for workflow to complete.
      <R> R getResult​(java.lang.Class<R> resultClass, java.lang.reflect.Type resultType)
      Returns workflow result potentially waiting for workflow to complete.
      <R> java.util.concurrent.CompletableFuture<R> getResultAsync​(long timeout, java.util.concurrent.TimeUnit unit, java.lang.Class<R> resultClass)  
      <R> java.util.concurrent.CompletableFuture<R> getResultAsync​(long timeout, java.util.concurrent.TimeUnit unit, java.lang.Class<R> resultClass, java.lang.reflect.Type resultType)  
      <R> java.util.concurrent.CompletableFuture<R> getResultAsync​(java.lang.Class<R> resultClass)  
      <R> java.util.concurrent.CompletableFuture<R> getResultAsync​(java.lang.Class<R> resultClass, java.lang.reflect.Type resultType)  
      java.util.Optional<java.lang.String> getWorkflowType()  
      <R> R query​(java.lang.String queryType, java.lang.Class<R> resultClass, QueryRejectCondition queryRejectCondition, java.lang.Object... args)
      Deprecated: please use queryWithOptions(String, QueryOptions, Type, Class, Object...) to avoid variable argument ambiguity with Object...
      <R> R query​(java.lang.String queryType, java.lang.Class<R> resultClass, java.lang.Object... args)
      Query workflow by invoking its query handler.
      <R> R query​(java.lang.String queryType, java.lang.Class<R> resultClass, java.lang.reflect.Type resultType, QueryRejectCondition queryRejectCondition, java.lang.Object... args)
      Deprecated: please use queryWithOptions(String, QueryOptions, Type, Class, Object...) to avoid variable argument ambiguity with Object...
      <R> R query​(java.lang.String queryType, java.lang.Class<R> resultClass, java.lang.reflect.Type resultType, java.lang.Object... args)
      Deprecated: please use queryWithOptions(String, QueryOptions, Type, Class, Object...) to avoid variable argument ambiguity with Object...
      <R> R queryWithOptions​(java.lang.String queryType, QueryOptions options, java.lang.reflect.Type resultType, java.lang.Class<R> resultClass, java.lang.Object... args)  
      void signal​(java.lang.String signalName, java.lang.Object... args)  
      java.util.concurrent.CompletableFuture<java.lang.Void> signalAsync​(java.lang.String signalName, java.lang.Object... args)  
      java.util.concurrent.CompletableFuture<java.lang.Void> signalAsyncWithTimeout​(long timeout, java.util.concurrent.TimeUnit unit, java.lang.String signalName, java.lang.Object... args)  
      WorkflowExecution signalWithStart​(java.lang.String signalName, java.lang.Object[] signalArgs, java.lang.Object[] startArgs)  
      WorkflowExecution start​(java.lang.Object... args)  
      java.util.concurrent.CompletableFuture<WorkflowExecution> startAsync​(java.lang.Object... args)  
      java.util.concurrent.CompletableFuture<WorkflowExecution> startAsyncWithTimeout​(long timeout, java.util.concurrent.TimeUnit unit, java.lang.Object... args)  
    • Method Detail

      • fromTyped

        static <T> WorkflowStub fromTyped​(T typed)
        Extracts untyped WorkflowStub from a typed workflow stub created through WorkflowClient.newWorkflowStub(Class).
        Type Parameters:
        T - type of the workflow stub interface
        Parameters:
        typed - typed workflow stub
        Returns:
        untyped workflow stub for the same workflow instance.
      • signal

        void signal​(java.lang.String signalName,
                    java.lang.Object... args)
      • signalAsync

        java.util.concurrent.CompletableFuture<java.lang.Void> signalAsync​(java.lang.String signalName,
                                                                           java.lang.Object... args)
      • signalAsyncWithTimeout

        java.util.concurrent.CompletableFuture<java.lang.Void> signalAsyncWithTimeout​(long timeout,
                                                                                      java.util.concurrent.TimeUnit unit,
                                                                                      java.lang.String signalName,
                                                                                      java.lang.Object... args)
      • startAsync

        java.util.concurrent.CompletableFuture<WorkflowExecution> startAsync​(java.lang.Object... args)
      • startAsyncWithTimeout

        java.util.concurrent.CompletableFuture<WorkflowExecution> startAsyncWithTimeout​(long timeout,
                                                                                        java.util.concurrent.TimeUnit unit,
                                                                                        java.lang.Object... args)
      • signalWithStart

        WorkflowExecution signalWithStart​(java.lang.String signalName,
                                          java.lang.Object[] signalArgs,
                                          java.lang.Object[] startArgs)
      • getWorkflowType

        java.util.Optional<java.lang.String> getWorkflowType()
      • getResult

        <R> R getResult​(java.lang.Class<R> resultClass,
                        java.lang.reflect.Type resultType)
        Returns workflow result potentially waiting for workflow to complete. Behind the scene this call performs long poll on Cadence service waiting for workflow completion notification.
        Type Parameters:
        R - type of the workflow return value
        Parameters:
        resultClass - class of the workflow return value
        resultType - type of the workflow return value. Differs from resultClass for generic types.
        Returns:
        workflow return value
      • getResultAsync

        <R> java.util.concurrent.CompletableFuture<R> getResultAsync​(java.lang.Class<R> resultClass,
                                                                     java.lang.reflect.Type resultType)
      • getResult

        <R> R getResult​(java.lang.Class<R> resultClass)
        Returns workflow result potentially waiting for workflow to complete. Behind the scene this call performs long poll on Cadence service waiting for workflow completion notification.
        Type Parameters:
        R - type of the workflow return value
        Parameters:
        resultClass - class of the workflow return value
        Returns:
        workflow return value
      • getResultAsync

        <R> java.util.concurrent.CompletableFuture<R> getResultAsync​(java.lang.Class<R> resultClass)
      • getResult

        <R> R getResult​(long timeout,
                        java.util.concurrent.TimeUnit unit,
                        java.lang.Class<R> resultClass,
                        java.lang.reflect.Type resultType)
                 throws java.util.concurrent.TimeoutException
        Returns workflow result potentially waiting for workflow to complete. Behind the scene this call performs long poll on Cadence service waiting for workflow completion notification.
        Type Parameters:
        R - type of the workflow return value
        Parameters:
        timeout - maximum time to wait
        unit - unit of timeout
        resultClass - class of the workflow return value
        resultType - type of the workflow return value. Differs from resultClass for generic
        Returns:
        workflow return value
        Throws:
        java.util.concurrent.TimeoutException - if workflow is not completed after the timeout time.
      • getResult

        <R> R getResult​(long timeout,
                        java.util.concurrent.TimeUnit unit,
                        java.lang.Class<R> resultClass)
                 throws java.util.concurrent.TimeoutException
        Returns workflow result potentially waiting for workflow to complete. Behind the scene this call performs long poll on Cadence service waiting for workflow completion notification.
        Type Parameters:
        R - type of the workflow return value
        Parameters:
        timeout - maximum time to wait
        unit - unit of timeout
        resultClass - class of the workflow return value
        Returns:
        workflow return value
        Throws:
        java.util.concurrent.TimeoutException - if workflow is not completed after the timeout time.
      • getResultAsync

        <R> java.util.concurrent.CompletableFuture<R> getResultAsync​(long timeout,
                                                                     java.util.concurrent.TimeUnit unit,
                                                                     java.lang.Class<R> resultClass,
                                                                     java.lang.reflect.Type resultType)
      • getResultAsync

        <R> java.util.concurrent.CompletableFuture<R> getResultAsync​(long timeout,
                                                                     java.util.concurrent.TimeUnit unit,
                                                                     java.lang.Class<R> resultClass)
      • query

        <R> R query​(java.lang.String queryType,
                    java.lang.Class<R> resultClass,
                    java.lang.Object... args)
        Query workflow by invoking its query handler. A query handler is a method annotated with QueryMethod.
        Type Parameters:
        R - type of the query result
        Parameters:
        queryType - name of the query handler. Usually it is a method name.
        resultClass - class of the query result type
        args - optional query arguments
        Returns:
        query result
        Throws:
        WorkflowQueryException - if query failed for any reason.
        See Also:
        WorkflowClientOptions.Builder.setQueryRejectCondition(QueryRejectCondition)
      • queryWithOptions

        <R> R queryWithOptions​(java.lang.String queryType,
                               QueryOptions options,
                               java.lang.reflect.Type resultType,
                               java.lang.Class<R> resultClass,
                               java.lang.Object... args)
      • cancel

        void cancel()
        Request cancellation.