Fostrom.Mailbox (Fostrom v0.0.3)
Fostrom.Mailbox
provides manual access to the Device Mailbox.
Usually you'll just implement the Fostrom.Handler
behaviour in your application code,
and handle incoming mail there. However, if you prefer to handle it manually, you can do so
using this module.
Summary
Functions
Acknowledge the Mail.
Fetch the next available mail from the mailbox.
Reject the Mail.
Requeue the Mail.
Fetch the mailbox size and the next mail's ID and name.
Functions
@spec ack(Fostrom.Mail.t()) :: :ok | {:error, Fostrom.Exception.t()}
Acknowledge the Mail.
You would usually acknowledge when you want to signify that the mail was successfully processed by the device.
@spec next() :: {:ok, Fostrom.Mail.t()} | {:ok, nil} | {:error, Fostrom.Exception.t()}
Fetch the next available mail from the mailbox.
@spec reject(Fostrom.Mail.t()) :: :ok | {:error, Fostrom.Exception.t()}
Reject the Mail.
You would usually reject when you want to signify that the mail was not successfully processed by the device.
@spec requeue(Fostrom.Mail.t()) :: :ok | {:error, Fostrom.Exception.t()}
Requeue the Mail.
Requeueing moves the mail to the end of the queue and allows you to process the next mail.
@spec status() :: {:ok, Fostrom.Mailbox.Status.t()} | {:ok, :mailbox_empty} | {:error, Fostrom.Exception.t()}
Fetch the mailbox size and the next mail's ID and name.