ARQ (arq v0.3.1) View Source

Dead simple Automatic Request Repeat implementation for independent messages.

Local party sends messages by providing an mfa or a fun/0 to ARQ.start/2.

If mfa or fun returns :stop, the ARQ process will terminate. This is useful for synchronous responses.

Upon receipt of an asynchronous message, remote party can acknowledge the message (and stop its repeat) by calling ARQ.stop/1 or sending :stop to the requestor process.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Starts an ARQ process with the given mfa or fun/0.

Stops the given ARQ process.

Link to this section Types

Specs

opt() :: {:interval, pos_integer()}

Specs

opts() :: [opt()]

Specs

request() :: mfa() | (... -> any())

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

start(request, supervisor, opts \\ [])

View Source

Specs

start(request(), Supervisor.supervisor(), opts()) :: {:ok, pid()}

Starts an ARQ process with the given mfa or fun/0.

You can provide the following options:

  • :interval - number of milliseconds between function invocation repeat.

Specs

stop(GenServer.server()) :: any()

Stops the given ARQ process.