eredis_sub (eredis v2.6.2)

Link to this section Summary

Functions

acknowledge the receipt of a pubsub message. each pubsub message must be acknowledged before the next one is received
Returns the channels the given client is currently subscribing to. Note: this list is based on the channels at startup and any channel added during runtime. It might not immediately reflect the channels Redis thinks the client is subscribed to.

Make the calling process the controlling process. The controlling process received pubsub-related messages, of which there are three kinds. In each message, the pid refers to the eredis client process.

Make the given process (pid) the controlling process.
Make the given process (pid) the controlling process subscriber with the given Timeout.
Pattern subscribe to the given channels. Returns immediately. The result will be delivered to the controlling process as any other message. Delivers {subscribed, Channel::binary(), pid()}
Callback for starting from poolboy
Subscribe to the given channels. Returns immediately. The result will be delivered to the controlling process as any other message. Delivers {subscribed, Channel::binary(), pid()}

Link to this section Types

Specs

channel() :: binary().
Link to this type

eredis_queue/0

Specs

eredis_queue() :: queue:queue().

Specs

sub_args() :: [sub_option()].
Link to this type

sub_option/0

Specs

sub_option() ::
    eredis:option() |
    {max_queue_size, non_neg_integer() | infinity} |
    {queue_behaviour, drop | exit}.

Link to this section Functions

Link to this function

ack_message(Client)

Specs

ack_message(Client :: pid()) -> ok.
acknowledge the receipt of a pubsub message. each pubsub message must be acknowledged before the next one is received
Link to this function

channels(Client)

Returns the channels the given client is currently subscribing to. Note: this list is based on the channels at startup and any channel added during runtime. It might not immediately reflect the channels Redis thinks the client is subscribed to.
Link to this function

controlling_process(Client)

Specs

controlling_process(Client :: pid()) -> ok.

Make the calling process the controlling process. The controlling process received pubsub-related messages, of which there are three kinds. In each message, the pid refers to the eredis client process.

{message, Channel::binary(), Message::binary(), pid()} This is sent for each pubsub message received by the client.

{pmessage, Pattern::binary(), Channel::binary(), Message::binary(), pid()} This is sent for each pattern pubsub message received by the client.

{dropped, NumMessages::integer(), pid()} If the queue reaches the max size as specified in start_link and the behaviour is to drop messages, this message is sent when the queue is flushed.

{subscribed, Channel::binary(), pid()} When using eredis_sub:subscribe(pid()), this message will be sent for each channel Redis aknowledges the subscription. The opposite, 'unsubscribed' is sent when Redis aknowledges removal of a subscription.

{eredis_disconnected, pid()} This is sent when the eredis client is disconnected from redis.

{eredis_connected, pid()} This is sent when the eredis client reconnects to redis after an existing connection was disconnected.

Any message of the form {message, _, _, _} must be acknowledged before any subsequent message of the same form is sent. This prevents the controlling process from being overrun with redis pubsub messages. See ack_message/1.
Link to this function

controlling_process(Client, Pid)

Specs

controlling_process(Client :: pid(), Pid :: pid()) -> ok.
Make the given process (pid) the controlling process.
Link to this function

controlling_process(Client, Pid, Timeout)

Make the given process (pid) the controlling process subscriber with the given Timeout.
Link to this function

psubscribe(Client, Channels)

Specs

psubscribe(pid(), [channel()]) -> ok.
Pattern subscribe to the given channels. Returns immediately. The result will be delivered to the controlling process as any other message. Delivers {subscribed, Channel::binary(), pid()}
Link to this function

punsubscribe(Client, Channels)

Link to this function

start_link(Args)

Specs

start_link(sub_args()) -> {ok, Pid :: pid()} | {error, Reason :: term()}.
Callback for starting from poolboy
Link to this function

start_link(Host, Port, Password)

Link to this function

start_link(Transport, Host, Port, Password)

Link to this function

start_link(Host, Port, Password, ReconnectSleep, MaxQueueSize, QueueBehaviour)

Link to this function

start_link(Transport, Host, Port, Password, ReconnectSleep, MaxQueueSize, QueueBehaviour)

Link to this function

subscribe(Client, Channels)

Specs

subscribe(pid(), [channel()]) -> ok.
Subscribe to the given channels. Returns immediately. The result will be delivered to the controlling process as any other message. Delivers {subscribed, Channel::binary(), pid()}
Link to this function

unsubscribe(Client, Channels)