Class: Restate::Workflow
- Inherits:
-
Object
- Object
- Restate::Workflow
- Extended by:
- ServiceDSL
- Defined in:
- lib/restate/workflow.rb
Overview
A durable workflow with a main entry point and shared handlers.
Class Method Summary collapse
- ._service_kind ⇒ Object
-
.call(key) ⇒ ServiceCallProxy
Returns a call proxy for fluent durable calls to this workflow.
-
.handler(method_name = nil, **opts) ⇒ Symbol
Register a shared handler on this workflow.
-
.main(method_name = nil, **opts) ⇒ Symbol
Register the main workflow entry point.
-
.send!(key, delay: nil) ⇒ ServiceSendProxy
Returns a send proxy for fluent fire-and-forget sends to this workflow.
Methods included from ServiceDSL
abort_timeout, description, enable_lazy_state, handlers, idempotency_retention, inactivity_timeout, ingress_private, inherited, invocation_retry_policy, journal_retention, lazy_state?, metadata, service_name, service_tag, state, svc_abort_timeout, svc_idempotency_retention, svc_inactivity_timeout, svc_ingress_private, svc_invocation_retry_policy, svc_journal_retention
Class Method Details
._service_kind ⇒ Object
75 76 77 |
# File 'lib/restate/workflow.rb', line 75 def self._service_kind 'workflow' end |
.call(key) ⇒ ServiceCallProxy
Returns a call proxy for fluent durable calls to this workflow.
58 59 60 |
# File 'lib/restate/workflow.rb', line 58 def self.call(key) ServiceCallProxy.new(self, key: key, call_method: :workflow_call) end |
.handler(method_name = nil, **opts) ⇒ Symbol
Register a shared handler on this workflow.
41 42 43 44 45 46 47 48 49 |
# File 'lib/restate/workflow.rb', line 41 def self.handler(method_name = nil, **opts) if method_name.is_a?(String) raise ArgumentError, "handler expects a Symbol (use `handler def #{method_name}(...)` or `handler :#{method_name}`)" end return method_name unless method_name.is_a?(Symbol) _register_handler(method_name, kind: 'shared', **opts) end |
.main(method_name = nil, **opts) ⇒ Symbol
Register the main workflow entry point. Use as: main def run(ctx, arg) or main :run, input: String
26 27 28 29 30 31 32 33 34 |
# File 'lib/restate/workflow.rb', line 26 def self.main(method_name = nil, **opts) if method_name.is_a?(String) raise ArgumentError, "handler expects a Symbol (use `main def #{method_name}(...)` or `main :#{method_name}`)" end return method_name unless method_name.is_a?(Symbol) _register_handler(method_name, kind: 'workflow', **opts) end |
.send!(key, delay: nil) ⇒ ServiceSendProxy
Returns a send proxy for fluent fire-and-forget sends to this workflow.
71 72 73 |
# File 'lib/restate/workflow.rb', line 71 def self.send!(key, delay: nil) ServiceSendProxy.new(self, key: key, send_method: :workflow_send, delay: delay) end |