Class: Karafka::Web::Processing::Publisher

Inherits:
Object
  • Object
show all
Defined in:
lib/karafka/web/processing/publisher.rb

Overview

Object responsible for publishing states data back into Kafka so it can be used in the UI

Class Method Summary collapse

Class Method Details

.publish(consumers_state, consumers_metrics) ⇒ Object

Publishes data back to Kafka in an async fashion

Parameters:

  • consumers_state (Hash)

    consumers current state

  • consumers_metrics (Hash)

    consumers current metrics



13
14
15
16
17
# File 'lib/karafka/web/processing/publisher.rb', line 13

def publish(consumers_state, consumers_metrics)
  ::Karafka::Web.producer.produce_many_async(
    prepare_data(consumers_state, consumers_metrics)
  )
end

.publish!(consumers_state, consumers_metrics) ⇒ Object

Publishes data back to Kafka in a sync fashion

Parameters:

  • consumers_state (Hash)

    consumers current state

  • consumers_metrics (Hash)

    consumers current metrics



23
24
25
26
27
# File 'lib/karafka/web/processing/publisher.rb', line 23

def publish!(consumers_state, consumers_metrics)
  ::Karafka::Web.producer.produce_many_sync(
    prepare_data(consumers_state, consumers_metrics)
  )
end