e_poller v0.1.1 EPoller View Source

This module serves to enable clients to initialize polling processes and have them poll on their own schedule.

Link to this section Summary

Types

A handler function that acts on each message to process it. If the handler doesn’t throw an exception for the message it’s processing, the message is deleted off the queue

A string represnting the queue’s name

Functions

Polls the queue with the config for the process assigned to pid

Initializes a queue poller with the given queue_name, message_handler, and config

Link to this section Types

Link to this type handler() View Source
handler() :: (String.t() -> any())

A handler function that acts on each message to process it. If the handler doesn’t throw an exception for the message it’s processing, the message is deleted off the queue.

Link to this type queue_name() View Source
queue_name() :: String.t()

A string represnting the queue’s name

Link to this section Functions

Link to this function poll(pid) View Source
poll(PID) :: {:ok, map()}

Polls the queue with the config for the process assigned to pid.

For each message in the polling result this function:

  1. Calls the handler on that message
  2. Deletes the message from the queue (provided the handler doesn’t throw an exception)

Returns {:ok, map}

Link to this function start_link(queue_name, handler, config \\ []) View Source
start_link(queue_name(), handler(), EPoller.Config.poller_config_opts()) :: {:ok, PID}

Initializes a queue poller with the given queue_name, message_handler, and config.

Returns {:ok, PID}