Module: Karafka::Processing::Strategies::Base

Included in:
Karafka::Pro::Processing::Strategies::Base, Default
Defined in:
lib/karafka/processing/strategies/base.rb

Overview

Base strategy that should be included in each strategy, just to ensure the API

Instance Method Summary collapse

Instance Method Details

#handle_after_consumeObject

Post-consumption handling

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/karafka/processing/strategies/base.rb', line 31

def handle_after_consume
  raise NotImplementedError, 'Implement in a subclass'
end

#handle_before_consumeObject

What should happen before we kick in the processing

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/karafka/processing/strategies/base.rb', line 21

def handle_before_consume
  raise NotImplementedError, 'Implement in a subclass'
end

#handle_before_enqueueObject

Note:

This runs from the listener thread, not recommended to put anything slow here

What should happen before jobs are enqueued

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/karafka/processing/strategies/base.rb', line 16

def handle_before_enqueue
  raise NotImplementedError, 'Implement in a subclass'
end

#handle_consumeObject

What should happen in the processing

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/karafka/processing/strategies/base.rb', line 26

def handle_consume
  raise NotImplementedError, 'Implement in a subclass'
end

#handle_idleObject

Idle run handling

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/karafka/processing/strategies/base.rb', line 36

def handle_idle
  raise NotImplementedError, 'Implement in a subclass'
end

#handle_revokedObject

Revocation handling

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/karafka/processing/strategies/base.rb', line 41

def handle_revoked
  raise NotImplementedError, 'Implement in a subclass'
end

#handle_shutdownObject

Shutdown handling

Raises:

  • (NotImplementedError)


46
47
48
# File 'lib/karafka/processing/strategies/base.rb', line 46

def handle_shutdown
  raise NotImplementedError, 'Implement in a subclass'
end