Module: SharedBroker

Defined in:
lib/shared_broker.rb,
lib/shared_broker/cipher.rb,
lib/shared_broker/version.rb,
lib/shared_broker/telemetry.rb,
lib/shared_broker/compressor.rb,
lib/shared_broker/validation.rb,
lib/shared_broker/dlq/redriver.rb,
lib/shared_broker/key_provider.rb,
lib/shared_broker/adapters/base.rb,
lib/shared_broker/adapters/kafka.rb,
lib/shared_broker/adapters/redis.rb,
lib/shared_broker/circuit_breaker.rb,
lib/shared_broker/schema_registry.rb,
lib/shared_broker/adapters/in_memory.rb,
lib/shared_broker/adapters/rabbit_mq.rb,
lib/shared_broker/concurrency/limiter.rb,
lib/shared_broker/middleware_pipeline.rb,
lib/shared_broker/concurrency/semaphore.rb,
lib/shared_broker/middlewares/idempotency.rb,
lib/shared_broker/schema_registry/providers/http.rb,
lib/shared_broker/schema_registry/providers/local.rb,
lib/shared_broker/middlewares/open_telemetry_propagation.rb

Defined Under Namespace

Modules: Adapters, Cipher, Compressor, Concurrency, DLQ, KeyProvider, Middlewares, SchemaRegistry, Telemetry, Validation Classes: CircuitBreaker, Client, MiddlewarePipeline

Constant Summary collapse

ShutdownError =
Class.new(StandardError)
VERSION =
"1.8.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.cache_storeObject

Returns the value of attribute cache_store.



29
30
31
# File 'lib/shared_broker.rb', line 29

def cache_store
  @cache_store
end

.compression_algorithmObject

Returns the value of attribute compression_algorithm.



29
30
31
# File 'lib/shared_broker.rb', line 29

def compression_algorithm
  @compression_algorithm
end

.compression_thresholdObject

Returns the value of attribute compression_threshold.



29
30
31
# File 'lib/shared_broker.rb', line 29

def compression_threshold
  @compression_threshold
end

.encryption_keyObject

Returns the value of attribute encryption_key.



29
30
31
# File 'lib/shared_broker.rb', line 29

def encryption_key
  @encryption_key
end

.key_providerObject

Returns the value of attribute key_provider.



29
30
31
# File 'lib/shared_broker.rb', line 29

def key_provider
  @key_provider
end

.registered_clientsObject

Returns the value of attribute registered_clients.



29
30
31
# File 'lib/shared_broker.rb', line 29

def registered_clients
  @registered_clients
end

.shutdown_requestedObject

Returns the value of attribute shutdown_requested.



29
30
31
# File 'lib/shared_broker.rb', line 29

def shutdown_requested
  @shutdown_requested
end

Class Method Details

.register_client(client) ⇒ Object



42
43
44
45
46
# File 'lib/shared_broker.rb', line 42

def self.register_client(client)
  @registered_clients_mutex.synchronize do
    @registered_clients << client
  end
end

.reset_shutdown!Object



58
59
60
# File 'lib/shared_broker.rb', line 58

def self.reset_shutdown!
  @shutdown_requested = false
end

.shutdown!(timeout: 10) ⇒ Object



48
49
50
51
52
53
54
55
56
# File 'lib/shared_broker.rb', line 48

def self.shutdown!(timeout: 10)
  @shutdown_requested = true
  
  threads = @registered_clients_mutex.synchronize do
    @registered_clients.flat_map(&:active_threads)
  end

  threads.each { |t| t.join(timeout) }
end