First key of the two-key advisory lock taken by appends. Namespaces ottla's locks away from application advisory locks; the second key is the topic table's oid.
First key of the two-key advisory lock taken by appends. Namespaces ottla's locks away from application advisory locks; the second key is the topic table's oid.
First key of the two-key session advisory lock a consumer holds while
it's its group's active consumer. The second key is the subscription's
sid.
First key of the two-key session advisory lock a consumer holds while it's its group's active consumer. The second key is the subscription's `sid`.
(create-subscription {:keys [conn schema] :as config}
{:keys [topic group]}
&
{:keys [from]})Create a subscription for topic/group. Throws ex-info with {:topic ... :group ...} if a subscription already exists.
Create a subscription for topic/group. Throws ex-info with
{:topic ... :group ...} if a subscription already exists.(create-topic {:keys [conn schema]}
topic
&
{:keys [key-type value-type index-key?]
:as opts
:or {key-type :bytea value-type :bytea index-key? false}})(delete-subscription {:keys [conn schema]} {:keys [topic group]})Delete a subscription for topic/group. Returns true if a subscription was deleted, false if none existed.
Delete a subscription for topic/group. Returns true if a subscription was deleted, false if none existed.
(ensure-subscription {:keys [conn schema] :as config}
{:keys [topic group]}
&
{:keys [from]})Create a subscription for topic/group if one does not already exist. Returns true if created, false if it already existed. The :from option only applies when creating; an existing subscription is not modified.
Create a subscription for topic/group if one does not already exist. Returns true if created, false if it already existed. The :from option only applies when creating; an existing subscription is not modified.
(ensure-topic {:keys [conn] :as config}
topic-name
&
{:keys [key-type value-type]
:as opts
:or {key-type :bytea value-type :bytea}})Fetch or create a topic. Returns the existing topic if it already exists with the same key-type and value-type. Throws if the topic exists but was created with different column types. Note: opts apply only at creation time and cannot be used to change an existing topic.
Fetch or create a topic. Returns the existing topic if it already exists with the same key-type and value-type. Throws if the topic exists but was created with different column types. Note: opts apply only at creation time and cannot be used to change an existing topic.
(fetch-cursor {:keys [conn schema]} {:keys [topic group]})The cursor of the subscription for topic/group, or nil if there is none.
The cursor of the subscription for topic/group, or nil if there is none.
(fetch-records* {:keys [conn schema] :as config}
{:keys [topic group commit-mode] :as selection})(insert-records {:keys [conn conn-map schema] :as cfg}
topic
records
&
{:keys [serialize-key serialize-value] :as opts})Insert records into a topic. topic is a topic name, or a topic map
with :topic, :key-type, and :value-type; passing a map skips the
topic lookup.
Insert records into a topic. `topic` is a topic name, or a topic map with `:topic`, `:key-type`, and `:value-type`; passing a map skips the topic lookup.
The channel every topic's trigger NOTIFYs on, with the payload
<topic>:<eid> (see parse-notification).
The channel every topic's trigger NOTIFYs on, with the payload `<topic>:<eid>` (see `parse-notification`).
(parse-notification payload)Parse a notification payload of the form <topic>:<eid> into
[topic eid]. The topic is everything before the last colon; eid is
nil if what follows isn't a long. Returns nil if there is no colon.
Parse a notification payload of the form `<topic>:<eid>` into `[topic eid]`. The topic is everything before the last colon; eid is nil if what follows isn't a long. Returns nil if there is no colon.
Fillfactor for the subs table. Each fetch updates its group's row (cursor, updated_at), and neither column is indexed, so with room left on the page those updates can be HOT updates, which skip index maintenance and are pruned without waiting for vacuum. The table has one small row per group, so leaving half of each page free is cheap.
Fillfactor for the subs table. Each fetch updates its group's row (cursor, updated_at), and neither column is indexed, so with room left on the page those updates can be HOT updates, which skip index maintenance and are pruned without waiting for vacuum. The table has one small row per group, so leaving half of each page free is cheap.
(topic-subscriptions {:keys [conn] :as config} & [{:keys [selections]}])Returns all topics with their consumer group subscriptions nested under each
topic. Unlike list-subscriptions, every topic appears in the result even if
it has no subscribers.
Each entry is a map with:
Each subscription map contains the same keys as list-subscriptions (except
:topic, which is on the outer map):
Returns all topics with their consumer group subscriptions nested under each
topic. Unlike `list-subscriptions`, every topic appears in the result even if
it has no subscribers.
Each entry is a map with:
- :topic the topic name
- :subscriptions a vector of subscription maps (empty when no subscribers)
Each subscription map contains the same keys as `list-subscriptions` (except
:topic, which is on the outer map):
- :group consumer group id
- :offset last committed eid for this group
- :topic-eid highest eid available in the topic
- :lag topic-eid - offset: an upper bound on unread records, since eids can have gaps
- :updated-at java.time.Instant of the last offset commit (nil if never committed)
- :timestamp java.time.Instant of the last consumed record (nil if offset is 0)
- :topic-timestamp java.time.Instant of the latest record in the topic (nil if empty)
- :timestamp-lag java.time.Duration between subscription and topic timestamps (nil if either is nil)
- :processing-delay java.time.Duration from publish time to consumer commit for the most
recently consumed record (nil if either :updated-at or :timestamp is nil)(trim-topic {:keys [conn schema] :as config}
topic
&
{:keys [before-eid before-timestamp all? ignore-subscriptions?]
:or {ignore-subscriptions? false}})(try-lock-subscription {:keys [conn schema]} {:keys [topic group]})Try to take the session advisory lock for the subscription for
topic/group on conn, without waiting. Returns the subscription's sid
if this session now holds the lock, or nil if another session holds it
or there is no such subscription. Each success must be matched by one
unlock-subscription (or by closing the session).
Try to take the session advisory lock for the subscription for topic/group on `conn`, without waiting. Returns the subscription's `sid` if this session now holds the lock, or nil if another session holds it or there is no such subscription. Each success must be matched by one `unlock-subscription` (or by closing the session).
(unlock-subscription {:keys [conn]} sid)Release the session advisory lock taken by try-lock-subscription for
the subscription with sid.
Release the session advisory lock taken by `try-lock-subscription` for the subscription with `sid`.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |