Module: HotPotato::Route
- Defined in:
- lib/hot_potato/dsl.rb
Overview
The routes file (config/routes.rb) is a Ruby DSL that does the following:
-
Defines AppTasks (Faucets, Workers, Sinks)
-
Defines processing chain for AppTasks
-
Restrict AppTasks to a host group
-
Limit number of instances
Example:
HotPotato::Route.build do
faucet :twitter_faucet
worker :influencer, :source => :twitter_faucet
sink :log_writer, :source => :influencer
end
Multiple sources can be attached to a worker or sink:
worker :influencer, :source => [:twitter_faucet. :other_source]
The number of instances is set to 1. This can be changed by setting the number of instances:
worker :influencer, :source => :twitter_faucet, :instances => 2
AppTasks can be limited to a specific server (or set of servers) by creating a group in the config/config.yml file:
development:
redis_hostname: localhost
redis_port: 6379
servers:
- hostname: worker01
group: incoming
max_app_tasks: 15
- hostname: worker02
group: worker
max_app_tasks: 15
and specifying the group in the routes files:
faucet :twitter_faucet, :group => :incoming
Defined Under Namespace
Classes: AppTask, Faucet, Routes, Sink, Worker