Handling Activity Expiration

Hi everybody I am new to temporal.
We are using unofficial temporal-ruby from coinbase. But I think this question is general.

Is it possible to handle non-retryable timeout manually?
I want to launch a new activity when an activity timeout?

WaitForPaymentActivity.execute!
# if payment activity timeout then
CancelPaymentActivity.execute!

I’m not sure about Ruby, but in all SDKs any non retryable timeout is reported as an exception (or error in case of Go) which can be handled inside the workflow code. So in Java it would be something like:

  try {
      a.waitForPaymentActivity();
  } catch (ActivityFailure e) {
      a.CancelPaymentActivity();
  }

Thanks for bring temporal to the world. Let me see how to do it in ruby sdk

Based on your example, you may also want to consider using sagas.

See temporal-ruby/trip_booking_workflow.rb at a4824d46334518f3820eaa0eae9435d3a21d26c0 · coinbase/temporal-ruby · GitHub for an example.

Oh, temporal-ruby has built-in saga feature? cool