-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#76 Send one-way commands/notifications to saga participants
Extracted framework independent eventuate-tram-sagas-unit-testing-support from eventuate-tram-sagas-testing-support
- Loading branch information
Showing
44 changed files
with
468 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...imple-dsl/src/test/java/io/eventuate/tram/sagas/simpledsl/notifications/FulfillOrder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package io.eventuate.tram.sagas.simpledsl.notifications; | ||
|
||
import io.eventuate.tram.commands.common.Command; | ||
|
||
public class FulfillOrder implements Command { | ||
} |
34 changes: 34 additions & 0 deletions
34
...ava/io/eventuate/tram/sagas/simpledsl/notifications/NotificationBasedCreateOrderSaga.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package io.eventuate.tram.sagas.simpledsl.notifications; | ||
|
||
import io.eventuate.tram.sagas.orchestration.SagaDefinition; | ||
import io.eventuate.tram.sagas.simpledsl.SimpleSaga; | ||
|
||
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(); | ||
} | ||
|
||
|
||
@Override | ||
public SagaDefinition<NotificationBasedCreateOrderSagaData> getSagaDefinition() { | ||
return this.sagaDefinition; | ||
} | ||
|
||
} |
Oops, something went wrong.