Stargate.Producer.Acknowledger (stargate v0.1.1) View Source

By default, Stargate.produce/2 will block the calling process until acknowledgement is received from Pulsar that the message was successfully produced. This can optionally switch to an asynchronous acknowledgement by passing an MFA tuple to Stargate.produce/3.

This modules defines a GenServer process that works in tandem with a producer websocket connection to wait for and send receipt acknowledgements received from produce operations to the calling process or otherwise perform asynchronous acknowledgement operations.

Link to this section Summary

Functions

Sends a message to the acknowledger process to perform the ack operation saved for that particular message (as identified by the context sent with the message).

Returns a specification to start this module under a supervisor.

Called by the producer when a message is produced to the Pulsar cluster. This function sends a message's context and the desired operation to perform for acknowledgement to the Acknowledger process to save in its state and act on when directed to acknowledge that message.

Starts a Stargate.Producer.Acknowledger process and link it to the calling process.

Link to this section Functions

Link to this function

ack(acknowledger, response)

View Source

Specs

ack(GenServer.server(), {:ack, term()} | {:error, term(), term()}) :: :ok

Sends a message to the acknowledger process to perform the ack operation saved for that particular message (as identified by the context sent with the message).

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

produce(acknowledger, ctx, ack)

View Source

Specs

produce(GenServer.server(), String.t(), pid() | tuple()) :: :ok

Called by the producer when a message is produced to the Pulsar cluster. This function sends a message's context and the desired operation to perform for acknowledgement to the Acknowledger process to save in its state and act on when directed to acknowledge that message.

Unless instructed otherwise by calling Stargate.produce/3, Stargate.produce/2 assumes the third argument to be the PID of the calling process to send receipt confirmation and unblock.

Specs

start_link(keyword()) :: GenServer.on_start()

Starts a Stargate.Producer.Acknowledger process and link it to the calling process.