GenNotify v0.3.1 GenNotify.Notifier View Source

The GenNotify.Notifier is the background process of GenNotify. This Module is responsible for sending the notifications and keeps track of the recipients.

Do I even need to know about this?

You will not need to interact with this Module directly except for starting it via GenNotify.Notifier.start_link/0. Even this will not be needed if you use the GenNotify.Supervisor.

The only exception is if you want to implement your own Module with the GenNotify Behaviour (not use GenNotify!)

Link to this section Summary

Functions

Adds a new recipient to the list of recipients.

Returns a specification to start this module under a supervisor.

Sends the message to all known recipients. You can also use GenNotify.send_notification/1 as a shortcut.

returns what GenServer.start_link does

Link to this section Functions

Link to this function

add_recipient(recipient)

View Source
add_recipient(pid() | atom()) :: :ok

Adds a new recipient to the list of recipients.

The list of recipients is always unique. If you try to add the same recipient multiple times it will still only be stored once and therefore GenNotify.on_message/1 will only be called once per notification per module/pid.

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

send_notification(message)

View Source
send_notification(any()) :: :ok

Sends the message to all known recipients. You can also use GenNotify.send_notification/1 as a shortcut.

Link to this function

start_link(config \\ [])

View Source

returns what GenServer.start_link does