Sha256: 0c6662b3405da6198f780d60049b867ae4b6593931e729169d32b00d66342a30

Contents?: true

Size: 730 Bytes

Versions: 8

Compression:

Stored size: 730 Bytes

Contents

$:.unshift File.dirname(__FILE__)+"/../../lib/"
require 'rubygems'
require 'magent'
require 'mongo_mapper'


MongoMapper.database = "test"
Magent.database = "test"

class Thing
  include MongoMapper::Document
  include Magent::Async

  key :_id, String
  key :name

  def process_something(arg)
    puts "Processing: #{arg}"
  end

  def process_nothing
    puts "Processing..."
  end

  def self.foo
    puts "MAX PRIORITY"
  end
end


thing = Thing.create(:_id => "foo")

# 3 messages
thing.async.process_something("testing").commit!
thing.async.process_nothing.commit!
Thing.async.find(thing.id).process_something("testing2").commit!
Thing.async.foo.commit!(1)

Magent::Processor.new(Magent::AsyncChannel.new(:default)).run!


Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
magent-0.6.2 examples/mongomapper/async.rb
magent-0.6.1 examples/mongomapper/async.rb
magent-0.6.0 examples/mongomapper/async.rb
magent-0.5.4 examples/mongomapper/async.rb
magent-0.5.3 examples/mongomapper/async.rb
magent-0.5.2 examples/mongomapper/async.rb
magent-0.5.1 examples/mongomapper/async.rb
magent-0.5.0 examples/mongomapper/async.rb