Class: HotPotato::Sink
- Inherits:
-
Object
- Object
- HotPotato::Sink
- Includes:
- AppTask
- Defined in:
- lib/hot_potato/sink.rb
Overview
Sinks send data out of the system. Examples include: WebSocket, Database (Data Warehouse), and File Writer. Each sink is a ruby file in the app directory that extends HotPotato::Sink and implements the perform(message) method. There is no send_message for the sink to call since it is a final destination for the message.
class LogWriter < HotPotato::Sink
def perform()
log.debug "#{["username"]}:#{["influence"]}"
end
end
Constant Summary
Constants included from AppTask
AppTask::HEARTBEAT_EXPIRE, AppTask::HEARTBEAT_INTERVAL, AppTask::MESSAGE_COUNT_EXPIRE
Constants included from Core
Instance Method Summary collapse
Methods included from AppTask
#count_message_in, #count_message_out, #start_heartbeat_service
Methods included from Core
#acquire_lock, #config, #log, #queue_inject, #queue_subscribe, #release_lock, #set_logger, #stat
Instance Method Details
#start(queue_in) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/hot_potato/sink.rb', line 19 def start(queue_in) if !self.respond_to?('perform') log.error "The Sink #{self.class.name} does not implement a perform method." exit 1 end start_heartbeat_service queue_subscribe(queue_in) do |m| perform m end end |