Class: GeoConcerns::RabbitMessagingClient
- Inherits:
-
Object
- Object
- GeoConcerns::RabbitMessagingClient
- Defined in:
- app/services/geo_concerns/rabbit_messaging_client.rb
Instance Attribute Summary collapse
-
#amqp_url ⇒ Object
readonly
Returns the value of attribute amqp_url.
Instance Method Summary collapse
- #geoblacklight ⇒ Object
- #geoserver ⇒ Object
-
#initialize(amqp_url) ⇒ RabbitMessagingClient
constructor
A new instance of RabbitMessagingClient.
- #publish(message) ⇒ Object
Constructor Details
#initialize(amqp_url) ⇒ RabbitMessagingClient
Returns a new instance of RabbitMessagingClient.
6 7 8 |
# File 'app/services/geo_concerns/rabbit_messaging_client.rb', line 6 def initialize(amqp_url) @amqp_url = amqp_url end |
Instance Attribute Details
#amqp_url ⇒ Object (readonly)
Returns the value of attribute amqp_url.
5 6 7 |
# File 'app/services/geo_concerns/rabbit_messaging_client.rb', line 5 def amqp_url @amqp_url end |
Instance Method Details
#geoblacklight ⇒ Object
18 19 20 21 |
# File 'app/services/geo_concerns/rabbit_messaging_client.rb', line 18 def geoblacklight exchange_name = GeoConcerns::Messaging.config['events']['exchange']['geoblacklight'] @exchange ||= channel.fanout(exchange_name, durable: true) end |
#geoserver ⇒ Object
23 24 25 26 |
# File 'app/services/geo_concerns/rabbit_messaging_client.rb', line 23 def geoserver exchange_name = GeoConcerns::Messaging.config['events']['exchange']['geoserver'] @exchange ||= channel.fanout(exchange_name, durable: true) end |
#publish(message) ⇒ Object
10 11 12 13 14 15 16 |
# File 'app/services/geo_concerns/rabbit_messaging_client.rb', line 10 def publish() exchange_type = JSON.parse()['exchange'] send(exchange_type) @exchange.publish(, persistent: true) rescue Rails.logger.warn "Unable to publish message to #{amqp_url}" end |