PulsarEx.ConsumerCallback behaviour (pulsar_ex v0.1.1)

Always handle messages in batch. If the batch_size is set to 1, then only up to 1 message will be handled. If batch_size is n, then handle_messages will handle 0 < messages <= n.

Expect the return of a list of [{:ack | :nack, msg}], as the consumer genserver will use it to ack back to pulsar

Link to this section Summary

Link to this section Types

Specs

state() :: map()

Link to this section Callbacks

Link to this callback

handle_messages(list, state)

Specs

handle_messages(
  [
    %PulsarEx.Pulserl.Structures.ConsumerMessage{
      consumer: term(),
      event_time: term(),
      id: term(),
      ordering_key: term(),
      partition_key: term(),
      payload: term(),
      properties: term(),
      publish_time: term(),
      redelivery_count: term(),
      topic: term()
    }
  ],
  state()
) :: [
  {:ack | :nack,
   %PulsarEx.Pulserl.Structures.ConsumerMessage{
     consumer: term(),
     event_time: term(),
     id: term(),
     ordering_key: term(),
     partition_key: term(),
     payload: term(),
     properties: term(),
     publish_time: term(),
     redelivery_count: term(),
     topic: term()
   }}
]