Sha256: 2747ffb8ddc86a04b069fdcdac78de3d264a764c901c84f86e1a64c8f7f615ba
Contents?: true
Size: 1.16 KB
Versions: 37
Compression:
Stored size: 1.16 KB
Contents
require "ostruct" require "thread" require "protobuf/nats" module Protobuf module Nats class Runner include ::Protobuf::Logging def initialize(options) @options = case when options.is_a?(OpenStruct) then options.marshal_dump when options.respond_to?(:to_hash) then options.to_hash.symbolize_keys else fail "Cannot parse Nats Server - server options" end end def run @server = ::Protobuf::Nats::Server.new(@options) register_signals @server.run do yield if block_given? end end def running? @server.try :running? end def stop @server.try :stop end private def register_signals trap(:TRAP) do ::Thread.list.each do |thread| logger.info do <<-THREAD_TRACE #{thread.inspect}: #{thread.backtrace.try(:join, $INPUT_RECORD_SEPARATOR)}" THREAD_TRACE end end end end end end end
Version data entries
37 entries across 37 versions & 1 rubygems