Sha256: b85ccd63aa9223bbc71bebf4b84976256858381c4a034179a704f1c616a4eeae

Contents?: true

Size: 760 Bytes

Versions: 3

Compression:

Stored size: 760 Bytes

Contents

%w{host sender worker poller command_handler router context version}.each { |r| require "buster/#{r}" }

require 'ffi-rzmq'
require 'msgpack'

module Buster
  class << self
    attr_accessor :local_endpoint

    def routes
      @routes ||= {}
    end

    def start
      raise "Bus is already started" if @host
      @host = Buster::Host.new(routes, context, self.local_endpoint)
      @host.start
    end

    def stop
      raise "Bus is not running" unless @host
      @host.stop
      @host = nil
    end

    def fire(name, props = {})
      sender.fire(name, props)
    end

    private

    def sender
      @sender ||= Buster::Sender.new(context)
    end

    def context
      @context ||= Buster::Context.new(ZMQ::Context.create)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
buster-0.1.3 lib/buster.rb
buster-0.1.2 lib/buster.rb
buster-0.1.1 lib/buster.rb