Class: Ap4r::AsyncHelper::Converters::Base

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

Overview

A base class for converter classes. Responsibilities of subclasses are as folows

  • by make_params, convert async_params to appropriate object

  • by make_rm_options, make appropriate Hash passed by ReliableMsg::Queue#put

Direct Known Subclasses

Druby, ToRailsBase

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Base.



205
206
207
208
209
210
# File 'lib/ap4r/async_helper.rb', line 205

def initialize(url_options, async_params, rm_options, url_for_handler)
  @url_options = url_options
  @async_params = async_params
  @rm_options = rm_options
  @url_for_handler = url_for_handler
end

Class Method Details

.dispatch_mode(mode_symbol) ⇒ Object

Difine a constant DISPATCH_MODE to value ‘mode_symbol’ and add self to a Converters list.



200
201
202
203
# File 'lib/ap4r/async_helper.rb', line 200

def self.dispatch_mode(mode_symbol)
  self.const_set(:DISPATCH_MODE, mode_symbol)
  ::Ap4r::AsyncHelper::Base::Converters[mode_symbol] = self
end

Instance Method Details

#make_paramsObject

Returns a object which passed to ReliableMsg::Queue.put(message, headers)‘s first argument message. Should be implemented by subclasses.



221
222
223
# File 'lib/ap4r/async_helper.rb', line 221

def make_params
  raise 'must be implemented in subclasses'
end

#make_rm_optionsObject

Returns a object which passed to ReliableMsg::Queue.put(message, headers)‘s second argument headers. Should be implemented by subclasses.



228
229
230
# File 'lib/ap4r/async_helper.rb', line 228

def make_rm_options
  raise 'must be implemented in subclasses'
end

#queue_nameObject

Returns a queue name to which a message will be queued. Should be implemented by subclasses.



214
215
216
# File 'lib/ap4r/async_helper.rb', line 214

def queue_name
  raise 'must be implemented in subclasses'
end