hivent v3.0.0 Hivent.Consumer behaviour

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

  • @service The name of your service, ie: “order_service”
  • @topic The topic you want to consume, ie. “some:event”
  • @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

Types

event()
event() :: %Hivent.Event{meta: term, name: term, payload: term}

Callbacks

process(event)
process(event) :: :ok | {:error, term}