Sha256: 1c91d52c9461ba32769dbd79c1895ad52ba5c0712a2336b15fab1d110c33c115

Contents?: true

Size: 680 Bytes

Versions: 6

Compression:

Stored size: 680 Bytes

Contents

module Asynchronic
  class Environment

    attr_reader :queue_engine
    attr_reader :data_store
    
    def initialize(queue_engine, data_store)
      @queue_engine = queue_engine
      @data_store = data_store.scoped :asynchronic
    end

    def queue(name)
      queue_engine[name]
    end

    def default_queue
      queue(queue_engine.default_queue)
    end

    def enqueue(msg, queue=nil)
      queue(queue || queue_engine.default_queue).push msg
    end

    def create_process(type, params={})
      Process.create self, type, params
    end

    def load_process(id)
      Process.new self, id
    end
    
    def processes
      Process.all self
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
asynchronic-0.3.1 lib/asynchronic/environment.rb
asynchronic-0.3.0 lib/asynchronic/environment.rb
asynchronic-0.2.3 lib/asynchronic/environment.rb
asynchronic-0.2.2 lib/asynchronic/environment.rb
asynchronic-0.2.1 lib/asynchronic/environment.rb
asynchronic-0.2.0 lib/asynchronic/environment.rb