class RabbitRPC::MessageParser

Constants

ONE_WAY_PREFIX

methods with the following prefix will not wait for a response

Attributes

method_name[R]
service_name[R]

Public Class Methods

new(message) click to toggle source
# File lib/rabbit_rpc/message_parser.rb, line 11
def initialize(message)
  @message = message
end

Public Instance Methods

one_way?() click to toggle source

Public: Identifies whether a wait for a response is expected

Returns a Boolean

# File lib/rabbit_rpc/message_parser.rb, line 31
def one_way?
  parse if @method_name.nil?
  @method_name.start_with?(ONE_WAY_PREFIX)
end
parse() click to toggle source

Public: Extracts the Service name and method name

Examples

"UserService.create"
# => "UserService", "create"

Returns nothing

# File lib/rabbit_rpc/message_parser.rb, line 23
def parse
  method = @message.is_a?(RabbitRPC::Message) ? @message.method_name : @message['method']
  @service_name, @method_name = method.split('.')
end