class Vertx::Message

Represents a message received from the event bus @author {tfox.org Tim Fox}

Attributes

body[R]

Public Class Methods

new(message) click to toggle source

@private

# File lib/vertx/event_bus.rb, line 175
def initialize(message)

  @j_del = message
  if message.body.is_a? org.vertx.java.core.json.JsonObject
    @body = JSON.parse(message.body.encode)
  elsif message.body.is_a? org.vertx.java.core.buffer.Buffer
    @body = Buffer.new(message.body)
  else
    @body = message.body
  end
end

Public Instance Methods

reply(reply, &reply_handler) click to toggle source

Reply to this message. If the message was sent specifying a receipt handler, that handler will be called when it has received a reply. If the message wasn't sent specifying a receipt handler this method does nothing. Replying to a message this way is equivalent to sending a message to an address which is the same as the message id of the original message. @param [Hash] Message send as reply

# File lib/vertx/event_bus.rb, line 193
def reply(reply, &reply_handler)
  raise "A reply message must be specified" if reply == nil
  reply = EventBus.convert_msg(reply)
  if reply_handler != nil
    @j_del.reply(reply, InternalHandler.new(reply_handler))
  else
    @j_del.reply(reply)
  end
end