Class: Application
- Inherits:
-
Object
- Object
- Application
- Includes:
- RKS::Support::Configurable
- Defined in:
- lib/rks/application.rb
Class Method Summary collapse
Methods included from RKS::Support::Concern
Class Method Details
.avro_registry ⇒ Object
13 14 15 16 17 18 |
# File 'lib/rks/application.rb', line 13 def avro_registry @avro ||= AvroTurf::Messaging.new( schemas_path: "./app/schemas", registry_url: Application.config.avro_registry_url ) end |
.logger ⇒ Object
9 10 11 |
# File 'lib/rks/application.rb', line 9 def logger @logger ||= RKS::Logger.init end |
.run ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rks/application.rb', line 20 def run Application.logger.info message: "Application started" RKS::Event::Handler.router.routes.keys.each do |event_name| topic = [config.env,event_name].join("-") Kafka.consumer.subscribe(topic) end # This will loop indefinitely, yielding each message in turn. Kafka.consumer. do || RKS::Event::Processor.process(correlation_id: .key, event: sanitized_event_name(.topic), payload: .value) end end |
.sanitized_event_name(topic) ⇒ Object
33 34 35 |
# File 'lib/rks/application.rb', line 33 def sanitized_event_name(topic) topic.gsub("#{config.env}-", "") end |