Class: Shoryuken::WorkerRegistry Abstract
- Inherits:
-
Object
- Object
- Shoryuken::WorkerRegistry
- Defined in:
- lib/shoryuken/worker_registry.rb
Overview
Subclass and implement all methods to create a custom registry
Abstract base class for worker registries. Defines the interface for storing and retrieving worker classes.
Direct Known Subclasses
Instance Method Summary collapse
-
#batch_receive_messages?(_queue) ⇒ Boolean
Checks if the workers for a queue support batch message processing.
-
#clear ⇒ void
Removes all worker registrations.
-
#fetch_worker(_queue, _message) ⇒ Object
Fetches a worker instance for processing a message.
-
#queues ⇒ Array<String>
Returns a list of all queues with registered workers.
-
#register_worker(_queue, _clazz) ⇒ void
Registers a worker class for a queue.
-
#workers(_queue) ⇒ Array<Class>
Returns all worker classes registered for a queue.
Instance Method Details
#batch_receive_messages?(_queue) ⇒ Boolean
Checks if the workers for a queue support batch message processing
13 14 15 16 |
# File 'lib/shoryuken/worker_registry.rb', line 13 def (_queue) # true if the workers for queue support batch processing of messages fail NotImplementedError end |
#clear ⇒ void
This method returns an undefined value.
Removes all worker registrations
22 23 24 25 |
# File 'lib/shoryuken/worker_registry.rb', line 22 def clear # must remove all worker registrations fail NotImplementedError end |
#fetch_worker(_queue, _message) ⇒ Object
Fetches a worker instance for processing a message
33 34 35 36 37 |
# File 'lib/shoryuken/worker_registry.rb', line 33 def fetch_worker(_queue, ) # must return an instance of the worker that handles # message received on queue fail NotImplementedError end |
#queues ⇒ Array<String>
Returns a list of all queues with registered workers
43 44 45 46 |
# File 'lib/shoryuken/worker_registry.rb', line 43 def queues # must return a list of all queues with registered workers fail NotImplementedError end |
#register_worker(_queue, _clazz) ⇒ void
This method returns an undefined value.
Registers a worker class for a queue
54 55 56 57 |
# File 'lib/shoryuken/worker_registry.rb', line 54 def register_worker(_queue, _clazz) # must register the worker as a consumer of messages from queue fail NotImplementedError end |
#workers(_queue) ⇒ Array<Class>
Returns all worker classes registered for a queue
64 65 66 67 |
# File 'lib/shoryuken/worker_registry.rb', line 64 def workers(_queue) # must return the list of workers registered for queue, or [] fail NotImplementedError end |