Class: Temporalio::Client::Connection
- Inherits:
-
Object
- Object
- Temporalio::Client::Connection
- Defined in:
- lib/temporalio/client/connection.rb,
lib/temporalio/client/connection/service.rb,
lib/temporalio/client/connection/cloud_service.rb,
lib/temporalio/client/connection/operator_service.rb,
lib/temporalio/client/connection/workflow_service.rb
Overview
Connection to Temporal server that is not namespace specific. Most users will use connect instead of this directly.
Defined Under Namespace
Classes: CloudService, HTTPConnectProxyOptions, KeepAliveOptions, OperatorService, Options, RPCRetryOptions, Service, TLSOptions, WorkflowService
Instance Attribute Summary collapse
-
#cloud_service ⇒ CloudService
readonly
Raw gRPC cloud service.
-
#operator_service ⇒ OperatorService
readonly
Raw gRPC operator service.
-
#options ⇒ Options
readonly
Frozen options for this client which has the same attributes as #initialize.
-
#workflow_service ⇒ WorkflowService
readonly
Raw gRPC workflow service.
Instance Method Summary collapse
-
#connected? ⇒ Boolean
Whether this connection is connected.
-
#identity ⇒ String
Client identity.
-
#initialize(target_host:, api_key: nil, tls: false, rpc_metadata: {}, rpc_retry: RPCRetryOptions.new, identity: "#{Process.pid}@#{Socket.gethostname}", keep_alive: KeepAliveOptions.new, http_connect_proxy: nil, runtime: Runtime.default, lazy_connect: false) ⇒ Connection
constructor
Connect to Temporal server.
-
#target_host ⇒ String
Target host this connection is connected to.
Constructor Details
#initialize(target_host:, api_key: nil, tls: false, rpc_metadata: {}, rpc_retry: RPCRetryOptions.new, identity: "#{Process.pid}@#{Socket.gethostname}", keep_alive: KeepAliveOptions.new, http_connect_proxy: nil, runtime: Runtime.default, lazy_connect: false) ⇒ Connection
Connect to Temporal server. Most users will use Temporalio::Client.connect instead of this directly. Parameters here match Options returned from #options by intention so options can be dup’d, altered, splatted to create a new connection.
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/temporalio/client/connection.rb', line 159 def initialize( target_host:, api_key: nil, tls: false, rpc_metadata: {}, rpc_retry: RPCRetryOptions.new, identity: "#{Process.pid}@#{Socket.gethostname}", keep_alive: KeepAliveOptions.new, http_connect_proxy: nil, runtime: Runtime.default, lazy_connect: false ) @options = Options.new( target_host:, api_key:, tls:, rpc_metadata:, rpc_retry:, identity:, keep_alive:, http_connect_proxy:, runtime:, lazy_connect: ).freeze # Create core client now if not lazy _core_client unless lazy_connect # Create service instances @workflow_service = WorkflowService.new(self) @operator_service = OperatorService.new(self) @cloud_service = CloudService.new(self) end |
Instance Attribute Details
#cloud_service ⇒ CloudService (readonly)
Returns Raw gRPC cloud service.
133 134 135 |
# File 'lib/temporalio/client/connection.rb', line 133 def cloud_service @cloud_service end |
#operator_service ⇒ OperatorService (readonly)
Returns Raw gRPC operator service.
130 131 132 |
# File 'lib/temporalio/client/connection.rb', line 130 def operator_service @operator_service end |
#options ⇒ Options (readonly)
Returns Frozen options for this client which has the same attributes as #initialize.
124 125 126 |
# File 'lib/temporalio/client/connection.rb', line 124 def @options end |
#workflow_service ⇒ WorkflowService (readonly)
Returns Raw gRPC workflow service.
127 128 129 |
# File 'lib/temporalio/client/connection.rb', line 127 def workflow_service @workflow_service end |
Instance Method Details
#connected? ⇒ Boolean
Returns Whether this connection is connected. This is always ‘true` unless `lazy_connect` option was originally set, in which case this will be `false` until the first call is made.
203 204 205 |
# File 'lib/temporalio/client/connection.rb', line 203 def connected? !@core_client.nil? end |
#identity ⇒ String
Returns Client identity.
197 198 199 |
# File 'lib/temporalio/client/connection.rb', line 197 def identity @options.identity end |
#target_host ⇒ String
Returns Target host this connection is connected to.
192 193 194 |
# File 'lib/temporalio/client/connection.rb', line 192 def target_host @options.target_host end |