class AmqpUtils::MessageFormatter::JSON

Public Instance Methods

generate(io, header, message) click to toggle source
# File lib/amqp_utils/message_formatter.rb, line 44
def generate(io, header, message)
  json_obj = {'header' => header.properties, 'message' => message}
  io.puts ::JSON.generate(json_obj)
end
load(io) click to toggle source
# File lib/amqp_utils/message_formatter.rb, line 49
def load(io)
  next_line = io.gets
  ::JSON.parse(next_line) if next_line
end