Class: QueueBus::Adapters::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/queue_bus/adapters/base.rb

Direct Known Subclasses

Data

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Base

adapters need to define the NonImplemented methods in this class



6
7
8
# File 'lib/queue_bus/adapters/base.rb', line 6

def initialize
  enabled!
end

Instance Method Details

#enabled! ⇒ Object

Raises:

  • (NotImplementedError)


10
11
12
13
14
# File 'lib/queue_bus/adapters/base.rb', line 10

def enabled!
  # called the first time we know we are using this adapter
  # it would be a good spot to require the libraries you're using
  raise NotImplementedError
end

#enqueue(queue_name, klass, hash) ⇒ Object

Raises:

  • (NotImplementedError)


21
22
23
24
# File 'lib/queue_bus/adapters/base.rb', line 21

def enqueue(queue_name, klass, hash)
  # enqueue the given class (Driver/Rider) in your queue
  raise NotImplementedError
end

#enqueue_at(epoch_seconds, queue_name, klass, hash) ⇒ Object

Raises:

  • (NotImplementedError)


26
27
28
29
# File 'lib/queue_bus/adapters/base.rb', line 26

def enqueue_at(epoch_seconds, queue_name, klass, hash)
  # enqueue the given class (Publisher) in your queue to run at given time
  raise NotImplementedError
end

#redis ⇒ Object

Raises:

  • (NotImplementedError)


16
17
18
19
# File 'lib/queue_bus/adapters/base.rb', line 16

def redis
  # for now, we're always using redis as a storage mechanism so give us one
  raise NotImplementedError
end

#setup_heartbeat! ⇒ Object

Raises:

  • (NotImplementedError)


31
32
33
34
# File 'lib/queue_bus/adapters/base.rb', line 31

def setup_heartbeat!
  # if possible, tell a recurring job system to publish every minute
  raise NotImplementedError
end

#worker_included(base) ⇒ Object



36
37
38
# File 'lib/queue_bus/adapters/base.rb', line 36

def worker_included(base)
  # optional method for including more modules in classes that work in the queue
end