Sha256: 2d9dfc4206369951852e0965a0eaffb967c25aa60813fdf118287e9607b2fa79

Contents?: true

Size: 660 Bytes

Versions: 18

Compression:

Stored size: 660 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
    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

18 entries across 18 versions & 1 rubygems

Version Path
asynchronic-2.0.1 lib/asynchronic/environment.rb
asynchronic-2.0.0 lib/asynchronic/environment.rb
asynchronic-1.6.3 lib/asynchronic/environment.rb
asynchronic-1.6.2 lib/asynchronic/environment.rb
asynchronic-1.6.1 lib/asynchronic/environment.rb
asynchronic-1.6.0 lib/asynchronic/environment.rb
asynchronic-1.5.2 lib/asynchronic/environment.rb
asynchronic-1.5.1 lib/asynchronic/environment.rb
asynchronic-1.5.0 lib/asynchronic/environment.rb
asynchronic-1.4.0 lib/asynchronic/environment.rb
asynchronic-1.3.1 lib/asynchronic/environment.rb
asynchronic-1.3.0 lib/asynchronic/environment.rb
asynchronic-1.2.2 lib/asynchronic/environment.rb
asynchronic-1.2.1 lib/asynchronic/environment.rb
asynchronic-1.2.0 lib/asynchronic/environment.rb
asynchronic-1.1.1 lib/asynchronic/environment.rb
asynchronic-1.1.0 lib/asynchronic/environment.rb
asynchronic-1.0.0 lib/asynchronic/environment.rb