Class: Upperkut::Strategies::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/upperkut/strategies/base.rb

Direct Known Subclasses

BufferedQueue, PriorityQueue, ScheduledQueue

Instance Method Summary collapse

Instance Method Details

#ack(_items) ⇒ Object

Public: Confirms that items have been processed successfully.

items - The Array of items do be confirmed.

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/upperkut/strategies/base.rb', line 30

def ack(_items)
  raise NotImplementedError
end

#clearObject

Public: Clear all data related to the strategy.

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/upperkut/strategies/base.rb', line 23

def clear
  raise NotImplementedError
end

#fetch_items(_batch_size) ⇒ Object

Public: Retrieve events from Strategy.

batch_size: # of items to be retrieved.

Returns an Array containing events as hash.

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/upperkut/strategies/base.rb', line 18

def fetch_items(_batch_size)
  raise NotImplementedError
end

#metricsObject

Public: Consolidated strategy metrics.

Returns hash containing metric name and values.

Raises:

  • (NotImplementedError)


51
52
53
# File 'lib/upperkut/strategies/base.rb', line 51

def metrics
  raise NotImplementedError
end

#nack(_items) ⇒ Object

Public: Informs that items have been not processed successfully and therefore must be re-processed.

items - The Array of items do be unacknowledged.

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/upperkut/strategies/base.rb', line 37

def nack(_items)
  raise NotImplementedError
end

#process?Boolean

Public: Tells when to execute the event processing, when this condition is met so the events are dispatched to the worker.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


44
45
46
# File 'lib/upperkut/strategies/base.rb', line 44

def process?
  raise NotImplementedError
end

#push_items(_items = []) ⇒ Object

Public: Ingests the event into strategy.

items - The Array of items do be inserted.

Returns true when success, raise when error.

Raises:

  • (NotImplementedError)


9
10
11
# File 'lib/upperkut/strategies/base.rb', line 9

def push_items(_items = [])
  raise NotImplementedError
end