Module: MessQ::Agent
- Defined in:
- lib/messQ/agent.rb
Class Method Summary collapse
Class Method Details
.client(cmd) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/messQ/agent.rb', line 14 def self.client(cmd) begin TCPSocket.open(MessQ.host, MessQ.port) do |socket| socket.puts cmd server_says = socket.read socket.flush socket.close return server_says end rescue MessQ::Verbose.logme 'Can not connect to MessQ.' end end |
.dequeue ⇒ Object
10 11 12 |
# File 'lib/messQ/agent.rb', line 10 def self.dequeue client 'deq' end |
.enqueue(msg) ⇒ Object
6 7 8 |
# File 'lib/messQ/agent.rb', line 6 def self.enqueue(msg) client "enq #{msg}" end |