Class: Ap4r::AsyncHelper::Converters::Druby

Inherits:
Base
  • Object
show all
Defined in:
lib/ap4r/async_helper.rb

Constant Summary collapse

OPTION_KEY =
:receiver
@@default_url =
"druby://localhost:9999"

Instance Method Summary collapse

Methods inherited from Base

dispatch_mode

Constructor Details

#initialize(url_options, async_params, rm_options, url_for_handler) ⇒ Druby

Returns a new instance of Druby.



341
342
343
344
# File 'lib/ap4r/async_helper.rb', line 341

def initialize(url_options, async_params, rm_options, url_for_handler)
  super
  @url_options[:url] ||= @@default_url
end

Instance Method Details

#make_paramsObject



357
358
359
# File 'lib/ap4r/async_helper.rb', line 357

def make_params
  @async_params
end

#make_rm_optionsObject



361
362
363
364
365
366
367
368
369
370
# File 'lib/ap4r/async_helper.rb', line 361

def make_rm_options
  @rm_options[:target_url] ||=
    if @url_options[OPTION_KEY]
      "#{@url_options[:url]}?#{@url_options[OPTION_KEY]}"
    else
      @url_options[:url]
    end
  @rm_options[:target_method] = @url_options[:message]
  @rm_options
end

#queue_nameObject



346
347
348
349
350
351
352
353
354
355
# File 'lib/ap4r/async_helper.rb', line 346

def queue_name
  queue_name = @rm_options[:queue]
  return queue_name if queue_name

  @rm_options[:queue] =
    [AsyncHelper::Base.default_queue_prefix.chomp("."),
     @url_options[OPTION_KEY].to_s || "druby",
     @url_options[:message].to_s].join(".")
  @rm_options[:queue]
end