-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathstarter.rb
More file actions
26 lines (22 loc) · 831 Bytes
/
starter.rb
File metadata and controls
26 lines (22 loc) · 831 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
# frozen_string_literal: true
require 'temporalio/client'
require 'temporalio/env_config'
require_relative 'codec'
require_relative 'my_workflow'
# Load config and apply defaults
args, kwargs = Temporalio::EnvConfig::ClientConfig.load_client_connect_options
args[0] ||= 'localhost:7233' # Default address
args[1] ||= 'default' # Default namespace
# Set data converter with our codec
data_converter = Temporalio::Converters::DataConverter.new(payload_codec: Encryption::Codec.new)
# Create a client
client = Temporalio::Client.connect(*args, **kwargs, data_converter: data_converter)
# Run workflow
puts 'Executing workflow'
result = client.execute_workflow(
Encryption::MyWorkflow,
'Temporal', # workflow argument
id: 'encryption-sample-workflow-id',
task_queue: 'encryption-sample'
)
puts "Workflow result: #{result}"