Class: Hermes::Publisher::HutchAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/hermes/publisher/hutch_adapter.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration: Hermes::DependenciesContainer["hutch_config"]) ⇒ HutchAdapter

Returns a new instance of HutchAdapter.



9
10
11
# File 'lib/hermes/publisher/hutch_adapter.rb', line 9

def initialize(configuration: Hermes::DependenciesContainer["hutch_config"])
  self.class.connect(configuration: configuration)
end

Class Method Details

.connect(configuration: Hermes::DependenciesContainer["hutch_config"]) ⇒ Object



5
6
7
# File 'lib/hermes/publisher/hutch_adapter.rb', line 5

def self.connect(configuration: Hermes::DependenciesContainer["hutch_config"])
  Hutch.connect(enable_http_api_use: configuration.enable_http_api_use)
end

Instance Method Details

#publish(routing_key, payload, properties = {}, options = {}) ⇒ Object



13
14
15
16
17
18
# File 'lib/hermes/publisher/hutch_adapter.rb', line 13

def publish(routing_key, payload, properties = {}, options = {})
  instrumenter.instrument("Hermes.Publisher.HutchAdapter.publish") do
    Hermes::DependenciesContainer["hutch"].publish(routing_key, payload, properties, options)
  end
  logger.log_published(routing_key, payload, properties, clock.now)
end