Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong activity being executed #29

Open
ghost opened this issue Apr 23, 2022 · 1 comment
Open

Wrong activity being executed #29

ghost opened this issue Apr 23, 2022 · 1 comment

Comments

@ghost
Copy link

ghost commented Apr 23, 2022

I've defined a worker that executes two activities sequentially.

Let's call them ActivityOne and ActivityTwo.

ActivityOne looks like this:

@ActivityInterface
public interface ActivityOne {
    @ActivityMethod
    void execute(String schemaName);
}

@Log4j2
@Service
public class ActivityOneImpl implements ActivityOne {
    @Override
    public String execute(String schemaName) {
      // Some code here
      return something;
   }
}

and ActivityTwo looks like this:

@ActivityInterface
public interface ActivityTwo {
    @ActivityMethod
    void execute(String input);
}

@Log4j2
@Service
public class ActivityTwoImpl implements ActivityTwo {
    @Override
    public String execute(String input) {
      // Some code here
      return somethingElse;
   }
}

And my workflow looks like this:

@Component
@TemporalWorkflow("my-workflow")
@CustomLog
public class MyWorkflowImpl implements MyWorkflow {
    @ActivityStub(startToClose = "PT30S")
    ActivityOne actOne;

    @ActivityStub(startToClose = "PT20S")
    ActivityTwo actTwo;

 @Override
    public void run(String input) {
        String schemaName = Workflow.sideEffect(String.class, () -> generateSchemaName(input));
        String outputFromOne = actOne.execute(schemaName);
        actTwo.execute(input);
    }
}

Here's the flow of execution that is happening:

  1. Side effect works and schemaName is generated.
  2. ActivityOneImpl is executed with the parameter 'schemaName'
  3. ActivityOneImpl is executed again with the parameter 'input'

Could someone please tell if I'm doing something wrong or this is a bug ?

@ghost
Copy link
Author

ghost commented Apr 23, 2022

Also to add to it. If I rename the ActivityTwo method to something else such as executeAlt then it works as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants