Liking cljdoc? Tell your friends :D

ottla.connection

A single database connection, opened from a conn-map, that is replaced after it fails. Used by listeners and workers, which each need a session of their own: the listener for LISTEN, the worker for its group's advisory lock.

After a failure, the next connection is opened no sooner than reconnect-ms later. connection! doesn't wait for that: it returns nil until then, and wait-ms says how long is left, for callers that would rather sleep.

A connection is meant to be used from one thread at a time. Closing it (.close, or ottla.protocols/graceful-shutdown) and status may be called from any thread.

A single database connection, opened from a conn-map, that is replaced
after it fails. Used by listeners and workers, which each need a session
of their own: the listener for LISTEN, the worker for its group's
advisory lock.

After a failure, the next connection is opened no sooner than
`reconnect-ms` later. `connection!` doesn't wait for that: it returns
nil until then, and `wait-ms` says how long is left, for callers that
would rather sleep.

A connection is meant to be used from one thread at a time. Closing it
(`.close`, or `ottla.protocols/graceful-shutdown`) and `status` may be
called from any thread.
raw docstring

ottla.consumer

A consumer is a worker (see ottla.worker) plus what wakes it: a poll schedule and, optionally, a listener's notifications. The listener is either the consumer's own or shared with other consumers.

A consumer is a worker (see `ottla.worker`) plus what wakes it: a poll
schedule and, optionally, a listener's notifications. The listener is
either the consumer's own or shared with other consumers.
raw docstring

ottla.listener

A LISTEN/NOTIFY connection that can be shared by many consumers.

Every topic's trigger NOTIFYs on one channel, ottla, with the payload <topic>:<eid>, so a listener LISTENs once per connection and routes notifications to its subscribers by topic. Subscribing and unsubscribing never touch the connection.

The listener runs a single long-lived loop task on an ExecutorService (by default one of its own, with a single thread). The loop owns the connection, so the connection is never used concurrently. Each pass dispatches any pending notifications.

A LISTEN/NOTIFY connection that can be shared by many consumers.

Every topic's trigger NOTIFYs on one channel, `ottla`, with the payload
`<topic>:<eid>`, so a listener LISTENs once per connection and routes
notifications to its subscribers by topic. Subscribing and
unsubscribing never touch the connection.

The listener runs a single long-lived loop task on an ExecutorService
(by default one of its own, with a single thread). The loop owns the
connection, so the connection is never used concurrently. Each pass
dispatches any pending notifications.
raw docstring

ottla.protocols

Protocols shared by ottla's long-running components: consumers, their workers, and listeners.

Protocols shared by ottla's long-running components: consumers, their
workers, and listeners.
raw docstring

ottla.specs

Specs for the core API of ottla

Specs for the core API of ottla
raw docstring

ottla.worker

A worker fetches and handles one consumer group's records, a batch at a time, on a thread of its own. It knows nothing about where wake-ups come from: a consumer wakes it from a listener's notifications and from a poll schedule.

Wake-ups coalesce: at most one is queued behind the batch in progress, and a newer one replaces it. A batch that comes back full queues another fetch straight away, since there are likely more records; in :manual commit mode, only if the handler committed some of it.

Only one worker per group is active at a time. Each worker keeps a connection of its own (an ottla.connection, which it replaces if it breaks), and fetches only while that connection's session holds the group's advisory lock (see ottla.postgresql/try-lock-subscription). The other workers in the group are standbys: on each wake-up they try the lock, and the first to get it once the active worker's session ends takes over. Since the lock and the fetches share a session, a worker that loses its connection loses the lock along with it, and can't fetch without it.

A worker fetches and handles one consumer group's records, a batch at a
time, on a thread of its own. It knows nothing about where wake-ups come
from: a consumer wakes it from a listener's notifications and from a
poll schedule.

Wake-ups coalesce: at most one is queued behind the batch in progress,
and a newer one replaces it. A batch that comes back full queues another
fetch straight away, since there are likely more records; in `:manual`
commit mode, only if the handler committed some of it.

Only one worker per group is active at a time. Each worker keeps a
connection of its own (an `ottla.connection`, which it replaces if it
breaks), and fetches only while that connection's session holds the
group's advisory lock (see
`ottla.postgresql/try-lock-subscription`). The other workers in the group
are standbys: on each wake-up they try the lock, and the first to get it
once the active worker's session ends takes over. Since the lock and the
fetches share a session, a worker that loses its connection loses the
lock along with it, and can't fetch without it.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close