Interface ActivityCompletionClient

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <R> void complete​(byte[] taskToken, R result)
      Completes the activity execution successfully.
      <R> void complete​(java.lang.String workflowId, java.util.Optional<java.lang.String> runId, java.lang.String activityId, R result)
      Completes the activity execution successfully.
      void completeExceptionally​(byte[] taskToken, java.lang.Exception result)
      Completes the activity execution with failure.
      void completeExceptionally​(java.lang.String workflowId, java.util.Optional<java.lang.String> runId, java.lang.String activityId, java.lang.Exception result)
      Completes the activity execution with failure.
      <V> void heartbeat​(byte[] taskToken, V details)
      Records a heartbeat for an activity.
      <V> void heartbeat​(java.lang.String workflowId, java.util.Optional<java.lang.String> runId, java.lang.String activityId, V details)
      Records a heartbeat for an activity.
      <V> void reportCancellation​(byte[] taskToken, V details)
      Confirms successful cancellation to the server.
      <V> void reportCancellation​(java.lang.String workflowId, java.util.Optional<java.lang.String> runId, java.lang.String activityId, V details)
      Confirms successful cancellation to the server.
      ActivityCompletionClient withContext​(ActivitySerializationContext context)
      Supply this context if correct serialization of activity heartbeats, results or other payloads requires DataConverter, PayloadConverter or PayloadCodec to be aware of ActivitySerializationContext.
    • Method Detail

      • complete

        <R> void complete​(byte[] taskToken,
                          R result)
                   throws ActivityCompletionException
        Completes the activity execution successfully.
        Parameters:
        taskToken - token of the activity attempt to complete
        result - of the activity execution
        Throws:
        ActivityCompletionException
      • complete

        <R> void complete​(java.lang.String workflowId,
                          java.util.Optional<java.lang.String> runId,
                          java.lang.String activityId,
                          R result)
                   throws ActivityCompletionException
        Completes the activity execution successfully.
        Parameters:
        workflowId - id of the workflow that started the activity
        runId - optional run id of the workflow that started the activity
        activityId - id of the activity
        result - of the activity execution
        Throws:
        ActivityCompletionException
      • completeExceptionally

        void completeExceptionally​(byte[] taskToken,
                                   java.lang.Exception result)
                            throws ActivityCompletionException
        Completes the activity execution with failure.
        Parameters:
        taskToken - token of the activity attempt to complete
        result - the exception to be used as a failure details object
        Throws:
        ActivityCompletionException
      • completeExceptionally

        void completeExceptionally​(java.lang.String workflowId,
                                   java.util.Optional<java.lang.String> runId,
                                   java.lang.String activityId,
                                   java.lang.Exception result)
                            throws ActivityCompletionException
        Completes the activity execution with failure.
        Parameters:
        workflowId - id of the workflow that started the activity
        runId - optional run id of the workflow that started the activity
        activityId - id of the activity
        result - the exception to be used as a failure details object
        Throws:
        ActivityCompletionException
      • reportCancellation

        <V> void reportCancellation​(byte[] taskToken,
                                    V details)
                             throws ActivityCompletionException
        Confirms successful cancellation to the server.
        Parameters:
        taskToken - token of the activity attempt
        details - details to record with the cancellation
        Throws:
        ActivityCompletionException
      • reportCancellation

        <V> void reportCancellation​(java.lang.String workflowId,
                                    java.util.Optional<java.lang.String> runId,
                                    java.lang.String activityId,
                                    V details)
                             throws ActivityCompletionException
        Confirms successful cancellation to the server.
        Parameters:
        workflowId - id of the workflow that started the activity
        runId - optional run id of the workflow that started the activity
        activityId - id of the activity
        details - details to record with the cancellation
        Throws:
        ActivityCompletionException
      • heartbeat

        <V> void heartbeat​(byte[] taskToken,
                           V details)
                    throws ActivityCompletionException
        Records a heartbeat for an activity.
        Parameters:
        taskToken - token of the activity attempt
        details - details to record with the heartbeat
        Throws:
        ActivityCompletionException - if activity should stop executing
      • heartbeat

        <V> void heartbeat​(java.lang.String workflowId,
                           java.util.Optional<java.lang.String> runId,
                           java.lang.String activityId,
                           V details)
                    throws ActivityCompletionException
        Records a heartbeat for an activity.
        Parameters:
        workflowId - id of the workflow that started the activity
        runId - optional run id of the workflow that started the activity
        activityId - id of the activity
        details - details to record with the heartbeat
        Throws:
        ActivityCompletionException - if activity should stop executing