tweak call activity

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
This commit is contained in:
Cassandra Coyle 2025-05-29 14:41:10 -05:00
parent 2cc0343aef
commit 79de8dac19
No known key found for this signature in database
1 changed files with 4 additions and 4 deletions

View File

@ -1406,7 +1406,7 @@ Common use cases for the compensation pattern include:
- **Resource Provisioning**: When provisioning cloud resources across multiple providers, if one step fails, you need to clean up all previously provisioned resources. - **Resource Provisioning**: When provisioning cloud resources across multiple providers, if one step fails, you need to clean up all previously provisioned resources.
- **Multi-Step Business Processes**: Any business process that involves multiple irreversible steps that may need to be undone in case of later failures. - **Multi-Step Business Processes**: Any business process that involves multiple irreversible steps that may need to be undone in case of later failures.
Dapr Workflow provides support for the compensation pattern, allowing you to register compensation activities for each step and automatically execute them in reverse order when needed. Dapr Workflow provides support for the compensation pattern, allowing you to register compensation activities for each step and execute them in reverse order when needed.
{{< tabs Java >}} {{< tabs Java >}}
@ -1455,7 +1455,7 @@ public class PaymentProcessingWorkflow implements Workflow {
switch (compensation) { switch (compensation) {
case "CancelShipment": case "CancelShipment":
String shipmentCancelResult = ctx.callActivity( String shipmentCancelResult = ctx.callActivity(
"CancelShipmentActivity", CancelShipmentActivity.class.getName(),
orderId, orderId,
String.class).await(); String.class).await();
ctx.getLogger().info("Shipment cancellation completed: {}", shipmentCancelResult); ctx.getLogger().info("Shipment cancellation completed: {}", shipmentCancelResult);
@ -1463,7 +1463,7 @@ public class PaymentProcessingWorkflow implements Workflow {
case "RefundPayment": case "RefundPayment":
String refundResult = ctx.callActivity( String refundResult = ctx.callActivity(
"RefundPaymentActivity", RefundPaymentActivity.class.getName(),
orderId, orderId,
String.class).await(); String.class).await();
ctx.getLogger().info("Payment refund completed: {}", refundResult); ctx.getLogger().info("Payment refund completed: {}", refundResult);
@ -1471,7 +1471,7 @@ public class PaymentProcessingWorkflow implements Workflow {
case "ReleaseInventory": case "ReleaseInventory":
String releaseResult = ctx.callActivity( String releaseResult = ctx.callActivity(
"ReleaseInventoryActivity", ReleaseInventoryActivity.class.getName(),
orderId, orderId,
String.class).await(); String.class).await();
ctx.getLogger().info("Inventory release completed: {}", releaseResult); ctx.getLogger().info("Inventory release completed: {}", releaseResult);