class GorgService
Add configuration features to GorgService
Message
transferred through Bunny. Follow Gorg SOA specification v2.0 ans maintain support for v1.0
@author Alexandre Narbonne
Constants
- VERSION
Attributes
configuration[W]
Public Class Methods
configuration()
click to toggle source
# File lib/gorg_service/configuration.rb, line 6 def configuration @configuration ||= Configuration.new end
configure() { |configuration| ... }
click to toggle source
# File lib/gorg_service/configuration.rb, line 11 def configure @configuration = Configuration.new yield(configuration) end
connection()
click to toggle source
Connection shared across Consumers and Producers (thread safe)
# File lib/gorg_service.rb, line 14 def connection @bunny_session||=GorgService.configuration.rabbitmq_client_class.new( :hostname => GorgService.configuration.rabbitmq_host, :port => GorgService.configuration.rabbitmq_port, :user => GorgService.configuration.rabbitmq_user, :pass => GorgService.configuration.rabbitmq_password, :vhost => GorgService.configuration.rabbitmq_vhost ) @bunny_session.start unless @bunny_session.connected? @bunny_session end
environment()
click to toggle source
Environment buidler. Don't share across threads since channels are not thread safe
# File lib/gorg_service.rb, line 27 def environment RabbitmqEnvBuilder.new( conn: connection, event_exchange: GorgService.configuration.rabbitmq_event_exchange_name, app_id: GorgService.configuration.application_id, deferred_time: GorgService.configuration.rabbitmq_deferred_time.to_i, listened_routing_keys: Consumer::MessageRouter.listened_keys, prefetch: GorgService.configuration.prefetch_count, ) end
logger()
click to toggle source
# File lib/gorg_service.rb, line 38 def logger GorgService.configuration.logger end