Sha256: bf634dd31f07c8def0f3c59b9bb3928407b32016a7aa90636c9200f342a889f3

Contents?: true

Size: 953 Bytes

Versions: 1

Compression:

Stored size: 953 Bytes

Contents

#!/usr/bin/env ruby
require 'sneakers'
require 'sneakers/runner'
require 'harmony/service'

abort("usage: harmony_service [handler class name] --require [handler class file]") unless ARGV.length == 3

handler_class = ARGV[0]
puts "Starting Harmony Service with handler: #{handler_class}"
load File.expand_path(ARGV[2])

# load env secrets
Harmony::Service::Utils::Secrets.load

abort "ENV['ampq_address'] must be defined." unless ENV['ampq_address']
opts = {
  amqp: ENV['ampq_address'],
  vhost: ENV['ampq_vhost'] || '/',
  exchange: 'sneakers',
  exchange_type: :direct,
  metrics: Sneakers::Metrics::LoggingMetrics.new,
  handler: Sneakers::Handlers::Maxretry,
  handler_class: handler_class
}

Sneakers.server = true
Sneakers.configure(opts)
Sneakers.logger.level = ENV['log_level'] == 'debug' ? Logger::DEBUG : Logger::INFO

r = Sneakers::Runner.new([Harmony::Service::RpcService])
pid = Sneakers::CONFIG[:pid_path]
puts "Started pid: #{pid}"
r.run

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
harmony-service-0.5.0 bin/harmony_service