View Source EchoPubSub.Worker (EchoPubSub v0.2.3)
Receives batches from the producers on other nodes and broadcasts them to this node's subscribers, one worker per pool group.
The worker joins the group's :pg group, which is how producers find it.
It replies :ok to a batch only after broadcasting it locally; the producer
moves that node's read cursor only on that reply.
It also remembers which producer nodes have registered with it, in an ETS
table owned by the adapter supervisor so the record survives a worker
restart. {:register, node, missed_writes?} sends {:cursor_expired, node} to
every local topic when the producer had already flushed writes this node will
not get, or when the worker already knows it (that producer lost this node's
cursor). {:resume, node} only records the producer, and {:expired, node}
always sends the notice.
Summary
Functions
Returns a specification to start this module under a supervisor.
The registered name of the group's worker.
Names the table of producer nodes registered with this group's worker.
Starts the worker for group, broadcasting batches to the name PubSub server.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
The registered name of the group's worker.
Names the table of producer nodes registered with this group's worker.
The adapter supervisor owns the table, so a restarted worker still knows which producers registered before and can tell them apart from new ones.
@spec start_link({atom(), atom()}) :: GenServer.on_start()
Starts the worker for group, broadcasting batches to the name PubSub server.