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

Send one-way commands/notifications to saga participants #76

Open
cer opened this issue May 30, 2022 · 2 comments
Open

Send one-way commands/notifications to saga participants #76

cer opened this issue May 30, 2022 · 2 comments

Comments

@cer
Copy link
Collaborator

cer commented May 30, 2022

Requires: eventuate-tram/eventuate-tram-core#174

Motivation is the concurrent execution of compensating transactions and retriable transactions, which are saga steps that by definition cannot fail.

@cer cer changed the title See one-way commands/notifications to saga participants Send one-way commands/notifications to saga participants Aug 8, 2022
@cer
Copy link
Collaborator Author

cer commented Aug 9, 2022

Proposed design consists of additional Saga DSL methods:

  • notifyParticipant()
  • withCompensationNotification()
public class NotificationBasedCreateOrderSaga implements SimpleSaga<NotificationBasedCreateOrderSagaData> {

  private final SagaDefinition<NotificationBasedCreateOrderSagaData> sagaDefinition;

  public NotificationBasedCreateOrderSaga(NotificationBasedCreateOrderSagaSteps steps) {
    this.sagaDefinition =
            step()
                  .invokeLocal(steps::createOrder)
                  .withCompensation(steps::rejectOrder)
            .step()
                  .invokeParticipant(NotificationBasedCreateOrderSagaData::reserveCredit)
                  .withCompensation(NotificationBasedCreateOrderSagaData::releaseCredit)
            .step()
                    .invokeParticipant(NotificationBasedCreateOrderSagaData::reserveInventory)
                    .withCompensationNotification(NotificationBasedCreateOrderSagaData::releaseInventory)
            .step()
                  .invokeLocal(steps::approveOrder)
            .step()
                  .notifyParticipant(NotificationBasedCreateOrderSagaData::fulfillOrder)
            .build();
  }

@cer
Copy link
Collaborator Author

cer commented Aug 9, 2022

Various remaining TODOs - see // TODO notifications

  • [] Reactive Sagas
  • [] Endpoints that support notifications
  • [] conditional notifications

cer added a commit that referenced this issue Aug 9, 2022
Extracted framework independent eventuate-tram-sagas-unit-testing-support from eventuate-tram-sagas-testing-support
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

1 participant