hivent v2.2.0 Hivent.Consumer behaviour

The Hivent Consumer. Use module options to configure your consumer:

  • @topic The topic you want to consume, ie. “some:event”
  • @name The name of your consumer
  • @partition_count The number of partitions data will be partitioned in

Implement the Consumer behaviour by overriding process/1. The argument is the %Hivent.Event{} consumed. Use return values to inform Hivent if processing the event succeded or failed:

  • :ok
  • {:error, “Failed to process XYZ”}

    Events that have failed to be processed will be put in a dedicated dead letter queue.

Summary

Functions

consumer_name(name)
hospitalize(event, queue)
producer_name(name)
register(topic)

Callbacks

process(%)
process(%Hivent.Event{meta: term, payload: term}) ::
  :ok |
  {:error, term}