Class: StompServer::FileQueue

### Home Classes Methods

### In Files

- lib/stomp_server/queue/file_queue.rb

### Parent

StompServer::Queue

### Methods

- #_close_queue
- #_open_queue
- #_readframe
- #_writeframe

### 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::FileQueue

### Public Instance Methods

_close_queue(dest) click to toggle source

    # File lib/stomp_server/queue/file_queue.rb, line 5
    def _close_queue(dest)
      Dir.delete(@queues[dest][:queue_dir]) if File.directory?(@queues[dest][:queue_dir])
    end

_open_queue(dest) click to toggle source

    # File lib/stomp_server/queue/file_queue.rb, line 9
    def _open_queue(dest)
      # handle clashes between _ and /
      queue_name = dest.gsub('_','__')
      queue_name = dest.gsub('/','_')
      queue_dir = @directory + '/' + queue_name
      @queues[dest][:queue_dir] = queue_dir
      Dir.mkdir(queue_dir) unless File.directory?(queue_dir)
    end

_readframe(dest,msgid) click to toggle source

    # File lib/stomp_server/queue/file_queue.rb, line 30
    def _readframe(dest,msgid)
      filename = "#{@queues[dest][:queue_dir]}/#{msgid}"
      file = nil
      File.open(filename,'rb') {|f| file = f.read}
      frame_len = file[0,8].hex
      body_len = file[8,8].hex
      frame = Marshal::load(file[16,frame_len])
      frame.body = file[(frame_len + 16),body_len]
      if File.delete(filename)
        result = frame
      else
        result = false
      end
      return result
    end

_writeframe(dest,frame_todump,msgid) click to toggle source

    # File lib/stomp_server/queue/file_queue.rb, line 18
    def _writeframe(dest,frame_todump,msgid)
      filename = "#{@queues[dest][:queue_dir]}/#{msgid}"
      frame = frame_todump.dup
      frame_body = frame.body
      frame.body = ''
      frame_image = Marshal.dump(frame)
      framelen = sprintf("%08x", frame_image.length)
      bodylen = sprintf("%08x", frame_body.length)
      File.open(filename,'wb') {|f| f.syswrite("#{framelen}#{bodylen}#{frame_image}#{frame_body}")}
      return true
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.