Module: Hatchet::Clients
- Defined in:
- lib/hatchet/clients.rb,
lib/hatchet/clients/grpc/admin.rb,
lib/hatchet/clients/grpc/dispatcher.rb,
lib/hatchet/clients/grpc/event_client.rb
Overview
Client implementations for different protocols
Defined Under Namespace
Modules: Grpc
Class Method Summary collapse
-
.available_clients ⇒ Array<Symbol>
List available client types.
-
.rest_available? ⇒ Boolean
Check if REST client is available.
-
.rest_client(config) ⇒ Hatchet::Clients::Rest::ApiClient
Create a REST API client using the provided Hatchet configuration.
Class Method Details
.available_clients ⇒ Array<Symbol>
List available client types
61 62 63 64 65 |
# File 'lib/hatchet/clients.rb', line 61 def available_clients clients = [] clients << :rest if rest_available? clients end |
.rest_available? ⇒ Boolean
Check if REST client is available
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/hatchet/clients.rb', line 39 def rest_available? return false unless defined?(Hatchet::Clients::Rest) # Check if this is the real implementation or just the placeholder # The placeholder Configuration.from_hatchet_config raises LoadError begin # Try to access a method that should exist in the real implementation # If it's the placeholder, this will raise LoadError Hatchet::Clients::Rest::Configuration.method(:from_hatchet_config) # Try creating a dummy configuration to ensure the real client is loaded dummy_config = Struct.new(:token, :server_url, :listener_v2_timeout).new("test", "", nil) Hatchet::Clients::Rest::Configuration.from_hatchet_config(dummy_config) true rescue LoadError false end end |
.rest_client(config) ⇒ Hatchet::Clients::Rest::ApiClient
Create a REST API client using the provided Hatchet configuration
29 30 31 32 33 34 |
# File 'lib/hatchet/clients.rb', line 29 def rest_client(config) raise LoadError, "REST client not available. Run `rake api:generate` to generate it from the OpenAPI spec." unless rest_available? rest_config = Rest::Configuration.from_hatchet_config(config) Rest::ApiClient.new(rest_config) end |