Method: ASIR::Transport::Beanstalk#_receive_message
- Defined in:
- lib/asir/transport/beanstalk.rb
#_receive_message(channel, additional_data) ⇒ Object
!SLIDE Receives the encoded Message payload String.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/asir/transport/beanstalk.rb', line 45 def channel, additional_data channel.with_stream! do | stream | begin match = _beanstalk(stream, RESERVE, /\ARESERVED (\d+) (\d+)\r\n\Z/) additional_data[:beanstalk_job_id] = match[1].to_i additional_data[:beanstalk_message_size] = size = match[2].to_i = stream.read(size) _read_line_and_expect! stream, /\A\r\n\Z/ # Pass the original stream used to #_send_result below. [ , stream ] rescue ::Exception => exc _log { [ :_receive_message, :exception, exc ] } additional_data[:beanstalk_error] = exc channel.close raise exc end end end |