Class: StompServer::QueueMonitor

### Home Classes Methods

### In Files

- lib/stomp_server/queue_manager.rb

### Parent

Object

### Methods

- ::new
- #monitor
- #start

### Files

- History.txt
- Manifest.txt
- README.txt
- README.txt

### Class/Module Index

Quicksearch

- StompServer
- StompServer::ActiveRecordQueue
- StompServer::Configurator
- StompServer::DBMQueue
- StompServer::FileQueue
- StompServer::MemoryQueue
- StompServer::Protocols
- StompServer::Protocols::Http
- StompServer::Protocols::Stomp
- StompServer::Queue
- StompServer::QueueManager
- StompServer::QueueMonitor
- StompServer::Run
- StompServer::StompAuth
- StompServer::StompFrame
- StompServer::StompFrameRecognizer
- StompServer::StompId
- StompServer::StompUser
- StompServer::TestServer
- StompServer::TopicManager
- Mongrel
- Mongrel::HttpRequest
- ArMessage

No matching classes.

# StompServer::QueueMonitor

### Public Class Methods

new(qstore,queues) click to toggle source

    # File lib/stomp_server/queue_manager.rb, line 23
    def initialize(qstore,queues)
      @qstore = qstore
      @queues = queues
      @stompid = StompServer::StompId.new
      puts "QueueManager initialized"
    end

### Public Instance Methods

monitor(count) click to toggle source

    # File lib/stomp_server/queue_manager.rb, line 35
    def monitor(count)
      return unless @qstore.methods.include?('monitor')
      users = @queues['/queue/monitor']
      return if users.size == 0
      stats = @qstore.monitor
      return if stats.size == 0
      body = ''

      stats.each do |queue,qstats|
        body << "Queue: #{queue}\n"
        qstats.each {|stat,value| body << "#{stat}: #{value}\n"}
        body << "\n"
      end

      headers = {
        'message-id' => @stompid[count],
        'destination' => '/queue/monitor',
        'content-length' => body.size.to_s
      }

      frame = StompServer::StompFrame.new('MESSAGE', headers, body)
      users.each {|user| user.connection.stomp_send_data(frame)}
    end

start() click to toggle source

    # File lib/stomp_server/queue_manager.rb, line 30
    def start
      count =0
      EventMachine::add_periodic_timer 5, proc {count+=1; monitor(count) }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.