Class: Qwirk::Adapter::Inline::Worker

Inherits:
Object
  • Object
show all
Defined in:
lib/qwirk/adapter/inline/worker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, marshaler) ⇒ Worker

Returns a new instance of Worker.



9
10
11
12
# File 'lib/qwirk/adapter/inline/worker.rb', line 9

def initialize(name, marshaler)
  @name       = name
  @marshaler  = marshaler
end

Instance Attribute Details

#response_handleObject

Returns the value of attribute response_handle.



7
8
9
# File 'lib/qwirk/adapter/inline/worker.rb', line 7

def response_handle
  @response_handle
end

Instance Method Details

#acknowledge_message(message) ⇒ Object

We never call worker.start so this method is unnecessary



19
20
# File 'lib/qwirk/adapter/inline/worker.rb', line 19

def acknowledge_message(message)
end

#handle_failure(message, exception, fail_queue_name) ⇒ Object



36
37
38
# File 'lib/qwirk/adapter/inline/worker.rb', line 36

def handle_failure(message, exception, fail_queue_name)
  Qwirk.logger.warn("Dropping message that failed: #{message}")
end

#message_to_object(msg) ⇒ Object



31
32
33
34
# File 'lib/qwirk/adapter/inline/worker.rb', line 31

def message_to_object(msg)
  # The publisher has already unmarshaled the object to save hassle here.
  return msg
end

#ready_to_stop?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/qwirk/adapter/inline/worker.rb', line 43

def ready_to_stop?
  true
end

#receive_messageObject

We never call worker.start so this method is unnecessary



15
16
# File 'lib/qwirk/adapter/inline/worker.rb', line 15

def receive_message
end

#send_exception(original_message, e) ⇒ Object



27
28
29
# File 'lib/qwirk/adapter/inline/worker.rb', line 27

def send_exception(original_message, e)
  do_send_response(original_message, Qwirk::RemoteException.new(e))
end

#send_response(original_message, marshaled_object) ⇒ Object



22
23
24
25
# File 'lib/qwirk/adapter/inline/worker.rb', line 22

def send_response(original_message, marshaled_object)
  # We unmarshal so our workers get consistent messages regardless of the adapter
  do_send_response(original_message, @marshaler.unmarshal(marshaled_object))
end

#stopObject



40
41
# File 'lib/qwirk/adapter/inline/worker.rb', line 40

def stop
end