Sha256: 307c48bc1d5d892d6f3cd25145fa0cef0219825382a66608822a85edba294691

Contents?: true

Size: 698 Bytes

Versions: 3

Compression:

Stored size: 698 Bytes

Contents

require 'observed'
require 'observed/eventmachine'

include Observed

# This is a observed-eventmachine specific code to extend the DSL to use EventMachine
extend Observed::EM

class Test < Observed::Observer
  plugin_name 'test'
  def observe
    puts "Sleeping 10 seconds"
    sleep 10.0
    puts "Slept 10 seconds"
    [tag, {foo:1}]
  end
end

observe 'foo', via: 'test'

report /foo/, via: 'stdout', with: {
  format: -> _, _, data { "#{data}" }
}

# This is a observed-eventmachine specific code to schedule the observation on 'foo'
every 1, run: 'foo'

# This is a observed-eventmachine specific code to start running observations periodically, until we stop that by
# sending signals
start

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
observed-0.2.0 integrations/observed-eventmachine/examples/observed.rb
observed-0.2.0.rc2 integrations/observed-eventmachine/examples/observed.rb
observed-0.2.0.rc1 integrations/observed-eventmachine/examples/observed.rb