Debugging our Code
Let’s go ahead and fix the error in our Activity code by removing the raised error 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.
require 'temporalio/activity'
class WithdrawMoneyActivity < Temporalio::Activity::Definition
def execute(amount)
# raise StandardError, 'Bank service temporarily unavailable'
puts "Successfully withdrawn $#{amount}"
true
end
end
class DepositMoneyActivity < Temporalio::Activity::Definition
def execute(amount)
puts "Successfully deposited $#{amount}"
true
end
end