All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.uber.cadence.workflow.WorkflowInterceptor Maven / Gradle / Ivy

There is a newer version: 3.12.5
Show newest version
/*
 *  Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 *  Modifications copyright (C) 2017 Uber Technologies, Inc.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"). You may not
 *  use this file except in compliance with the License. A copy of the License is
 *  located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 *  or in the "license" file accompanying this file. This file is distributed on
 *  an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 *  express or implied. See the License for the specific language governing
 *  permissions and limitations under the License.
 */

package com.uber.cadence.workflow;

import com.uber.cadence.WorkflowExecution;
import com.uber.cadence.activity.ActivityOptions;
import com.uber.cadence.activity.LocalActivityOptions;
import com.uber.cadence.workflow.Functions.Func;
import java.lang.reflect.Type;
import java.time.Duration;
import java.util.Optional;
import java.util.Random;
import java.util.UUID;
import java.util.function.BiPredicate;
import java.util.function.Supplier;

public interface WorkflowInterceptor {

  final class WorkflowResult {

    private final Promise result;
    private final Promise workflowExecution;

    public WorkflowResult(Promise result, Promise workflowExecution) {
      this.result = result;
      this.workflowExecution = workflowExecution;
    }

    public Promise getResult() {
      return result;
    }

    public Promise getWorkflowExecution() {
      return workflowExecution;
    }
  }

   Promise executeActivity(
      String activityName,
      Class resultClass,
      Type resultType,
      Object[] args,
      ActivityOptions options);

   Promise executeLocalActivity(
      String activityName,
      Class resultClass,
      Type resultType,
      Object[] args,
      LocalActivityOptions options);

   WorkflowResult executeChildWorkflow(
      String workflowType,
      Class resultClass,
      Type resultType,
      Object[] args,
      ChildWorkflowOptions options);

  Random newRandom();

  Promise signalExternalWorkflow(
      WorkflowExecution execution, String signalName, Object[] args);

  Promise cancelWorkflow(WorkflowExecution execution);

  void sleep(Duration duration);

  boolean await(Duration timeout, String reason, Supplier unblockCondition);

  void await(String reason, Supplier unblockCondition);

  Promise newTimer(Duration duration);

   R sideEffect(Class resultClass, Type resultType, Func func);

   R mutableSideEffect(
      String id, Class resultClass, Type resultType, BiPredicate updated, Func func);

  int getVersion(String changeID, int minSupported, int maxSupported);

  void continueAsNew(
      Optional workflowType, Optional options, Object[] args);

  void registerQuery(String queryType, Type[] argTypes, Functions.Func1 callback);

  UUID randomUUID();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy