Module: ActionSubscriber::MarchHare::Subscriber
- Includes:
- Logging
- Included in:
- RouteSet
- Defined in:
- lib/action_subscriber/march_hare/subscriber.rb
Instance Method Summary
collapse
Methods included from Logging
initialize_logger, logger, #logger, logger=
Instance Method Details
#cancel_consumers! ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/action_subscriber/march_hare/subscriber.rb', line 6
def cancel_consumers!
march_hare_consumers.reject(&:cancelled?).each(&:cancel)
::ActionSubscriber::ThreadPools.threadpools.each do |name, threadpool|
threadpool.shutdown
end
end
|
#march_hare_consumers ⇒ Object
14
15
16
|
# File 'lib/action_subscriber/march_hare/subscriber.rb', line 14
def march_hare_consumers
@march_hare_consumers ||= []
end
|
#setup_subscriptions! ⇒ Object
18
19
20
21
22
23
24
25
26
|
# File 'lib/action_subscriber/march_hare/subscriber.rb', line 18
def setup_subscriptions!
fail ::RuntimeError, "you cannot setup queues multiple times, this should only happen once at startup" unless subscriptions.empty?
routes.each do |route|
subscriptions << {
:route => route,
:queue => setup_queue(route),
}
end
end
|
#start_subscribers! ⇒ Object
28
29
30
31
32
|
# File 'lib/action_subscriber/march_hare/subscriber.rb', line 28
def start_subscribers!
subscriptions.each do |subscription|
start_subscriber_for_subscription(subscription)
end
end
|