-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathchild_workflow.rb
More file actions
30 lines (28 loc) · 876 Bytes
/
child_workflow.rb
File metadata and controls
30 lines (28 loc) · 876 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true
require 'temporalio/workflow'
require_relative 'compose_greeting_activity'
require_relative '../test_service'
module Polling
module PeriodicSequence
class ChildWorkflow < Temporalio::Workflow::Definition
def execute(name)
4.times do
begin
return Temporalio::Workflow.execute_activity(
ComposeGreetingActivity,
{ greeting: 'Hello', name: name },
retry_policy: Temporalio::RetryPolicy.new(
max_attempts: 1
),
start_to_close_timeout: 4
)
rescue Temporalio::Error::ActivityError
Temporalio::Workflow.logger.info('Activity failed')
end
Temporalio::Workflow.sleep(1)
end
raise Temporalio::Workflow::ContinueAsNewError, name
end
end
end
end