Class: EventMachine::PosixMQ::Watcher

Inherits:
EM::Connection
  • Object
show all
Defined in:
lib/em-posixmq.rb

Instance Method Summary collapse

Constructor Details

#initialize(posix_mq) ⇒ Watcher

Returns a new instance of Watcher.



10
11
12
13
# File 'lib/em-posixmq.rb', line 10

def initialize(posix_mq)
  @posix_mq = posix_mq
  @posix_mq.nonblock = true
end

Instance Method Details

#notify_readableObject



15
16
17
18
19
# File 'lib/em-posixmq.rb', line 15

def notify_readable
  # POSIX_MQ#tryreceive returns nil in case there is nothing to read.
  message, priority = @posix_mq.tryreceive
  receive_message message, priority if message
end

#receive_message(message, priority) ⇒ Object



21
22
23
# File 'lib/em-posixmq.rb', line 21

def receive_message(message, priority)
  # This method must be defined in the user's class inherinting this one.
end