Module: Shoryuken
- Defined in:
- lib/shoryuken.rb,
lib/shoryuken/cli.rb,
lib/shoryuken/util.rb,
lib/shoryuken/topic.rb,
lib/shoryuken/client.rb,
lib/shoryuken/worker.rb,
lib/shoryuken/fetcher.rb,
lib/shoryuken/logging.rb,
lib/shoryuken/manager.rb,
lib/shoryuken/sns_arn.rb,
lib/shoryuken/version.rb,
lib/shoryuken/launcher.rb,
lib/shoryuken/processor.rb,
lib/shoryuken/worker_registry.rb,
lib/shoryuken/middleware/chain.rb,
lib/shoryuken/environment_loader.rb,
lib/shoryuken/default_worker_registry.rb,
lib/shoryuken/middleware/server/timing.rb,
lib/shoryuken/middleware/server/auto_delete.rb,
lib/shoryuken/middleware/server/active_record.rb
Defined Under Namespace
Modules: Logging, Middleware, Util, Worker
Classes: CLI, Client, DefaultWorkerRegistry, EnvironmentLoader, Fetcher, Launcher, Manager, Processor, Shutdown, SnsArn, Topic, WorkerRegistry
Constant Summary
collapse
- DEFAULTS =
{
concurrency: 25,
queues: [],
aws: {},
delay: 0,
timeout: 8
}
- VERSION =
'1.0.0'
- @@queues =
[]
- @@worker_registry =
DefaultWorkerRegistry.new
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.aws_initialization_callback ⇒ Object
Returns the value of attribute aws_initialization_callback.
98
99
100
|
# File 'lib/shoryuken.rb', line 98
def aws_initialization_callback
@aws_initialization_callback
end
|
.start_callback ⇒ Object
Returns the value of attribute start_callback.
98
99
100
|
# File 'lib/shoryuken.rb', line 98
def start_callback
@start_callback
end
|
.stop_callback ⇒ Object
Returns the value of attribute stop_callback.
98
99
100
|
# File 'lib/shoryuken.rb', line 98
def stop_callback
@stop_callback
end
|
Class Method Details
Shoryuken.configure_server do |config|
config.server_middleware do |chain|
chain.add MyServerHook
end
end
63
64
65
|
# File 'lib/shoryuken.rb', line 63
def configure_server
yield self if server?
end
|
.default_worker_options ⇒ Object
73
74
75
76
77
78
79
80
|
# File 'lib/shoryuken.rb', line 73
def default_worker_options
@@default_worker_options ||= {
'queue' => 'default',
'delete' => false,
'auto_delete' => false,
'auto_visibility_timeout' => false,
'batch' => false }
end
|
.default_worker_options=(options) ⇒ Object
82
83
84
|
# File 'lib/shoryuken.rb', line 82
def default_worker_options=(options)
@@default_worker_options = options
end
|
.on_aws_initialization(&block) ⇒ Object
86
87
88
|
# File 'lib/shoryuken.rb', line 86
def on_aws_initialization(&block)
@aws_initialization_callback = block
end
|
.on_start(&block) ⇒ Object
90
91
92
|
# File 'lib/shoryuken.rb', line 90
def on_start(&block)
@start_callback = block
end
|
.on_stop(&block) ⇒ Object
94
95
96
|
# File 'lib/shoryuken.rb', line 94
def on_stop(&block)
@stop_callback = block
end
|
.options ⇒ Object
34
35
36
|
# File 'lib/shoryuken.rb', line 34
def options
@options ||= DEFAULTS.dup
end
|
.queues ⇒ Object
38
39
40
|
# File 'lib/shoryuken.rb', line 38
def queues
@@queues
end
|
.register_worker(*args) ⇒ Object
46
47
48
|
# File 'lib/shoryuken.rb', line 46
def register_worker(*args)
worker_registry.register_worker(*args)
end
|
.server_middleware {|@server_chain| ... } ⇒ Object
67
68
69
70
71
|
# File 'lib/shoryuken.rb', line 67
def server_middleware
@server_chain ||= default_server_middleware
yield @server_chain if block_given?
@server_chain
end
|
.worker_registry ⇒ Object
54
55
56
|
# File 'lib/shoryuken.rb', line 54
def worker_registry
@@worker_registry
end
|
.worker_registry=(worker_registry) ⇒ Object
50
51
52
|
# File 'lib/shoryuken.rb', line 50
def worker_registry=(worker_registry)
@@worker_registry = worker_registry
end
|