Sha256: 66217246134e617b823e4f1428d3e9be200aaaec8af829786e105f9af5b2067c

Contents?: true

Size: 608 Bytes

Versions: 2

Compression:

Stored size: 608 Bytes

Contents

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

Magent.push("/stats", :calc)
Magent.push("/stats", :calc)
Magent.push("/stats", :calc)
Magent.push("/stats", :calc)

class Stats
  include Magent::Actor

  channel_name "stats"
  expose :calc

  def calc(payload)
    $stderr.puts "messages in queue: #{self.class.channel.queue_count}"
    $stderr.puts "total messages count: #{self.class.channel.message_count}"
    $stderr.puts "total errors: #{self.class.channel.error_count}"
  end
end

Magent.register(Stats.new)

if $0 == __FILE__
  Magent::Processor.new(Magent.current_actor).run!
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
magent-0.2 examples/stats/stats.rb
magent-0.1.3 examples/stats/stats.rb