Debugging our Code
Let’s go ahead and fix the exception in our Activity code by removing the thrown exeception or commenting it out and re-running our code to register the code change.
In practice, your code will continue retrying until whatever issue the Activity has encountered has resolved itself, whether that is the network coming back online or an internal service starting to respond again.
By leveraging the durability of Temporal and out of the box retry capabilities, you have avoided writing retry and timeout logic yourself and saved your downstream services from being unnecessarily overwhelmed.
public class ReimbursementActivitiesImpl implements ReimbursementActivities {
@Override
public boolean withdrawMoney(double amount) {
// throw new RuntimeException("Bank service temporarily unavailable");
System.out.println("Successfully withdrawn $" + amount);
return true;
}
@Override
public boolean depositMoney(double amount) {
System.out.println("Successfully desposited $" + amount);
return true;
}
}