temporalio 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Cargo.lock +4035 -0
- data/Cargo.toml +25 -0
- data/Gemfile +20 -0
- data/LICENSE +16 -15
- data/README.md +455 -195
- data/Rakefile +387 -0
- data/ext/Cargo.toml +25 -0
- data/lib/temporalio/activity/complete_async_error.rb +11 -0
- data/lib/temporalio/activity/context.rb +82 -77
- data/lib/temporalio/activity/definition.rb +77 -0
- data/lib/temporalio/activity/info.rb +42 -46
- data/lib/temporalio/activity.rb +49 -65
- data/lib/temporalio/api/batch/v1/message.rb +31 -0
- data/lib/temporalio/api/cloud/cloudservice/v1/request_response.rb +93 -0
- data/lib/temporalio/api/cloud/cloudservice/v1/service.rb +25 -0
- data/lib/temporalio/api/cloud/cloudservice.rb +3 -0
- data/lib/temporalio/api/cloud/identity/v1/message.rb +36 -0
- data/lib/temporalio/api/cloud/namespace/v1/message.rb +35 -0
- data/lib/temporalio/api/cloud/operation/v1/message.rb +27 -0
- data/lib/temporalio/api/cloud/region/v1/message.rb +23 -0
- data/lib/temporalio/api/command/v1/message.rb +46 -0
- data/lib/temporalio/api/common/v1/grpc_status.rb +23 -0
- data/lib/temporalio/api/common/v1/message.rb +41 -0
- data/lib/temporalio/api/enums/v1/batch_operation.rb +22 -0
- data/lib/temporalio/api/enums/v1/command_type.rb +21 -0
- data/lib/temporalio/api/enums/v1/common.rb +26 -0
- data/lib/temporalio/api/enums/v1/event_type.rb +21 -0
- data/lib/temporalio/api/enums/v1/failed_cause.rb +26 -0
- data/lib/temporalio/api/enums/v1/namespace.rb +23 -0
- data/lib/temporalio/api/enums/v1/query.rb +22 -0
- data/lib/temporalio/api/enums/v1/reset.rb +23 -0
- data/lib/temporalio/api/enums/v1/schedule.rb +21 -0
- data/lib/temporalio/api/enums/v1/task_queue.rb +25 -0
- data/lib/temporalio/api/enums/v1/update.rb +22 -0
- data/lib/temporalio/api/enums/v1/workflow.rb +30 -0
- data/lib/temporalio/api/errordetails/v1/message.rb +42 -0
- data/lib/temporalio/api/export/v1/message.rb +24 -0
- data/lib/temporalio/api/failure/v1/message.rb +35 -0
- data/lib/temporalio/api/filter/v1/message.rb +27 -0
- data/lib/temporalio/api/history/v1/message.rb +90 -0
- data/lib/temporalio/api/namespace/v1/message.rb +31 -0
- data/lib/temporalio/api/nexus/v1/message.rb +40 -0
- data/lib/temporalio/api/operatorservice/v1/request_response.rb +49 -0
- data/lib/temporalio/api/operatorservice/v1/service.rb +23 -0
- data/lib/temporalio/api/operatorservice.rb +3 -0
- data/lib/temporalio/api/protocol/v1/message.rb +23 -0
- data/lib/temporalio/api/query/v1/message.rb +27 -0
- data/lib/temporalio/api/replication/v1/message.rb +26 -0
- data/lib/temporalio/api/schedule/v1/message.rb +42 -0
- data/lib/temporalio/api/sdk/v1/enhanced_stack_trace.rb +25 -0
- data/lib/temporalio/api/sdk/v1/task_complete_metadata.rb +21 -0
- data/lib/temporalio/api/sdk/v1/user_metadata.rb +23 -0
- data/lib/temporalio/api/sdk/v1/workflow_metadata.rb +23 -0
- data/lib/temporalio/api/taskqueue/v1/message.rb +45 -0
- data/lib/temporalio/api/update/v1/message.rb +33 -0
- data/lib/temporalio/api/version/v1/message.rb +26 -0
- data/lib/temporalio/api/workflow/v1/message.rb +43 -0
- data/lib/temporalio/api/workflowservice/v1/request_response.rb +189 -0
- data/lib/temporalio/api/workflowservice/v1/service.rb +23 -0
- data/lib/temporalio/api/workflowservice.rb +3 -0
- data/lib/temporalio/api.rb +13 -0
- data/lib/temporalio/cancellation.rb +150 -0
- data/lib/temporalio/client/activity_id_reference.rb +32 -0
- data/lib/temporalio/client/async_activity_handle.rb +110 -0
- data/lib/temporalio/client/connection/cloud_service.rb +648 -0
- data/lib/temporalio/client/connection/operator_service.rb +249 -0
- data/lib/temporalio/client/connection/service.rb +41 -0
- data/lib/temporalio/client/connection/workflow_service.rb +1218 -0
- data/lib/temporalio/client/connection.rb +270 -0
- data/lib/temporalio/client/interceptor.rb +316 -0
- data/lib/temporalio/client/workflow_execution.rb +103 -0
- data/lib/temporalio/client/workflow_execution_count.rb +36 -0
- data/lib/temporalio/client/workflow_execution_status.rb +18 -0
- data/lib/temporalio/client/workflow_handle.rb +380 -177
- data/lib/temporalio/client/workflow_query_reject_condition.rb +14 -0
- data/lib/temporalio/client/workflow_update_handle.rb +67 -0
- data/lib/temporalio/client/workflow_update_wait_stage.rb +17 -0
- data/lib/temporalio/client.rb +366 -93
- data/lib/temporalio/common_enums.rb +24 -0
- data/lib/temporalio/converters/data_converter.rb +102 -0
- data/lib/temporalio/converters/failure_converter.rb +200 -0
- data/lib/temporalio/converters/payload_codec.rb +26 -0
- data/lib/temporalio/converters/payload_converter/binary_null.rb +34 -0
- data/lib/temporalio/converters/payload_converter/binary_plain.rb +35 -0
- data/lib/temporalio/converters/payload_converter/binary_protobuf.rb +42 -0
- data/lib/temporalio/converters/payload_converter/composite.rb +62 -0
- data/lib/temporalio/converters/payload_converter/encoding.rb +35 -0
- data/lib/temporalio/converters/payload_converter/json_plain.rb +44 -0
- data/lib/temporalio/converters/payload_converter/json_protobuf.rb +41 -0
- data/lib/temporalio/converters/payload_converter.rb +73 -0
- data/lib/temporalio/converters.rb +9 -0
- data/lib/temporalio/error/failure.rb +119 -94
- data/lib/temporalio/error.rb +147 -0
- data/lib/temporalio/internal/bridge/api/activity_result/activity_result.rb +34 -0
- data/lib/temporalio/internal/bridge/api/activity_task/activity_task.rb +31 -0
- data/lib/temporalio/internal/bridge/api/child_workflow/child_workflow.rb +33 -0
- data/lib/temporalio/internal/bridge/api/common/common.rb +26 -0
- data/lib/temporalio/internal/bridge/api/core_interface.rb +36 -0
- data/lib/temporalio/internal/bridge/api/external_data/external_data.rb +27 -0
- data/lib/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rb +52 -0
- data/lib/temporalio/internal/bridge/api/workflow_commands/workflow_commands.rb +54 -0
- data/lib/temporalio/internal/bridge/api/workflow_completion/workflow_completion.rb +30 -0
- data/lib/temporalio/internal/bridge/api.rb +3 -0
- data/lib/temporalio/internal/bridge/client.rb +90 -0
- data/lib/temporalio/internal/bridge/runtime.rb +53 -0
- data/lib/temporalio/internal/bridge/testing.rb +46 -0
- data/lib/temporalio/internal/bridge/worker.rb +83 -0
- data/lib/temporalio/internal/bridge.rb +36 -0
- data/lib/temporalio/internal/client/implementation.rb +525 -0
- data/lib/temporalio/internal/proto_utils.rb +54 -0
- data/lib/temporalio/internal/worker/activity_worker.rb +345 -0
- data/lib/temporalio/internal/worker/multi_runner.rb +169 -0
- data/lib/temporalio/internal.rb +7 -0
- data/lib/temporalio/retry_policy.rb +39 -80
- data/lib/temporalio/runtime.rb +259 -13
- data/lib/temporalio/scoped_logger.rb +96 -0
- data/lib/temporalio/search_attributes.rb +300 -0
- data/lib/temporalio/testing/activity_environment.rb +132 -0
- data/lib/temporalio/testing/workflow_environment.rb +113 -88
- data/lib/temporalio/testing.rb +4 -169
- data/lib/temporalio/version.rb +3 -1
- data/lib/temporalio/worker/activity_executor/fiber.rb +49 -0
- data/lib/temporalio/worker/activity_executor/thread_pool.rb +254 -0
- data/lib/temporalio/worker/activity_executor.rb +55 -0
- data/lib/temporalio/worker/interceptor.rb +88 -0
- data/lib/temporalio/worker/tuner.rb +151 -0
- data/lib/temporalio/worker.rb +385 -163
- data/lib/temporalio/workflow_history.rb +22 -0
- data/lib/temporalio.rb +2 -7
- data/temporalio.gemspec +20 -39
- metadata +131 -712
- data/bridge/Cargo.lock +0 -2997
- data/bridge/Cargo.toml +0 -29
- data/bridge/sdk-core/ARCHITECTURE.md +0 -76
- data/bridge/sdk-core/Cargo.toml +0 -2
- data/bridge/sdk-core/LICENSE.txt +0 -23
- data/bridge/sdk-core/README.md +0 -117
- data/bridge/sdk-core/arch_docs/diagrams/README.md +0 -10
- data/bridge/sdk-core/arch_docs/diagrams/sticky_queues.puml +0 -40
- data/bridge/sdk-core/arch_docs/diagrams/workflow_internals.svg +0 -1
- data/bridge/sdk-core/arch_docs/sticky_queues.md +0 -51
- data/bridge/sdk-core/client/Cargo.toml +0 -40
- data/bridge/sdk-core/client/LICENSE.txt +0 -23
- data/bridge/sdk-core/client/src/lib.rs +0 -1462
- data/bridge/sdk-core/client/src/metrics.rs +0 -174
- data/bridge/sdk-core/client/src/raw.rs +0 -932
- data/bridge/sdk-core/client/src/retry.rs +0 -763
- data/bridge/sdk-core/client/src/workflow_handle/mod.rs +0 -185
- data/bridge/sdk-core/core/Cargo.toml +0 -129
- data/bridge/sdk-core/core/LICENSE.txt +0 -23
- data/bridge/sdk-core/core/benches/workflow_replay.rs +0 -76
- data/bridge/sdk-core/core/src/abstractions.rs +0 -355
- data/bridge/sdk-core/core/src/core_tests/activity_tasks.rs +0 -1049
- data/bridge/sdk-core/core/src/core_tests/child_workflows.rs +0 -221
- data/bridge/sdk-core/core/src/core_tests/determinism.rs +0 -270
- data/bridge/sdk-core/core/src/core_tests/local_activities.rs +0 -1046
- data/bridge/sdk-core/core/src/core_tests/mod.rs +0 -100
- data/bridge/sdk-core/core/src/core_tests/queries.rs +0 -893
- data/bridge/sdk-core/core/src/core_tests/replay_flag.rs +0 -65
- data/bridge/sdk-core/core/src/core_tests/workers.rs +0 -257
- data/bridge/sdk-core/core/src/core_tests/workflow_cancels.rs +0 -124
- data/bridge/sdk-core/core/src/core_tests/workflow_tasks.rs +0 -2433
- data/bridge/sdk-core/core/src/ephemeral_server/mod.rs +0 -609
- data/bridge/sdk-core/core/src/internal_flags.rs +0 -136
- data/bridge/sdk-core/core/src/lib.rs +0 -289
- data/bridge/sdk-core/core/src/pollers/mod.rs +0 -54
- data/bridge/sdk-core/core/src/pollers/poll_buffer.rs +0 -297
- data/bridge/sdk-core/core/src/protosext/mod.rs +0 -428
- data/bridge/sdk-core/core/src/replay/mod.rs +0 -215
- data/bridge/sdk-core/core/src/retry_logic.rs +0 -202
- data/bridge/sdk-core/core/src/telemetry/log_export.rs +0 -190
- data/bridge/sdk-core/core/src/telemetry/metrics.rs +0 -462
- data/bridge/sdk-core/core/src/telemetry/mod.rs +0 -423
- data/bridge/sdk-core/core/src/telemetry/prometheus_server.rs +0 -83
- data/bridge/sdk-core/core/src/test_help/mod.rs +0 -939
- data/bridge/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +0 -536
- data/bridge/sdk-core/core/src/worker/activities/activity_task_poller_stream.rs +0 -89
- data/bridge/sdk-core/core/src/worker/activities/local_activities.rs +0 -1278
- data/bridge/sdk-core/core/src/worker/activities.rs +0 -557
- data/bridge/sdk-core/core/src/worker/client/mocks.rs +0 -107
- data/bridge/sdk-core/core/src/worker/client.rs +0 -389
- data/bridge/sdk-core/core/src/worker/mod.rs +0 -677
- data/bridge/sdk-core/core/src/worker/workflow/bridge.rs +0 -35
- data/bridge/sdk-core/core/src/worker/workflow/driven_workflow.rs +0 -99
- data/bridge/sdk-core/core/src/worker/workflow/history_update.rs +0 -1111
- data/bridge/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +0 -964
- data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +0 -294
- data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +0 -168
- data/bridge/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +0 -918
- data/bridge/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +0 -137
- data/bridge/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +0 -158
- data/bridge/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +0 -130
- data/bridge/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +0 -1525
- data/bridge/sdk-core/core/src/worker/workflow/machines/mod.rs +0 -324
- data/bridge/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +0 -179
- data/bridge/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +0 -659
- data/bridge/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +0 -439
- data/bridge/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +0 -435
- data/bridge/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +0 -175
- data/bridge/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +0 -249
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines/local_acts.rs +0 -85
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +0 -1280
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +0 -269
- data/bridge/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +0 -213
- data/bridge/sdk-core/core/src/worker/workflow/managed_run.rs +0 -1305
- data/bridge/sdk-core/core/src/worker/workflow/mod.rs +0 -1276
- data/bridge/sdk-core/core/src/worker/workflow/run_cache.rs +0 -128
- data/bridge/sdk-core/core/src/worker/workflow/wft_extraction.rs +0 -125
- data/bridge/sdk-core/core/src/worker/workflow/wft_poller.rs +0 -85
- data/bridge/sdk-core/core/src/worker/workflow/workflow_stream/saved_wf_inputs.rs +0 -117
- data/bridge/sdk-core/core/src/worker/workflow/workflow_stream/tonic_status_serde.rs +0 -24
- data/bridge/sdk-core/core/src/worker/workflow/workflow_stream.rs +0 -715
- data/bridge/sdk-core/core-api/Cargo.toml +0 -33
- data/bridge/sdk-core/core-api/LICENSE.txt +0 -23
- data/bridge/sdk-core/core-api/src/errors.rs +0 -62
- data/bridge/sdk-core/core-api/src/lib.rs +0 -113
- data/bridge/sdk-core/core-api/src/telemetry.rs +0 -141
- data/bridge/sdk-core/core-api/src/worker.rs +0 -161
- data/bridge/sdk-core/etc/deps.svg +0 -162
- data/bridge/sdk-core/etc/dynamic-config.yaml +0 -2
- data/bridge/sdk-core/etc/otel-collector-config.yaml +0 -36
- data/bridge/sdk-core/etc/prometheus.yaml +0 -6
- data/bridge/sdk-core/etc/regen-depgraph.sh +0 -5
- data/bridge/sdk-core/fsm/Cargo.toml +0 -18
- data/bridge/sdk-core/fsm/LICENSE.txt +0 -23
- data/bridge/sdk-core/fsm/README.md +0 -3
- data/bridge/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +0 -27
- data/bridge/sdk-core/fsm/rustfsm_procmacro/LICENSE.txt +0 -23
- data/bridge/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +0 -650
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/progress.rs +0 -8
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dupe_transitions_fail.rs +0 -18
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dupe_transitions_fail.stderr +0 -12
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dynamic_dest_pass.rs +0 -41
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/forgot_name_fail.rs +0 -14
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/forgot_name_fail.stderr +0 -11
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/handler_arg_pass.rs +0 -32
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/handler_pass.rs +0 -31
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/medium_complex_pass.rs +0 -46
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.rs +0 -29
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +0 -12
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/simple_pass.rs +0 -32
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/struct_event_variant_fail.rs +0 -18
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/struct_event_variant_fail.stderr +0 -5
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_more_item_event_variant_fail.rs +0 -11
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_more_item_event_variant_fail.stderr +0 -5
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_zero_item_event_variant_fail.rs +0 -11
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_zero_item_event_variant_fail.stderr +0 -5
- data/bridge/sdk-core/fsm/rustfsm_trait/Cargo.toml +0 -14
- data/bridge/sdk-core/fsm/rustfsm_trait/LICENSE.txt +0 -23
- data/bridge/sdk-core/fsm/rustfsm_trait/src/lib.rs +0 -254
- data/bridge/sdk-core/fsm/src/lib.rs +0 -2
- data/bridge/sdk-core/histories/evict_while_la_running_no_interference-16_history.bin +0 -0
- data/bridge/sdk-core/histories/evict_while_la_running_no_interference-23_history.bin +0 -0
- data/bridge/sdk-core/histories/evict_while_la_running_no_interference-85_history.bin +0 -0
- data/bridge/sdk-core/histories/fail_wf_task.bin +0 -0
- data/bridge/sdk-core/histories/timer_workflow_history.bin +0 -0
- data/bridge/sdk-core/integ-with-otel.sh +0 -7
- data/bridge/sdk-core/protos/api_upstream/README.md +0 -9
- data/bridge/sdk-core/protos/api_upstream/api-linter.yaml +0 -40
- data/bridge/sdk-core/protos/api_upstream/buf.yaml +0 -9
- data/bridge/sdk-core/protos/api_upstream/build/go.mod +0 -7
- data/bridge/sdk-core/protos/api_upstream/build/go.sum +0 -5
- data/bridge/sdk-core/protos/api_upstream/build/tools.go +0 -29
- data/bridge/sdk-core/protos/api_upstream/dependencies/gogoproto/gogo.proto +0 -141
- data/bridge/sdk-core/protos/api_upstream/go.mod +0 -6
- data/bridge/sdk-core/protos/api_upstream/temporal/api/batch/v1/message.proto +0 -89
- data/bridge/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +0 -248
- data/bridge/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +0 -123
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +0 -47
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +0 -52
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/common.proto +0 -56
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +0 -170
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +0 -123
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/namespace.proto +0 -51
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/query.proto +0 -50
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +0 -41
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/schedule.proto +0 -60
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +0 -59
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +0 -56
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +0 -122
- data/bridge/sdk-core/protos/api_upstream/temporal/api/errordetails/v1/message.proto +0 -108
- data/bridge/sdk-core/protos/api_upstream/temporal/api/failure/v1/message.proto +0 -114
- data/bridge/sdk-core/protos/api_upstream/temporal/api/filter/v1/message.proto +0 -56
- data/bridge/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +0 -787
- data/bridge/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +0 -99
- data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +0 -124
- data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +0 -80
- data/bridge/sdk-core/protos/api_upstream/temporal/api/protocol/v1/message.proto +0 -57
- data/bridge/sdk-core/protos/api_upstream/temporal/api/query/v1/message.proto +0 -61
- data/bridge/sdk-core/protos/api_upstream/temporal/api/replication/v1/message.proto +0 -55
- data/bridge/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +0 -379
- data/bridge/sdk-core/protos/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +0 -63
- data/bridge/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +0 -108
- data/bridge/sdk-core/protos/api_upstream/temporal/api/update/v1/message.proto +0 -111
- data/bridge/sdk-core/protos/api_upstream/temporal/api/version/v1/message.proto +0 -59
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +0 -146
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +0 -1199
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +0 -415
- data/bridge/sdk-core/protos/grpc/health/v1/health.proto +0 -63
- data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +0 -79
- data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +0 -80
- data/bridge/sdk-core/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +0 -78
- data/bridge/sdk-core/protos/local/temporal/sdk/core/common/common.proto +0 -16
- data/bridge/sdk-core/protos/local/temporal/sdk/core/core_interface.proto +0 -31
- data/bridge/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +0 -31
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +0 -270
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +0 -305
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +0 -35
- data/bridge/sdk-core/protos/testsrv_upstream/api-linter.yaml +0 -38
- data/bridge/sdk-core/protos/testsrv_upstream/buf.yaml +0 -13
- data/bridge/sdk-core/protos/testsrv_upstream/dependencies/gogoproto/gogo.proto +0 -141
- data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +0 -63
- data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +0 -90
- data/bridge/sdk-core/rustfmt.toml +0 -1
- data/bridge/sdk-core/sdk/Cargo.toml +0 -48
- data/bridge/sdk-core/sdk/LICENSE.txt +0 -23
- data/bridge/sdk-core/sdk/src/activity_context.rs +0 -230
- data/bridge/sdk-core/sdk/src/app_data.rs +0 -37
- data/bridge/sdk-core/sdk/src/interceptors.rs +0 -50
- data/bridge/sdk-core/sdk/src/lib.rs +0 -861
- data/bridge/sdk-core/sdk/src/payload_converter.rs +0 -11
- data/bridge/sdk-core/sdk/src/workflow_context/options.rs +0 -295
- data/bridge/sdk-core/sdk/src/workflow_context.rs +0 -694
- data/bridge/sdk-core/sdk/src/workflow_future.rs +0 -500
- data/bridge/sdk-core/sdk-core-protos/Cargo.toml +0 -33
- data/bridge/sdk-core/sdk-core-protos/LICENSE.txt +0 -23
- data/bridge/sdk-core/sdk-core-protos/build.rs +0 -142
- data/bridge/sdk-core/sdk-core-protos/src/constants.rs +0 -7
- data/bridge/sdk-core/sdk-core-protos/src/history_builder.rs +0 -557
- data/bridge/sdk-core/sdk-core-protos/src/history_info.rs +0 -234
- data/bridge/sdk-core/sdk-core-protos/src/lib.rs +0 -2088
- data/bridge/sdk-core/sdk-core-protos/src/task_token.rs +0 -48
- data/bridge/sdk-core/sdk-core-protos/src/utilities.rs +0 -14
- data/bridge/sdk-core/test-utils/Cargo.toml +0 -38
- data/bridge/sdk-core/test-utils/src/canned_histories.rs +0 -1389
- data/bridge/sdk-core/test-utils/src/histfetch.rs +0 -28
- data/bridge/sdk-core/test-utils/src/lib.rs +0 -709
- data/bridge/sdk-core/test-utils/src/wf_input_saver.rs +0 -50
- data/bridge/sdk-core/test-utils/src/workflows.rs +0 -29
- data/bridge/sdk-core/tests/fuzzy_workflow.rs +0 -130
- data/bridge/sdk-core/tests/heavy_tests.rs +0 -265
- data/bridge/sdk-core/tests/integ_tests/client_tests.rs +0 -36
- data/bridge/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +0 -150
- data/bridge/sdk-core/tests/integ_tests/heartbeat_tests.rs +0 -223
- data/bridge/sdk-core/tests/integ_tests/metrics_tests.rs +0 -239
- data/bridge/sdk-core/tests/integ_tests/polling_tests.rs +0 -90
- data/bridge/sdk-core/tests/integ_tests/queries_tests.rs +0 -314
- data/bridge/sdk-core/tests/integ_tests/visibility_tests.rs +0 -151
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/activities.rs +0 -902
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +0 -61
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +0 -60
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +0 -51
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +0 -51
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +0 -64
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +0 -47
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +0 -669
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +0 -54
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/patches.rs +0 -92
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/replay.rs +0 -228
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/resets.rs +0 -94
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/signals.rs +0 -171
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +0 -85
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/timers.rs +0 -120
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +0 -77
- data/bridge/sdk-core/tests/integ_tests/workflow_tests.rs +0 -596
- data/bridge/sdk-core/tests/main.rs +0 -103
- data/bridge/sdk-core/tests/runner.rs +0 -132
- data/bridge/sdk-core/tests/wf_input_replay.rs +0 -32
- data/bridge/src/connection.rs +0 -202
- data/bridge/src/lib.rs +0 -494
- data/bridge/src/runtime.rs +0 -54
- data/bridge/src/test_server.rs +0 -153
- data/bridge/src/worker.rs +0 -197
- data/ext/Rakefile +0 -9
- data/lib/gen/dependencies/gogoproto/gogo_pb.rb +0 -14
- data/lib/gen/temporal/api/batch/v1/message_pb.rb +0 -50
- data/lib/gen/temporal/api/command/v1/message_pb.rb +0 -160
- data/lib/gen/temporal/api/common/v1/message_pb.rb +0 -73
- data/lib/gen/temporal/api/enums/v1/batch_operation_pb.rb +0 -33
- data/lib/gen/temporal/api/enums/v1/command_type_pb.rb +0 -37
- data/lib/gen/temporal/api/enums/v1/common_pb.rb +0 -42
- data/lib/gen/temporal/api/enums/v1/event_type_pb.rb +0 -68
- data/lib/gen/temporal/api/enums/v1/failed_cause_pb.rb +0 -79
- data/lib/gen/temporal/api/enums/v1/namespace_pb.rb +0 -37
- data/lib/gen/temporal/api/enums/v1/query_pb.rb +0 -31
- data/lib/gen/temporal/api/enums/v1/reset_pb.rb +0 -24
- data/lib/gen/temporal/api/enums/v1/schedule_pb.rb +0 -28
- data/lib/gen/temporal/api/enums/v1/task_queue_pb.rb +0 -30
- data/lib/gen/temporal/api/enums/v1/update_pb.rb +0 -25
- data/lib/gen/temporal/api/enums/v1/workflow_pb.rb +0 -89
- data/lib/gen/temporal/api/errordetails/v1/message_pb.rb +0 -84
- data/lib/gen/temporal/api/failure/v1/message_pb.rb +0 -83
- data/lib/gen/temporal/api/filter/v1/message_pb.rb +0 -40
- data/lib/gen/temporal/api/history/v1/message_pb.rb +0 -498
- data/lib/gen/temporal/api/namespace/v1/message_pb.rb +0 -64
- data/lib/gen/temporal/api/operatorservice/v1/request_response_pb.rb +0 -88
- data/lib/gen/temporal/api/operatorservice/v1/service_pb.rb +0 -20
- data/lib/gen/temporal/api/protocol/v1/message_pb.rb +0 -30
- data/lib/gen/temporal/api/query/v1/message_pb.rb +0 -38
- data/lib/gen/temporal/api/replication/v1/message_pb.rb +0 -37
- data/lib/gen/temporal/api/schedule/v1/message_pb.rb +0 -149
- data/lib/gen/temporal/api/sdk/v1/task_complete_metadata_pb.rb +0 -23
- data/lib/gen/temporal/api/taskqueue/v1/message_pb.rb +0 -73
- data/lib/gen/temporal/api/testservice/v1/request_response_pb.rb +0 -49
- data/lib/gen/temporal/api/testservice/v1/service_pb.rb +0 -21
- data/lib/gen/temporal/api/update/v1/message_pb.rb +0 -72
- data/lib/gen/temporal/api/version/v1/message_pb.rb +0 -41
- data/lib/gen/temporal/api/workflow/v1/message_pb.rb +0 -111
- data/lib/gen/temporal/api/workflowservice/v1/request_response_pb.rb +0 -798
- data/lib/gen/temporal/api/workflowservice/v1/service_pb.rb +0 -20
- data/lib/gen/temporal/sdk/core/activity_result/activity_result_pb.rb +0 -62
- data/lib/gen/temporal/sdk/core/activity_task/activity_task_pb.rb +0 -61
- data/lib/gen/temporal/sdk/core/child_workflow/child_workflow_pb.rb +0 -61
- data/lib/gen/temporal/sdk/core/common/common_pb.rb +0 -26
- data/lib/gen/temporal/sdk/core/core_interface_pb.rb +0 -40
- data/lib/gen/temporal/sdk/core/external_data/external_data_pb.rb +0 -31
- data/lib/gen/temporal/sdk/core/workflow_activation/workflow_activation_pb.rb +0 -171
- data/lib/gen/temporal/sdk/core/workflow_commands/workflow_commands_pb.rb +0 -200
- data/lib/gen/temporal/sdk/core/workflow_completion/workflow_completion_pb.rb +0 -41
- data/lib/temporalio/bridge/connect_options.rb +0 -15
- data/lib/temporalio/bridge/error.rb +0 -8
- data/lib/temporalio/bridge/retry_config.rb +0 -24
- data/lib/temporalio/bridge/tls_options.rb +0 -19
- data/lib/temporalio/bridge.rb +0 -14
- data/lib/temporalio/client/implementation.rb +0 -340
- data/lib/temporalio/connection/retry_config.rb +0 -44
- data/lib/temporalio/connection/service.rb +0 -20
- data/lib/temporalio/connection/test_service.rb +0 -92
- data/lib/temporalio/connection/tls_options.rb +0 -51
- data/lib/temporalio/connection/workflow_service.rb +0 -731
- data/lib/temporalio/connection.rb +0 -86
- data/lib/temporalio/data_converter.rb +0 -191
- data/lib/temporalio/error/workflow_failure.rb +0 -19
- data/lib/temporalio/errors.rb +0 -40
- data/lib/temporalio/failure_converter/base.rb +0 -26
- data/lib/temporalio/failure_converter/basic.rb +0 -319
- data/lib/temporalio/failure_converter.rb +0 -7
- data/lib/temporalio/interceptor/activity_inbound.rb +0 -22
- data/lib/temporalio/interceptor/activity_outbound.rb +0 -24
- data/lib/temporalio/interceptor/chain.rb +0 -28
- data/lib/temporalio/interceptor/client.rb +0 -127
- data/lib/temporalio/interceptor.rb +0 -22
- data/lib/temporalio/payload_codec/base.rb +0 -32
- data/lib/temporalio/payload_converter/base.rb +0 -24
- data/lib/temporalio/payload_converter/bytes.rb +0 -27
- data/lib/temporalio/payload_converter/composite.rb +0 -49
- data/lib/temporalio/payload_converter/encoding_base.rb +0 -35
- data/lib/temporalio/payload_converter/json.rb +0 -26
- data/lib/temporalio/payload_converter/nil.rb +0 -26
- data/lib/temporalio/payload_converter.rb +0 -14
- data/lib/temporalio/retry_state.rb +0 -35
- data/lib/temporalio/testing/time_skipping_handle.rb +0 -32
- data/lib/temporalio/testing/time_skipping_interceptor.rb +0 -23
- data/lib/temporalio/timeout_type.rb +0 -29
- data/lib/temporalio/worker/activity_runner.rb +0 -114
- data/lib/temporalio/worker/activity_worker.rb +0 -164
- data/lib/temporalio/worker/reactor.rb +0 -46
- data/lib/temporalio/worker/runner.rb +0 -63
- data/lib/temporalio/worker/sync_worker.rb +0 -124
- data/lib/temporalio/worker/thread_pool_executor.rb +0 -51
- data/lib/temporalio/workflow/async.rb +0 -46
- data/lib/temporalio/workflow/execution_info.rb +0 -54
- data/lib/temporalio/workflow/execution_status.rb +0 -36
- data/lib/temporalio/workflow/future.rb +0 -138
- data/lib/temporalio/workflow/id_reuse_policy.rb +0 -36
- data/lib/temporalio/workflow/info.rb +0 -76
- data/lib/temporalio/workflow/query_reject_condition.rb +0 -33
- data/lib/thermite_patch.rb +0 -33
- data/sig/async.rbs +0 -17
- data/sig/protobuf.rbs +0 -16
- data/sig/protos/dependencies/gogoproto/gogo.rbs +0 -914
- data/sig/protos/google/protobuf/any.rbs +0 -157
- data/sig/protos/google/protobuf/descriptor.rbs +0 -2825
- data/sig/protos/google/protobuf/duration.rbs +0 -114
- data/sig/protos/google/protobuf/empty.rbs +0 -36
- data/sig/protos/google/protobuf/timestamp.rbs +0 -145
- data/sig/protos/google/protobuf/wrappers.rbs +0 -358
- data/sig/protos/temporal/api/batch/v1/message.rbs +0 -300
- data/sig/protos/temporal/api/command/v1/message.rbs +0 -1399
- data/sig/protos/temporal/api/common/v1/message.rbs +0 -528
- data/sig/protos/temporal/api/enums/v1/batch_operation.rbs +0 -79
- data/sig/protos/temporal/api/enums/v1/command_type.rbs +0 -68
- data/sig/protos/temporal/api/enums/v1/common.rbs +0 -118
- data/sig/protos/temporal/api/enums/v1/event_type.rbs +0 -264
- data/sig/protos/temporal/api/enums/v1/failed_cause.rbs +0 -277
- data/sig/protos/temporal/api/enums/v1/namespace.rbs +0 -108
- data/sig/protos/temporal/api/enums/v1/query.rbs +0 -81
- data/sig/protos/temporal/api/enums/v1/reset.rbs +0 -44
- data/sig/protos/temporal/api/enums/v1/schedule.rbs +0 -72
- data/sig/protos/temporal/api/enums/v1/task_queue.rbs +0 -92
- data/sig/protos/temporal/api/enums/v1/update.rbs +0 -64
- data/sig/protos/temporal/api/enums/v1/workflow.rbs +0 -371
- data/sig/protos/temporal/api/errordetails/v1/message.rbs +0 -551
- data/sig/protos/temporal/api/failure/v1/message.rbs +0 -581
- data/sig/protos/temporal/api/filter/v1/message.rbs +0 -171
- data/sig/protos/temporal/api/history/v1/message.rbs +0 -4609
- data/sig/protos/temporal/api/namespace/v1/message.rbs +0 -410
- data/sig/protos/temporal/api/operatorservice/v1/request_response.rbs +0 -643
- data/sig/protos/temporal/api/operatorservice/v1/service.rbs +0 -17
- data/sig/protos/temporal/api/protocol/v1/message.rbs +0 -84
- data/sig/protos/temporal/api/query/v1/message.rbs +0 -182
- data/sig/protos/temporal/api/replication/v1/message.rbs +0 -148
- data/sig/protos/temporal/api/schedule/v1/message.rbs +0 -1488
- data/sig/protos/temporal/api/sdk/v1/task_complete_metadata.rbs +0 -110
- data/sig/protos/temporal/api/taskqueue/v1/message.rbs +0 -486
- data/sig/protos/temporal/api/testservice/v1/request_response.rbs +0 -249
- data/sig/protos/temporal/api/testservice/v1/service.rbs +0 -15
- data/sig/protos/temporal/api/update/v1/message.rbs +0 -489
- data/sig/protos/temporal/api/version/v1/message.rbs +0 -184
- data/sig/protos/temporal/api/workflow/v1/message.rbs +0 -824
- data/sig/protos/temporal/api/workflowservice/v1/request_response.rbs +0 -7250
- data/sig/protos/temporal/api/workflowservice/v1/service.rbs +0 -22
- data/sig/protos/temporal/sdk/core/activity_result/activity_result.rbs +0 -380
- data/sig/protos/temporal/sdk/core/activity_task/activity_task.rbs +0 -386
- data/sig/protos/temporal/sdk/core/child_workflow/child_workflow.rbs +0 -323
- data/sig/protos/temporal/sdk/core/common/common.rbs +0 -62
- data/sig/protos/temporal/sdk/core/core_interface.rbs +0 -101
- data/sig/protos/temporal/sdk/core/external_data/external_data.rbs +0 -119
- data/sig/protos/temporal/sdk/core/workflow_activation/workflow_activation.rbs +0 -1473
- data/sig/protos/temporal/sdk/core/workflow_commands/workflow_commands.rbs +0 -1784
- data/sig/protos/temporal/sdk/core/workflow_completion/workflow_completion.rbs +0 -180
- data/sig/ruby.rbs +0 -12
- data/sig/temporalio/activity/context.rbs +0 -29
- data/sig/temporalio/activity/info.rbs +0 -43
- data/sig/temporalio/activity.rbs +0 -19
- data/sig/temporalio/bridge/connect_options.rbs +0 -19
- data/sig/temporalio/bridge/error.rbs +0 -8
- data/sig/temporalio/bridge/retry_config.rbs +0 -21
- data/sig/temporalio/bridge/tls_options.rbs +0 -17
- data/sig/temporalio/bridge.rbs +0 -71
- data/sig/temporalio/client/implementation.rbs +0 -38
- data/sig/temporalio/client/workflow_handle.rbs +0 -41
- data/sig/temporalio/client.rbs +0 -35
- data/sig/temporalio/connection/retry_config.rbs +0 -37
- data/sig/temporalio/connection/service.rbs +0 -14
- data/sig/temporalio/connection/test_service.rbs +0 -13
- data/sig/temporalio/connection/tls_options.rbs +0 -43
- data/sig/temporalio/connection/workflow_service.rbs +0 -48
- data/sig/temporalio/connection.rbs +0 -30
- data/sig/temporalio/data_converter.rbs +0 -35
- data/sig/temporalio/error/failure.rbs +0 -121
- data/sig/temporalio/error/workflow_failure.rbs +0 -9
- data/sig/temporalio/errors.rbs +0 -36
- data/sig/temporalio/failure_converter/base.rbs +0 -12
- data/sig/temporalio/failure_converter/basic.rbs +0 -86
- data/sig/temporalio/failure_converter.rbs +0 -5
- data/sig/temporalio/interceptor/activity_inbound.rbs +0 -21
- data/sig/temporalio/interceptor/activity_outbound.rbs +0 -10
- data/sig/temporalio/interceptor/chain.rbs +0 -24
- data/sig/temporalio/interceptor/client.rbs +0 -148
- data/sig/temporalio/interceptor.rbs +0 -6
- data/sig/temporalio/payload_codec/base.rbs +0 -12
- data/sig/temporalio/payload_converter/base.rbs +0 -12
- data/sig/temporalio/payload_converter/bytes.rbs +0 -9
- data/sig/temporalio/payload_converter/composite.rbs +0 -19
- data/sig/temporalio/payload_converter/encoding_base.rbs +0 -14
- data/sig/temporalio/payload_converter/json.rbs +0 -9
- data/sig/temporalio/payload_converter/nil.rbs +0 -9
- data/sig/temporalio/payload_converter.rbs +0 -5
- data/sig/temporalio/retry_policy.rbs +0 -25
- data/sig/temporalio/retry_state.rbs +0 -20
- data/sig/temporalio/runtime.rbs +0 -12
- data/sig/temporalio/testing/time_skipping_handle.rbs +0 -15
- data/sig/temporalio/testing/time_skipping_interceptor.rbs +0 -13
- data/sig/temporalio/testing/workflow_environment.rbs +0 -22
- data/sig/temporalio/testing.rbs +0 -35
- data/sig/temporalio/timeout_type.rbs +0 -15
- data/sig/temporalio/version.rbs +0 -3
- data/sig/temporalio/worker/activity_runner.rbs +0 -35
- data/sig/temporalio/worker/activity_worker.rbs +0 -44
- data/sig/temporalio/worker/reactor.rbs +0 -22
- data/sig/temporalio/worker/runner.rbs +0 -21
- data/sig/temporalio/worker/sync_worker.rbs +0 -23
- data/sig/temporalio/worker/thread_pool_executor.rbs +0 -23
- data/sig/temporalio/worker.rbs +0 -46
- data/sig/temporalio/workflow/async.rbs +0 -9
- data/sig/temporalio/workflow/execution_info.rbs +0 -55
- data/sig/temporalio/workflow/execution_status.rbs +0 -21
- data/sig/temporalio/workflow/future.rbs +0 -40
- data/sig/temporalio/workflow/id_reuse_policy.rbs +0 -15
- data/sig/temporalio/workflow/info.rbs +0 -55
- data/sig/temporalio/workflow/query_reject_condition.rbs +0 -14
- data/sig/temporalio.rbs +0 -2
- data/sig/thermite_patch.rbs +0 -15
data/README.md
CHANGED
|
@@ -1,303 +1,563 @@
|
|
|
1
|
-
|
|
1
|
+

|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://rubygems.org/gems/temporalio)
|
|
6
6
|
|
|
7
|
-
[Temporal](https://temporal.io/) is a distributed, scalable, durable, and highly available
|
|
8
|
-
|
|
9
|
-
resilient way.
|
|
7
|
+
[Temporal](https://temporal.io/) is a distributed, scalable, durable, and highly available orchestration engine used to
|
|
8
|
+
execute asynchronous, long-running business logic in a scalable and resilient way.
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
programming language.
|
|
10
|
+
**Temporal Ruby SDK** is the framework for authoring workflows and activities using the Ruby programming language.
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
Also see:
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
* [Ruby Samples](https://github.com/temporalio/samples-ruby)
|
|
15
|
+
* [API Documentation](https://rubydoc.info/gems/temporalio)
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
⚠️ UNDER ACTIVE DEVELOPMENT
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
19
|
+
This SDK is under active development and has not released a stable version yet. APIs may change in incompatible ways
|
|
20
|
+
until the SDK is marked stable. The SDK has undergone a refresh from a previous unstable version. The last tag before
|
|
21
|
+
this refresh is [v0.1.1](https://github.com/temporalio/sdk-ruby/tree/v0.1.1). Please reference that tag for the
|
|
22
|
+
previous code if needed.
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
Notably missing from this SDK:
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
* Workflow workers
|
|
27
|
+
|
|
28
|
+
**NOTE: This README is for the current branch and not necessarily what's released on RubyGems.**
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
33
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
34
|
+
**Contents**
|
|
35
|
+
|
|
36
|
+
- [Quick Start](#quick-start)
|
|
37
|
+
- [Installation](#installation)
|
|
38
|
+
- [Implementing an Activity](#implementing-an-activity)
|
|
39
|
+
- [Running a Workflow](#running-a-workflow)
|
|
40
|
+
- [Usage](#usage)
|
|
41
|
+
- [Client](#client)
|
|
42
|
+
- [Cloud Client Using mTLS](#cloud-client-using-mtls)
|
|
43
|
+
- [Data Conversion](#data-conversion)
|
|
44
|
+
- [ActiveRecord and ActiveModel](#activerecord-and-activemodel)
|
|
45
|
+
- [Workers](#workers)
|
|
46
|
+
- [Workflows](#workflows)
|
|
47
|
+
- [Activities](#activities)
|
|
48
|
+
- [Activity Definition](#activity-definition)
|
|
49
|
+
- [Activity Context](#activity-context)
|
|
50
|
+
- [Activity Heartbeating and Cancellation](#activity-heartbeating-and-cancellation)
|
|
51
|
+
- [Activity Worker Shutdown](#activity-worker-shutdown)
|
|
52
|
+
- [Activity Concurrency and Executors](#activity-concurrency-and-executors)
|
|
53
|
+
- [Activity Testing](#activity-testing)
|
|
54
|
+
- [Platform Support](#platform-support)
|
|
55
|
+
- [Development](#development)
|
|
56
|
+
- [Build](#build)
|
|
57
|
+
- [Build Platform-specific Gem](#build-platform-specific-gem)
|
|
58
|
+
- [Testing](#testing)
|
|
59
|
+
- [Code Formatting and Type Checking](#code-formatting-and-type-checking)
|
|
60
|
+
- [Proto Generation](#proto-generation)
|
|
61
|
+
|
|
62
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
30
63
|
|
|
31
64
|
## Quick Start
|
|
32
65
|
|
|
33
66
|
### Installation
|
|
34
67
|
|
|
35
|
-
|
|
68
|
+
Can require in a Gemfile like:
|
|
36
69
|
|
|
37
|
-
```
|
|
70
|
+
```
|
|
38
71
|
gem 'temporalio'
|
|
39
72
|
```
|
|
40
73
|
|
|
41
|
-
|
|
74
|
+
Or via `gem install` like:
|
|
42
75
|
|
|
43
|
-
|
|
76
|
+
```
|
|
77
|
+
gem install temporalio
|
|
78
|
+
```
|
|
44
79
|
|
|
45
|
-
|
|
80
|
+
**NOTE**: Only macOS ARM/x64 and Linux ARM/x64 are supported, and the platform-specific gem chosen is based on when the
|
|
81
|
+
gem/bundle install is performed. A source gem is published but cannot be used directly and will fail to build if tried.
|
|
82
|
+
MinGW-based Windows and Linux MUSL do not have gems. See the [Platform Support](#platform-support) section for more
|
|
83
|
+
information.
|
|
46
84
|
|
|
47
|
-
|
|
85
|
+
**NOTE**: Due to [an issue](https://github.com/temporalio/sdk-ruby/issues/162), fibers (and `async` gem) are only
|
|
86
|
+
supported on Ruby versions 3.3 and newer.
|
|
87
|
+
|
|
88
|
+
### Implementing an Activity
|
|
89
|
+
|
|
90
|
+
Implementing workflows is not yet supported in the Ruby SDK, but implementing activities is.
|
|
48
91
|
|
|
49
|
-
|
|
92
|
+
For example, if you have a `SayHelloWorkflow` workflow in another Temporal language that invokes `SayHello` activity on
|
|
93
|
+
`my-task-queue` in Ruby, you can have the following Ruby script:
|
|
50
94
|
|
|
51
95
|
```ruby
|
|
52
|
-
|
|
53
|
-
|
|
96
|
+
require 'temporalio/activity'
|
|
97
|
+
require 'temporalio/cancellation'
|
|
98
|
+
require 'temporalio/client'
|
|
99
|
+
require 'temporalio/worker'
|
|
54
100
|
|
|
55
|
-
#
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
101
|
+
# Implementation of a simple activity
|
|
102
|
+
class SayHelloActivity < Temporalio::Activity
|
|
103
|
+
def execute(name)
|
|
104
|
+
"Hello, #{name}!"
|
|
105
|
+
end
|
|
106
|
+
end
|
|
60
107
|
|
|
61
|
-
#
|
|
62
|
-
client = Temporalio::Client.
|
|
108
|
+
# Create a client
|
|
109
|
+
client = Temporalio::Client.connect('localhost:7233', 'my-namespace')
|
|
63
110
|
|
|
64
|
-
#
|
|
65
|
-
|
|
111
|
+
# Create a worker with the client and activities
|
|
112
|
+
worker = Temporalio::Worker.new(
|
|
113
|
+
client:,
|
|
114
|
+
task_queue: 'my-task-queue',
|
|
115
|
+
# There are various forms an activity can take, see specific section for details.
|
|
116
|
+
activities: [SayHelloActivity]
|
|
117
|
+
)
|
|
66
118
|
|
|
67
|
-
#
|
|
68
|
-
|
|
69
|
-
|
|
119
|
+
# Run the worker until SIGINT. This can be done in many ways, see specific
|
|
120
|
+
# section for details.
|
|
121
|
+
worker.run(shutdown_signals: ['SIGINT'])
|
|
70
122
|
```
|
|
71
123
|
|
|
72
|
-
|
|
124
|
+
Running that will run the worker until Ctrl+C pressed.
|
|
73
125
|
|
|
74
|
-
|
|
75
|
-
- All positional arguments after the workflow name are treated as workflow arguments
|
|
76
|
-
- The `handle` represents the workflow that was started and can be used for more than just getting
|
|
77
|
-
the result
|
|
78
|
-
- Clients can have many more options not shown here (e.g. data converters and interceptors)
|
|
126
|
+
### Running a Workflow
|
|
79
127
|
|
|
80
|
-
|
|
128
|
+
Assuming that `SayHelloWorkflow` just calls this activity, it can be run like so:
|
|
81
129
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
130
|
+
```ruby
|
|
131
|
+
require 'temporalio/client'
|
|
132
|
+
|
|
133
|
+
# Create a client
|
|
134
|
+
client = Temporalio::Client.connect('localhost:7233', 'my-namespace')
|
|
135
|
+
|
|
136
|
+
# Run workflow
|
|
137
|
+
result = client.execute_workflow(
|
|
138
|
+
'SayHelloWorkflow',
|
|
139
|
+
'Temporal',
|
|
140
|
+
id: 'my-workflow-id',
|
|
141
|
+
task_queue: 'my-task-queue'
|
|
142
|
+
)
|
|
143
|
+
puts "Result: #{result}"
|
|
144
|
+
```
|
|
88
145
|
|
|
89
|
-
|
|
146
|
+
This will output:
|
|
90
147
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
supports
|
|
148
|
+
```
|
|
149
|
+
Result: Hello, Temporal!
|
|
150
|
+
```
|
|
95
151
|
|
|
96
|
-
|
|
97
|
-
different SDKs. A custom payload converter can be implemented to support these.
|
|
152
|
+
## Usage
|
|
98
153
|
|
|
99
|
-
###
|
|
154
|
+
### Client
|
|
100
155
|
|
|
101
|
-
|
|
156
|
+
A client can be created and used to start a workflow or otherwise interact with Temporal. For example:
|
|
102
157
|
|
|
103
158
|
```ruby
|
|
104
|
-
require 'temporalio'
|
|
105
|
-
|
|
106
|
-
# Establish a gRPC connection to the server
|
|
107
|
-
connection = Temporalio::Connection.new('localhost:7233')
|
|
159
|
+
require 'temporalio/client'
|
|
108
160
|
|
|
109
|
-
#
|
|
110
|
-
|
|
161
|
+
# Create a client
|
|
162
|
+
client = Temporalio::Client.connect('localhost:7233', 'my-namespace')
|
|
111
163
|
|
|
112
|
-
#
|
|
113
|
-
|
|
164
|
+
# Start a workflow
|
|
165
|
+
handle = client.start_workflow(
|
|
166
|
+
'SayHelloWorkflow',
|
|
167
|
+
'Temporal',
|
|
168
|
+
id: 'my-workflow-id',
|
|
169
|
+
task_queue: 'my-task-queue'
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
# Wait for result
|
|
173
|
+
result = handle.result
|
|
174
|
+
puts "Result: #{result}"
|
|
114
175
|
```
|
|
115
176
|
|
|
116
|
-
|
|
177
|
+
Notes about the above code:
|
|
117
178
|
|
|
118
|
-
|
|
119
|
-
|
|
179
|
+
* Temporal clients are not explicitly closed.
|
|
180
|
+
* To enable TLS, the `tls` option can be set to `true` or a `Temporalio::Client::Connection::TLSOptions` instance.
|
|
181
|
+
* Instead of `start_workflow` + `result` above, `execute_workflow` shortcut can be used if the handle is not needed.
|
|
182
|
+
* The `handle` above is a `Temporalio::Client::WorkflowHandle` which has several other operations that can be performed
|
|
183
|
+
on a workflow. To get a handle to an existing workflow, use `workflow_handle` on the client.
|
|
184
|
+
* Clients are thread safe and are fiber-compatible (but fiber compatibility only supported for Ruby 3.3+ at this time).
|
|
120
185
|
|
|
121
|
-
|
|
122
|
-
|
|
186
|
+
#### Cloud Client Using mTLS
|
|
187
|
+
|
|
188
|
+
Assuming a client certificate is present at `my-cert.pem` and a client key is present at `my-key.pem`, this is how to
|
|
189
|
+
connect to Temporal Cloud:
|
|
123
190
|
|
|
124
191
|
```ruby
|
|
125
|
-
|
|
192
|
+
require 'temporalio/client'
|
|
193
|
+
|
|
194
|
+
# Create a client
|
|
195
|
+
client = Temporalio::Client.connect(
|
|
196
|
+
'my-namespace.a1b2c.tmprl.cloud:7233',
|
|
197
|
+
'my-namespace.a1b2c',
|
|
198
|
+
tls: Temporalio::Client::Connection::TLSOptions.new(
|
|
199
|
+
client_cert: File.read('my-cert.pem'),
|
|
200
|
+
client_private_key: File.read('my-key.pem')
|
|
201
|
+
))
|
|
202
|
+
```
|
|
126
203
|
|
|
127
|
-
|
|
128
|
-
worker_1.run { sleep 5 }
|
|
204
|
+
#### Data Conversion
|
|
129
205
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
206
|
+
Data converters are used to convert raw Temporal payloads to/from actual Ruby types. A custom data converter can be set
|
|
207
|
+
via the `data_converter` keyword argument when creating a client. Data converters are a combination of payload
|
|
208
|
+
converters, payload codecs, and failure converters. Payload converters convert Ruby values to/from serialized bytes.
|
|
209
|
+
Payload codecs convert bytes to bytes (e.g. for compression or encryption). Failure converters convert exceptions
|
|
210
|
+
to/from serialized failures.
|
|
134
211
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
212
|
+
Data converters are in the `Temporalio::Converters` module. The default data converter uses a default payload converter,
|
|
213
|
+
which supports the following types:
|
|
214
|
+
|
|
215
|
+
* `nil`
|
|
216
|
+
* "bytes" (i.e. `String` with `Encoding::ASCII_8BIT` encoding)
|
|
217
|
+
* `Google::Protobuf::MessageExts` instances
|
|
218
|
+
* [`JSON` module](https://docs.ruby-lang.org/en/master/JSON.html) for everything else
|
|
140
219
|
|
|
141
|
-
|
|
142
|
-
|
|
220
|
+
This means that normal Ruby objects will use `JSON.generate` when serializing and `JSON.parse` when deserializing (with
|
|
221
|
+
`create_additions: true` set by default). So a Ruby object will often appear as a hash when deserialized. While
|
|
222
|
+
"JSON Additions" are supported, it is not cross-SDK-language compatible since this is a Ruby-specific construct.
|
|
143
223
|
|
|
144
|
-
|
|
224
|
+
The default payload converter is a collection of "encoding payload converters". On serialize, each encoding converter
|
|
225
|
+
will be tried in order until one accepts (default falls through to the JSON one). The encoding converter sets an
|
|
226
|
+
`encoding` metadata value which is used to know which converter to use on deserialize. Custom encoding converters can be
|
|
227
|
+
created, or even the entire payload converter can be replaced with a different implementation.
|
|
145
228
|
|
|
146
|
-
|
|
229
|
+
##### ActiveRecord and ActiveModel
|
|
230
|
+
|
|
231
|
+
By default, `ActiveRecord` and `ActiveModel` objects do not natively support the `JSON` module. A mixin can be created
|
|
232
|
+
to add this support for `ActiveRecord`, for example:
|
|
147
233
|
|
|
148
234
|
```ruby
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
235
|
+
module ActiveRecordJSONSupport
|
|
236
|
+
extend ActiveSupport::Concern
|
|
237
|
+
include ActiveModel::Serializers::JSON
|
|
238
|
+
|
|
239
|
+
included do
|
|
240
|
+
def to_json(*args)
|
|
241
|
+
hash = as_json
|
|
242
|
+
hash[::JSON.create_id] = self.class.name
|
|
243
|
+
hash.to_json(*args)
|
|
244
|
+
end
|
|
153
245
|
|
|
154
|
-
|
|
246
|
+
def self.json_create(object)
|
|
247
|
+
object.delete(::JSON.create_id)
|
|
248
|
+
ret = new
|
|
249
|
+
ret.attributes = object
|
|
250
|
+
ret
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
end
|
|
155
254
|
```
|
|
156
255
|
|
|
157
|
-
|
|
158
|
-
behaves the same way — the workers will be shut down when the block finishes.
|
|
256
|
+
Similarly, a mixin for `ActiveModel` that adds `attributes` accessors can leverage this same mixin, for example:
|
|
159
257
|
|
|
160
|
-
|
|
258
|
+
```ruby
|
|
259
|
+
module ActiveModelJSONSupport
|
|
260
|
+
extend ActiveSupport::Concern
|
|
261
|
+
include ActiveRecordJSONSupport
|
|
262
|
+
|
|
263
|
+
included do
|
|
264
|
+
def attributes=(hash)
|
|
265
|
+
hash.each do |key, value|
|
|
266
|
+
send("#{key}=", value)
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
def attributes
|
|
271
|
+
instance_values
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Now `include ActiveRecordJSONSupport` or `include ActiveModelJSONSupport` will make the models work with Ruby `JSON`
|
|
278
|
+
module and therefore Temporal. Of course any other approach to make the models work with the `JSON` module will work as
|
|
279
|
+
well.
|
|
280
|
+
|
|
281
|
+
### Workers
|
|
282
|
+
|
|
283
|
+
Workers host workflows and/or activities. Workflows cannot yet be written in Ruby, but activities can. Here's how to run
|
|
284
|
+
an activity worker:
|
|
161
285
|
|
|
162
286
|
```ruby
|
|
163
|
-
|
|
287
|
+
require 'temporalio/client'
|
|
288
|
+
require 'temporalio/worker'
|
|
289
|
+
require 'my_module'
|
|
290
|
+
|
|
291
|
+
# Create a client
|
|
292
|
+
client = Temporalio::Client.connect('localhost:7233', 'my-namespace')
|
|
293
|
+
|
|
294
|
+
# Create a worker with the client and activities
|
|
295
|
+
worker = Temporalio::Worker.new(
|
|
296
|
+
client:,
|
|
297
|
+
task_queue: 'my-task-queue',
|
|
298
|
+
# There are various forms an activity can take, see specific section for details.
|
|
299
|
+
activities: [MyModule::MyActivity]
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
# Run the worker until block complete
|
|
303
|
+
worker.run do
|
|
304
|
+
something_that_waits_for_completion
|
|
305
|
+
end
|
|
164
306
|
```
|
|
165
307
|
|
|
166
|
-
|
|
308
|
+
Notes about the above code:
|
|
309
|
+
|
|
310
|
+
* A worker uses the same client that is used for other Temporal things.
|
|
311
|
+
* This just shows providing an activity class, but there are other forms, see the "Activities" section for details.
|
|
312
|
+
* The worker `run` method accepts an optional `Temporalio::Cancellation` object that can be used to cancel instead or in
|
|
313
|
+
addition to providing a block that waits for completion.
|
|
314
|
+
* The worker `run` method accepts an `shutdown_signals` array which will trap the signal and start shutdown when
|
|
315
|
+
received.
|
|
316
|
+
* Workers work with threads or fibers (but fiber compatibility only supported for Ruby 3.3+ at this time). Fiber-based
|
|
317
|
+
activities (see "Activities" section) only work if the worker is created within a fiber.
|
|
318
|
+
* The `run` method does not return until the worker is shut down. This means even if shutdown is triggered (e.g. via
|
|
319
|
+
`Cancellation` or block completion), it may not return immediately. Activities not completing may hang worker
|
|
320
|
+
shutdown, see the "Activities" section.
|
|
321
|
+
* Workers can have many more options not shown here (e.g. data converters and interceptors).
|
|
322
|
+
* The `Temporalio::Worker.run_all` class method is available for running multiple workers concurrently.
|
|
167
323
|
|
|
168
|
-
|
|
169
|
-
activities to complete, so if a long-running activity does not at least respect cancellation, the
|
|
170
|
-
shutdown may never complete.
|
|
324
|
+
### Workflows
|
|
171
325
|
|
|
172
|
-
|
|
173
|
-
issued for every running activity after the set timeout. The bahaviour is mostly identical to a
|
|
174
|
-
server requested cancellation and should be handled accordingly. More on this in [Heartbeating and
|
|
175
|
-
Cancellation](#heartbeating-and-cancellation).
|
|
326
|
+
⚠️ Workflows cannot yet be implemented Ruby.
|
|
176
327
|
|
|
177
328
|
### Activities
|
|
178
329
|
|
|
179
|
-
#### Definition
|
|
330
|
+
#### Activity Definition
|
|
180
331
|
|
|
181
|
-
Activities
|
|
332
|
+
Activities can be defined in a few different ways. They are usually classes, but manual definitions are supported too.
|
|
333
|
+
|
|
334
|
+
Here is a common activity definition:
|
|
182
335
|
|
|
183
336
|
```ruby
|
|
184
|
-
class
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
337
|
+
class FindUserActivity < Temporalio::Activity
|
|
338
|
+
def execute(user_id)
|
|
339
|
+
User.find(user_id)
|
|
340
|
+
end
|
|
341
|
+
end
|
|
342
|
+
```
|
|
188
343
|
|
|
189
|
-
|
|
190
|
-
|
|
344
|
+
Activities are defined as classes that extend `Temporalio::Activity` and provide an `execute` method. When this activity
|
|
345
|
+
is provided to the worker as a _class_ (e.g. `activities: [FindUserActivity]`), it will be instantiated for
|
|
346
|
+
_every attempt_. Many users may prefer using the same instance across activities, for example:
|
|
347
|
+
|
|
348
|
+
```ruby
|
|
349
|
+
class FindUserActivity < Temporalio::Activity
|
|
350
|
+
def initialize(db)
|
|
351
|
+
@db = db
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
def execute(user_id)
|
|
355
|
+
@db[:users].first(id: user_id)
|
|
191
356
|
end
|
|
192
357
|
end
|
|
193
358
|
```
|
|
194
359
|
|
|
195
|
-
|
|
360
|
+
When this is provided to a worker as an instance of the activity (e.g. `activities: [FindUserActivity.new(my_db)]`) then
|
|
361
|
+
the same instance is reused for each activity.
|
|
362
|
+
|
|
363
|
+
Some notes about activity definition:
|
|
196
364
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
365
|
+
* Temporal activities are identified by their name (or sometimes referred to as "activity type"). This defaults to the
|
|
366
|
+
unqualified class name of the activity, but can be customized by calling the `activity_name` class method.
|
|
367
|
+
* Long running activities should heartbeat regularly, see "Activity Heartbeating and Cancellation" later.
|
|
368
|
+
* By default every activity attempt is executed in a thread on a thread pool, but fibers are also supported. See
|
|
369
|
+
"Activity Concurrency and Executors" section later for more details.
|
|
370
|
+
* Technically an activity definition can be created manually via `Temporalio::Activity::Definition.new` that accepts a
|
|
371
|
+
proc or a block, but the class form is recommended.
|
|
200
372
|
|
|
201
373
|
#### Activity Context
|
|
202
374
|
|
|
203
|
-
|
|
204
|
-
|
|
375
|
+
When running in an activity, the `Temporalio::Activity::Context` is available via
|
|
376
|
+
`Temporalio::Activity::Context.current` which is backed by a thread/fiber local. In addition to other more advanced
|
|
377
|
+
things, this context provides:
|
|
205
378
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
379
|
+
* `info` - Information about the running activity.
|
|
380
|
+
* `heartbeat` - Method to call to issue an activity heartbeat (see "Activity Heartbeating and Cancellation" later).
|
|
381
|
+
* `cancellation` - Instance of `Temporalio::Cancellation` canceled when an activity is canceled (see
|
|
382
|
+
"Activity Heartbeating and Cancellation" later).
|
|
383
|
+
* `worker_shutdown_cancellation` - Instance of `Temporalio::Cancellation` canceled when worker is shutting down (see
|
|
384
|
+
"Activity Worker Shutdown" later).
|
|
385
|
+
* `logger` - Logger that automatically appends a hash with some activity info to every message.
|
|
210
386
|
|
|
211
|
-
|
|
387
|
+
#### Activity Heartbeating and Cancellation
|
|
212
388
|
|
|
213
|
-
In order for a non-local activity to be notified of cancellation requests, it must
|
|
214
|
-
`
|
|
215
|
-
this
|
|
389
|
+
In order for a non-local activity to be notified of server-side cancellation requests, it must regularly invoke
|
|
390
|
+
`heartbeat` on the `Temporalio::Activity::Context` instance (available via `Temporalio::Activity::Context.current`). It
|
|
391
|
+
is strongly recommended that all but the fastest executing activities call this function regularly.
|
|
216
392
|
|
|
217
|
-
In addition to obtaining cancellation information, heartbeats also support detail data that is
|
|
218
|
-
|
|
219
|
-
`
|
|
220
|
-
return an array containing `123` and `456` on the next run.
|
|
393
|
+
In addition to obtaining cancellation information, heartbeats also support detail data that is persisted on the server
|
|
394
|
+
for retrieval during activity retry. If an activity calls `heartbeat(123)` and then fails and is retried,
|
|
395
|
+
`Temporalio::Activity::Context.current.info.heartbeat_details.first` will be `123`.
|
|
221
396
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
397
|
+
An activity can be canceled for multiple reasons, some server-side and some worker side. Server side cancellation
|
|
398
|
+
reasons include workflow canceling the activity, workflow completing, or activity timing out. On the worker side, the
|
|
399
|
+
activity can be canceled on worker shutdown (see next section). By default cancellation is relayed two ways - by marking
|
|
400
|
+
the `cancellation` on `Temporalio::Activity::Context` as canceled, and by issuing a `Thread.raise` or `Fiber.raise` with
|
|
401
|
+
the `Temporalio::Error::CanceledError`.
|
|
226
402
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
run_business_critical_logic_1
|
|
232
|
-
end
|
|
403
|
+
The `raise`-by-default approach was chosen because it is dangerous to the health of the system and the continued use of
|
|
404
|
+
worker slots to require activities opt-in to checking for cancellation by default. But if this behavior is not wanted,
|
|
405
|
+
`activity_cancel_raise false` class method can be called at the top of the activity which will disable the `raise`
|
|
406
|
+
behavior and just set the `cancellation` as canceled.
|
|
233
407
|
|
|
234
|
-
|
|
408
|
+
If needing to shield work from being canceled, the `shield` call on the `Temporalio::Cancellation` object can be used
|
|
409
|
+
with a block for the code to be shielded. The cancellation will not take effect on the cancellation object nor the raise
|
|
410
|
+
call while the work is shielded (regardless of nested depth). Once the shielding is complete, the cancellation will take
|
|
411
|
+
effect, including `Thread.raise`/`Fiber.raise` if that remains enabled.
|
|
235
412
|
|
|
236
|
-
|
|
237
|
-
run_business_critical_logic_2
|
|
238
|
-
end
|
|
239
|
-
end
|
|
240
|
-
end
|
|
241
|
-
```
|
|
413
|
+
#### Activity Worker Shutdown
|
|
242
414
|
|
|
243
|
-
|
|
244
|
-
|
|
415
|
+
An activity can react to a worker shutdown specifically and also a normal cancellation will be sent. A worker will not
|
|
416
|
+
complete its shutdown while an activity is in progress.
|
|
245
417
|
|
|
246
|
-
|
|
247
|
-
|
|
418
|
+
Upon worker shutdown, the `worker_shutdown_cancellation` cancellation on `Temporalio::Activity::Context` will be
|
|
419
|
+
canceled. Then the worker will wait a for a grace period set by the `graceful_shutdown_period` worker option (default 0)
|
|
420
|
+
before issuing actual cancellation to all still-running activities.
|
|
248
421
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
shielded!
|
|
422
|
+
Worker shutdown will then wait on all activities to complete. If a long-running activity does not respect cancellation,
|
|
423
|
+
the shutdown may never complete.
|
|
252
424
|
|
|
253
|
-
|
|
254
|
-
...
|
|
255
|
-
end
|
|
256
|
-
end
|
|
257
|
-
```
|
|
425
|
+
#### Activity Concurrency and Executors
|
|
258
426
|
|
|
259
|
-
|
|
260
|
-
|
|
427
|
+
By default, activities run in the "thread pool executor" (i.e. `Temporalio::Worker::ActivityExecutor::ThreadPool`). This
|
|
428
|
+
default is shared across all workers and is a naive thread pool that continually makes threads as needed when none are
|
|
429
|
+
idle/available to handle incoming work. If a thread sits idle long enough, it will be killed.
|
|
261
430
|
|
|
262
|
-
|
|
263
|
-
|
|
431
|
+
The maximum number of concurrent activities a worker will run at a time is configured via its `tuner` option. The
|
|
432
|
+
default is `Temporalio::Worker::Tuner.create_fixed` which defaults to 100 activities at a time for that worker. When
|
|
433
|
+
this value is reached, the worker will stop asking for work from the server until there are slots available again.
|
|
264
434
|
|
|
265
|
-
|
|
435
|
+
In addition to the thread pool executor, there is also a fiber executor in the default executor set. To use fibers, call
|
|
436
|
+
`activity_executor :fiber` class method at the top of the activity class (the default of this value is `:default` which
|
|
437
|
+
is the thread pool executor). Activities can only choose the fiber executor if the worker has been created and run in a
|
|
438
|
+
fiber, but thread pool executor is always available. Currently due to
|
|
439
|
+
[an issue](https://github.com/temporalio/sdk-ruby/issues/162), workers can only run in a fiber on Ruby versions 3.3 and
|
|
440
|
+
newer.
|
|
266
441
|
|
|
267
|
-
|
|
268
|
-
|
|
442
|
+
Technically the executor can be customized. The `activity_executors` worker option accepts a hash with the key as the
|
|
443
|
+
symbol and the value as a `Temporalio::Worker::ActivityExecutor` implementation. Users should usually not need to
|
|
444
|
+
customize this. If general code is needed to run around activities, users should use interceptors instead.
|
|
269
445
|
|
|
270
|
-
|
|
271
|
-
> git submodule update --recursive
|
|
272
|
-
```
|
|
446
|
+
#### Activity Testing
|
|
273
447
|
|
|
274
|
-
|
|
448
|
+
Unit testing an activity can be done via the `Temporalio::Testing::ActivityEnvironment` class. Simply instantiate the
|
|
449
|
+
class, then invoke `run` with the activity to test and the arguments to give. The result will be the activity result or
|
|
450
|
+
it will raise the error raised in the activity.
|
|
275
451
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
```
|
|
452
|
+
The constructor of the environment has multiple keyword arguments that can be set to affect the activity context for the
|
|
453
|
+
activity.
|
|
279
454
|
|
|
280
|
-
|
|
281
|
-
will also need to install the `rustfmt` component:
|
|
455
|
+
### Platform Support
|
|
282
456
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
```
|
|
457
|
+
This SDK is backed by a Ruby C extension written in Rust leveraging the
|
|
458
|
+
[Temporal Rust Core](https://github.com/temporalio/sdk-core). Gems are currently published for the following platforms:
|
|
286
459
|
|
|
287
|
-
|
|
460
|
+
* `aarch64-linux`
|
|
461
|
+
* `x86_64-linux`
|
|
462
|
+
* `arm64-darwin`
|
|
463
|
+
* `x86_64-darwin`
|
|
288
464
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
```
|
|
465
|
+
This means Linux and macOS for ARM and x64 have published gems. Currently, a gem is not published for
|
|
466
|
+
`aarch64-linux-musl` so Alpine Linux users may need to build from scratch or use a libc-based distro.
|
|
292
467
|
|
|
293
|
-
|
|
468
|
+
Due to [an issue](https://github.com/temporalio/sdk-ruby/issues/172) with Windows and multi-threaded Rust, MinGW-based
|
|
469
|
+
Windows (i.e. `x64-mingw-ucrt`) is not supported. But WSL is supported using the normal Linux gem.
|
|
294
470
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
471
|
+
At this time a pure source gem is published for documentation reasons, but it cannot be built and will fail if tried.
|
|
472
|
+
Building from source requires many files across submodules and requires Rust to be installed. See the [Build](#build)
|
|
473
|
+
section for how to build a the repository.
|
|
298
474
|
|
|
299
|
-
|
|
475
|
+
The SDK works on Ruby 3.1+, but due to [an issue](https://github.com/temporalio/sdk-ruby/issues/162), fibers (and
|
|
476
|
+
`async` gem) are only supported on Ruby versions 3.3 and newer.
|
|
300
477
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
478
|
+
## Development
|
|
479
|
+
|
|
480
|
+
### Build
|
|
481
|
+
|
|
482
|
+
Prerequisites:
|
|
483
|
+
|
|
484
|
+
* [Ruby](https://www.ruby-lang.org/) >= 3.1 (i.e. `ruby` and `bundle` on the `PATH`)
|
|
485
|
+
* [Rust](https://www.rust-lang.org/) latest stable (i.e. `cargo` on the `PATH`)
|
|
486
|
+
* This repository, cloned recursively
|
|
487
|
+
* Change to the `temporalio/` directory
|
|
488
|
+
|
|
489
|
+
First, install dependencies:
|
|
490
|
+
|
|
491
|
+
bundle install
|
|
492
|
+
|
|
493
|
+
To build shared library for development use:
|
|
494
|
+
|
|
495
|
+
bundle exec rake compile
|
|
496
|
+
|
|
497
|
+
**NOTE**: This will make the current directory usable for the current Ruby version by putting the shared library
|
|
498
|
+
`lib/temporalio/internal/bridge/temporalio_bridge.<ext>` in the proper place. But this development shared library may
|
|
499
|
+
not work for other Ruby versions or other OS/arch combinations. For that, see "Build Platform-specific Gem" below.
|
|
500
|
+
|
|
501
|
+
**NOTE**: This is not `compile:dev` because debug-mode in Rust has
|
|
502
|
+
[an issue](https://github.com/rust-lang/rust/issues/34283) that causes runtime stack size problems.
|
|
503
|
+
|
|
504
|
+
To lint, build, and test:
|
|
505
|
+
|
|
506
|
+
bundle exec rake
|
|
507
|
+
|
|
508
|
+
#### Build Platform-specific Gem
|
|
509
|
+
|
|
510
|
+
The standard `bundle exec rake build` will produce a gem in the `pkg` directory, but that gem will not be usable because
|
|
511
|
+
the shared library is not present (neither the Rust code nor the compiled form). To create a platform-specific gem that
|
|
512
|
+
can be used, `rb-sys-dock` must be run. See the
|
|
513
|
+
[Cross-Compilation documentation](https://oxidize-rb.github.io/rb-sys/tutorial/publishing/cross-compilation.html) in the
|
|
514
|
+
`rb-sys` repository. For example, running:
|
|
515
|
+
|
|
516
|
+
bundle exec rb-sys-dock --platform x86_64-linux --ruby-versions 3.2,3.3 --build
|
|
517
|
+
|
|
518
|
+
Will create a `pkg/temporalio-<version>-x86_64-linux.gem` file that can be used in x64 Linux environments on both Ruby
|
|
519
|
+
3.2 and Ruby 3.3 because it contains the shared libraries. For this specific example, the shared libraries are inside
|
|
520
|
+
the gem at `lib/temporalio/internal/bridge/3.2/temporalio_bridge.so` and
|
|
521
|
+
`lib/temporalio/internal/bridge/3.3/temporalio_bridge.so`.
|
|
522
|
+
|
|
523
|
+
### Testing
|
|
524
|
+
|
|
525
|
+
This project uses `minitest`. To test:
|
|
526
|
+
|
|
527
|
+
bundle exec rake test
|
|
528
|
+
|
|
529
|
+
Can add options via `TESTOPTS`. E.g. single test:
|
|
530
|
+
|
|
531
|
+
bundle exec rake test TESTOPTS="--name=test_some_method"
|
|
532
|
+
|
|
533
|
+
E.g. all starting with prefix:
|
|
534
|
+
|
|
535
|
+
bundle exec rake test TESTOPTS="--name=/^test_some_method_prefix/"
|
|
536
|
+
|
|
537
|
+
E.g. all for a class:
|
|
538
|
+
|
|
539
|
+
bundle exec rake test TESTOPTS="--name=/SomeClassName/"
|
|
540
|
+
|
|
541
|
+
E.g. show all test names while executing:
|
|
542
|
+
|
|
543
|
+
bundle exec rake test TESTOPTS="--verbose"
|
|
544
|
+
|
|
545
|
+
### Code Formatting and Type Checking
|
|
546
|
+
|
|
547
|
+
This project uses `rubocop`:
|
|
548
|
+
|
|
549
|
+
bundle exec rake rubocop:autocorrect
|
|
550
|
+
|
|
551
|
+
This project uses `steep`. First may need the RBS collection:
|
|
552
|
+
|
|
553
|
+
bundle exec rake rbs:install_collection
|
|
554
|
+
|
|
555
|
+
Now can run `steep`:
|
|
556
|
+
|
|
557
|
+
bundle exec rake steep
|
|
558
|
+
|
|
559
|
+
### Proto Generation
|
|
560
|
+
|
|
561
|
+
Run:
|
|
562
|
+
|
|
563
|
+
bundle exec rake proto:generate
|