Module: Shoryuken

Defined in:
lib/shoryuken.rb,
lib/shoryuken/cli.rb,
lib/shoryuken/util.rb,
lib/shoryuken/queue.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/message.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,
lib/shoryuken/middleware/server/exponential_backoff_retry.rb

Defined Under Namespace

Modules: Logging, Middleware, Util, Worker Classes: CLI, Client, DefaultWorkerRegistry, EnvironmentLoader, Fetcher, Launcher, Manager, Message, Processor, Queue, Shutdown, SnsArn, Topic, WorkerRegistry

Constant Summary collapse

DEFAULTS =
{
  concurrency: 25,
  queues: [],
  aws: {},
  delay: 0,
  timeout: 8
}
VERSION =
'2.0.0'
@@queues =
[]
@@worker_registry =
DefaultWorkerRegistry.new
@@active_job_queue_name_prefixing =
false

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.aws_initialization_callbackObject (readonly)

Returns the value of attribute aws_initialization_callback.



115
116
117
# File 'lib/shoryuken.rb', line 115

def aws_initialization_callback
  @aws_initialization_callback
end

.start_callbackObject (readonly)

Returns the value of attribute start_callback.



115
116
117
# File 'lib/shoryuken.rb', line 115

def start_callback
  @start_callback
end

.stop_callbackObject (readonly)

Returns the value of attribute stop_callback.



115
116
117
# File 'lib/shoryuken.rb', line 115

def stop_callback
  @stop_callback
end

Class Method Details

.active_job_queue_name_prefixingObject



61
62
63
# File 'lib/shoryuken.rb', line 61

def active_job_queue_name_prefixing
  @@active_job_queue_name_prefixing
end

.active_job_queue_name_prefixing=(prefixing) ⇒ Object



65
66
67
# File 'lib/shoryuken.rb', line 65

def active_job_queue_name_prefixing=(prefixing)
  @@active_job_queue_name_prefixing = prefixing
end

.client_middleware {|@client_chain| ... } ⇒ Object

Yields:

  • (@client_chain)


83
84
85
86
87
# File 'lib/shoryuken.rb', line 83

def client_middleware
  @client_chain ||= default_client_middleware
  yield @client_chain if block_given?
  @client_chain
end

.configure_client {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Shoryuken)

    the object that the method was called on



79
80
81
# File 'lib/shoryuken.rb', line 79

def configure_client
  yield self
end

.configure_server {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Shoryuken)

    the object that the method was called on



69
70
71
# File 'lib/shoryuken.rb', line 69

def configure_server
  yield self if server?
end

.default_worker_optionsObject



89
90
91
92
93
94
95
96
97
# File 'lib/shoryuken.rb', line 89

def default_worker_options
  @@default_worker_options ||= {
    'queue'                   => 'default',
    'delete'                  => false,
    'auto_delete'             => false,
    'auto_visibility_timeout' => false,
    'retry_intervals'         => nil,
    'batch'                   => false }
end

.default_worker_options=(options) ⇒ Object



99
100
101
# File 'lib/shoryuken.rb', line 99

def default_worker_options=(options)
  @@default_worker_options = options
end

.loggerObject



45
46
47
# File 'lib/shoryuken.rb', line 45

def logger
  Shoryuken::Logging.logger
end

.on_aws_initialization(&block) ⇒ Object



103
104
105
# File 'lib/shoryuken.rb', line 103

def on_aws_initialization(&block)
  @aws_initialization_callback = block
end

.on_start(&block) ⇒ Object



107
108
109
# File 'lib/shoryuken.rb', line 107

def on_start(&block)
  @start_callback = block
end

.on_stop(&block) ⇒ Object



111
112
113
# File 'lib/shoryuken.rb', line 111

def on_stop(&block)
  @stop_callback = block
end

.optionsObject



37
38
39
# File 'lib/shoryuken.rb', line 37

def options
  @options ||= DEFAULTS.dup
end

.queuesObject



41
42
43
# File 'lib/shoryuken.rb', line 41

def queues
  @@queues
end

.register_worker(*args) ⇒ Object



49
50
51
# File 'lib/shoryuken.rb', line 49

def register_worker(*args)
  worker_registry.register_worker(*args)
end

.server_middleware {|@server_chain| ... } ⇒ Object

Yields:

  • (@server_chain)


73
74
75
76
77
# File 'lib/shoryuken.rb', line 73

def server_middleware
  @server_chain ||= default_server_middleware
  yield @server_chain if block_given?
  @server_chain
end

.worker_registryObject



57
58
59
# File 'lib/shoryuken.rb', line 57

def worker_registry
  @@worker_registry
end

.worker_registry=(worker_registry) ⇒ Object



53
54
55
# File 'lib/shoryuken.rb', line 53

def worker_registry=(worker_registry)
  @@worker_registry = worker_registry
end