Sha256: ea00643039bdabda97a167622c9de6fc0bbdbb8e81e6f811a6a42d61431aab80
Contents?: true
Size: 903 Bytes
Versions: 2
Compression:
Stored size: 903 Bytes
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'totoro' # You might want to change this ENV['RAILS_ENV'] ||= 'development' root = Dir.pwd root = File.dirname(root) until File.exist?(File.join(root, 'config')) Dir.chdir(root) require File.join(root, 'config', 'environment') Rails.logger = logger = Logger.new STDOUT logger.level = Logger.const_get(Rails.configuration.log_level.to_s.upcase) worker_name = ARGV[0] queue_class = Totoro::Queue logger.info 'Start to subscribe to Rabbitmq' worker = queue_class.get_worker worker_name worker_queue = worker.class::QUEUE queue_class.subscribe(worker_queue) do |delivery_info, metadata, payload| logger.info "#{worker_queue} Received: #{payload}" payload_hash = JSON.parse(payload).with_indifferent_access worker.process payload_hash, metadata, delivery_info end logger.info 'Listening to the Rabbitmq' queue_class.channel.work_pool.join
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
totoro-0.1.5 | bin/totoro |
totoro-0.1.4 | bin/totoro |