अन्तःपेटिकाधर्मः। टोकनकुम्भे (१७ नव) प्रवेशः। अत्र उपभोक्ता द्विः मा दहतु। inbox, unique id, same TX। न केवलं outbox; पेटिकाधर्मः।
English (minimizable)
After token buckets (17 Nov), this post covers the inbox pattern: atomic consume with side effects, stable message keys, durable unique gates, retention TTL, reorder tolerance, failure ordering, pairing with outbox and duplicate-hit metrics.
पूर्ण-शीर्षकम् / Full title
अन्तःपेटिकाधर्मः: A Metrical Codification of the Inbox Pattern (with English glosses)
English · overview and topics (minimizable)
What this post is about
Inbox pattern persists consumer-side message ids with business effects so at-least-once delivery does not double-apply work.
Topics covered
- Double delivery risk
- Same TX as side effects
- Stable producer message ids
- Durable unique constraint
- Inbox row TTL
- Reorder-tolerant handlers
- Mark only with success
- Pair with outbox
- Duplicate hit metrics
- Outbox vs inbox vs idempotency keys
Sanskrit title
अन्तःपेटिकाधर्मः = antaḥ-peṭikā-dharmaḥ “dharma of the inner box” (inbox).
English
Minimizable; Sanskrit-first.
परम्परा-सन्धिः / Series links
| पूर्वं / Prior | अत्र / Adds | न पुनः / Does not repeat |
|---|---|---|
| बहिर्लेखनपटलः (२८ सितम्बे) | outbox | producer birth |
| इदमर्थकुञ्चिका (४ अक्टो) | idempotency | shared keys |
| प्रकाशनसदस्यता (२६ अक्टो) | pub/sub | at-least-once |
| टोकनकुम्भधर्मः (१७ नव) | rate limit | prior day |
| इदम् | inbox exactly-once effect | - |
ग्राह्य-त्याज्य-विवेकः / Keep and avoid
ग्राह्यम् / Keep
१. insert inbox id with effects: one local TX
२. use producer message ids: not fragile hashes only
३. unique constraint durable: multi-pod safe
४. TTL/archive inbox rows: bound growth
५. tolerate reorder: across partitions
६. never mark before success: alone
७. pair outbox+inbox: on money paths
त्याज्यम् / Avoid
- check memory set then act without TX
- inbox insert before business commit in separate steps
- unbounded inbox table forever
अध्याय-योजना / Chapter plan
| प्रकरणम् | विषयः | छन्दः | श्लोकाः |
|---|---|---|---|
| १ | मङ्गलं बीजं च / Opening | अनुष्टुभ् | २ |
| २ | मूलतत्त्वानि / Core | अनुष्टुभ् | २ |
| ३ | मुख्यविधिः / Method | उपजाति | १ |
| ४ | रक्षा · विधिः / Guards | अनुष्टुभ् | २ |
| ५ | विवेक · सीमा / Judgment | अनुष्टुभ् | २ |
| ६ | पूर्वसन्धिः / Series links | उपजाति | १ |
| ७ | उपसंहारः / Close | अनुष्टुभ् | २ |
पारिभाषिक-कोशः / Glossary
| Modern English | संस्कृतम् | Note |
|---|---|---|
| inbox | अन्तःपेटिका | |
| outbox | बहिर्लेखनपटलः | |
| at-least-once | न्यूनतमएकवारम् | |
| idempotent consume | अद्वितीय उपभोगः | |
| message id | सन्देशचिह्नम् | |
| unique constraint | अद्वितीयबाधा | |
| duplicate | द्विरुक्तिः | |
| TOCTOU | कालद्वारजातिः | |
| reorder | पुनर्क्रमः | |
| exactly-once effect | एकवारप्रभावः | effect level |
श्लोकः १ (अनुष्टुभ्)
अन्तःपेटिकाधर्मस्तस्माद् द्वारलेखः ॥१॥
पदच्छेदः · Word-for-word · English (minimizable)
पदच्छेदः
बाह्यसन्देशः यदि द्विः पतति तदा द्विकर्म भयम् ।
अन्तःपेटिकाधर्मस्तस्माद् द्वारलेखः ॥१॥
Word-for-word
| संस्कृतपदम् | Word-for-word English |
|---|---|
| बाह्यसन्देशः | external message |
| द्विः | twice |
| पतति | falls |
| द्विकर्म | double work |
| भयम् | fear |
| अन्तःपेटिकाधर्मः | inbox dharma |
| द्वारलेखः | door record |
Gloss table
| पदम् | अर्थः / sense |
|---|---|
| अन्तःपेटिकाधर्मः | inbox dharma |
| द्वारलेखः | door ledger |
English sense
An inbox records processed message ids at the consumer so at-least-once delivery does not become at-least-twice business effects.
Context / topic
Topic: why inbox. Distinct from outbox which guards producer birth of messages.
वृत्तमिति: ८-८-८-८।
श्लोकः २ (अनुष्टुभ्)
check then act race ॥२॥
पदच्छेदः · Word-for-word · English (minimizable)
पदच्छेदः
insert inbox id same TX as side effects ।
check then act race ॥२॥
Word-for-word
| संस्कृतपदम् | Word-for-word English |
|---|---|
| insert | insert |
| inbox | inbox |
| id | id |
| same | same |
| TX | TX |
| side | side |
| effects | effects |
| check | check |
| then | then |
| act | act |
| race | race |
Gloss table
| पदम् | अर्थः / sense |
|---|---|
| same TX | atomic consume |
| check then act | TOCTOU |
English sense
Store the message id in the same local transaction as the business writes. Separate check-then-act races duplicates.
Context / topic
Topic: atomic consume.
वृत्तमिति: ८-८-८-८।
श्लोकः ३ (अनुष्टुभ्)
only payload hash fragile ॥३॥
पदच्छेदः · Word-for-word · English (minimizable)
पदच्छेदः
natural key: producer id + message id ।
only payload hash fragile ॥३॥
Word-for-word
| संस्कृतपदम् | Word-for-word English |
|---|---|
| natural | natural |
| key | key |
| producer | producer |
| id | id |
| message | message |
| id | id |
| only | only |
| payload | payload |
| hash | hash |
| fragile | fragile |
Gloss table
| पदम् | अर्थः / sense |
|---|---|
| producer message id | stable |
| payload hash | collision risk |
English sense
Prefer explicit idempotency keys from the producer. Payload hashes break on legitimate retries with extra fields.
Context / topic
Topic: keys.
वृत्तमिति: ८-८-८-८।
श्लोकः ४ (अनुष्टुभ्)
app memory set multi-pod miss ॥४॥
पदच्छेदः · Word-for-word · English (minimizable)
पदच्छेदः
unique constraint is the gate ।
app memory set multi-pod miss ॥४॥
Word-for-word
| संस्कृतपदम् | Word-for-word English |
|---|---|
| unique | unique |
| constraint | constraint |
| gate | gate |
| app | app |
| memory | memory |
| set | set |
| multi-pod | multi-pod |
| miss | miss |
Gloss table
| पदम् | अर्थः / sense |
|---|---|
| unique constraint | DB truth |
| memory set | per process |
English sense
Enforce inbox uniqueness in durable storage visible to all consumers not only a process-local set.
Context / topic
Topic: durable gate.
वृत्तमिति: ८-८-८-८।
श्लोकः ५ (उपजाति)
कोष ।
infinite grow
मन्दः ॥५॥
पदच्छेदः · Word-for-word · English (minimizable)
पदच्छेदः
TTL cleanup old inbox rows
कोष ।
infinite grow
मन्दः ॥५॥
Word-for-word
| संस्कृतपदम् | Word-for-word English |
|---|---|
| TTL | TTL |
| cleanup | cleanup |
| old | old |
| inbox | inbox |
| rows | rows |
| कोष | store |
| infinite | infinite |
| grow | grow |
| मन्दः | slow |
Gloss table
| पदम् | अर्थः / sense |
|---|---|
| TTL cleanup | bound table |
| infinite grow | bloat |
English sense
Expire or archive inbox rows after the duplicate window. Unbounded inboxes become a new ops patient.
Context / topic
Topic: retention.
वृत्तमिति: एकादशाक्षराः पादाः।
श्लोकः ६ (अनुष्टुभ्)
assume total order always मा ॥६॥
पदच्छेदः · Word-for-word · English (minimizable)
पदच्छेदः
handler must be inbox-aware reorder ।
assume total order always मा ॥६॥
Word-for-word
| संस्कृतपदम् | Word-for-word English |
|---|---|
| handler | handler |
| inbox | inbox |
| aware | aware |
| reorder | reorder |
| assume | assume |
| total | total |
| order | order |
| always | always |
| मा | not |
Gloss table
| पदम् | अर्थः / sense |
|---|---|
| reorder safe | business |
| total order myth | partitions |
English sense
Duplicates and reordering still happen across partitions. Design handlers that tolerate both with inbox help.
Context / topic
Topic: ordering.
वृत्तमिति: ८-८-८-८।
श्लोकः ७ (अनुष्टुभ्)
insert then fail skip forever ॥७॥
पदच्छेदः · Word-for-word · English (minimizable)
पदच्छेदः
poison: fail without inbox insert ।
insert then fail skip forever ॥७॥
Word-for-word
| संस्कृतपदम् | Word-for-word English |
|---|---|
| poison | poison |
| fail | fail |
| without | without |
| inbox | inbox |
| insert | insert |
| insert | insert |
| then | then |
| fail | fail |
| skip | skip |
| forever | forever |
Gloss table
| पदम् | अर्थः / sense |
|---|---|
| fail before mark | retryable |
| mark then fail | poison skip |
English sense
Only mark inbox after successful effects or in the same TX that commits them. Marking before success skips retries forever.
Context / topic
Topic: failure order.
वृत्तमिति: ८-८-८-८।
श्लोकः ८ (अनुष्टुभ्)
one side only residual dual ॥८॥
पदच्छेदः · Word-for-word · English (minimizable)
पदच्छेदः
outbox + inbox ends-to-end ।
one side only residual dual ॥८॥
Word-for-word
| संस्कृतपदम् | Word-for-word English |
|---|---|
| outbox | outbox |
| inbox | inbox |
| ends-to-end | ends-to-end |
| one | one |
| side | side |
| only | only |
| residual | residual |
| dual | dual |
Gloss table
| पदम् | अर्थः / sense |
|---|---|
| both ends | produce and consume |
| one side | gap remains |
English sense
Outbox makes birth atomic with producer state; inbox makes apply atomic with consumer state. Use both on money paths.
Context / topic
Topic: pair with outbox.
वृत्तमिति: ८-८-८-८।
श्लोकः ९ (अनुष्टुभ्)
invisible filter अन्धता ॥९॥
पदच्छेदः · Word-for-word · English (minimizable)
पदच्छेदः
metrics: duplicate hit rate inbox size ।
invisible filter अन्धता ॥९॥
Word-for-word
| संस्कृतपदम् | Word-for-word English |
|---|---|
| metrics | metrics |
| duplicate | duplicate |
| hit | hit |
| rate | rate |
| inbox | inbox |
| size | size |
| invisible | invisible |
| filter | filter |
| अन्धता | blindness |
Gloss table
| पदम् | अर्थः / sense |
|---|---|
| dup hit rate | proves value |
| invisible | no ops |
English sense
Count how often inbox rejects duplicates and how large the table grows.
Context / topic
Topic: observability.
वृत्तमिति: ८-८-८-८।
श्लोकः १० (उपजाति)
अन्तःपेटिका प्रभाव रक्षति ।
इदमर्थकुञ्चिका
सामान्यम् ॥१०॥
पदच्छेदः · Word-for-word · English (minimizable)
पदच्छेदः
आउटबॉक्स जन्म रक्षति
अन्तःपेटिका प्रभाव रक्षति ।
इदमर्थकुञ्चिका
सामान्यम् ॥१०॥
Word-for-word
| संस्कृतपदम् | Word-for-word English |
|---|---|
| आउटबॉक्स | outbox |
| जन्म | birth |
| रक्षति | guards |
| अन्तःपेटिका | inbox |
| प्रभाव | effect |
| रक्षति | guards |
| इदमर्थकुञ्चिका | idempotency key |
| सामान्यम् | common |
Gloss table
| पदम् | अर्थः / sense |
|---|---|
| आउटबॉक्स | outbox |
| इदमर्थकुञ्चिका | idempotency key |
English sense
Outbox guards message birth; inbox guards side effects; idempotency keys are the shared language between them.
Context / topic
Topic: series distinctions.
सन्धिः: पटल जन्म; पेटिका प्रभाव; कुञ्चिका नाम।
वृत्तमिति: एकादशाक्षराः पादाः।
श्लोकः ११ (अनुष्टुभ्)
एभिरन्तःपेटिकाधर्मो द्वारलेखसमन्वितः ॥११॥
पदच्छेदः · Word-for-word · English (minimizable)
पदच्छेदः
atomic-key durable TTL order pair पञ्चकम् ।
एभिरन्तःपेटिकाधर्मो द्वारलेखसमन्वितः ॥११॥
Word-for-word
| संस्कृतपदम् | Word-for-word English |
|---|---|
| atomic-key | atomic-key |
| durable | durable |
| TTL | TTL |
| order | order |
| pair | pair |
| पञ्चकम् | five-set |
Gloss table
| पदम् | अर्थः / sense |
|---|---|
| पञ्चकम् | atomic-key durable TTL order pair |
English sense
Five limbs: same-TX mark, stable ids, durable unique gate, bounded retention and pairing with outbox on critical flows.
Context / topic
Topic: checklist.
वृत्तमिति: ८-८-८-८।
श्लोकः १२ (अनुष्टुभ्)
मितं द्विःपानं क्रियायोग्यं तन्त्रधर्मः स उच्यते ॥१२॥
पदच्छेदः · Word-for-word · English (minimizable)
पदच्छेदः
इत्यन्तःपेटिकाधर्मसारो द्वारलेखसमन्वितः ।
मितं द्विःपानं क्रियायोग्यं तन्त्रधर्मः स उच्यते ॥१२॥
Word-for-word
| संस्कृतपदम् | Word-for-word English |
|---|---|
| इति | thus |
| अन्तःपेटिकाधर्मसारः | inbox essence |
| द्वारलेखः | door ledger |
| मितम् | measured |
| द्विःपानम् | drinking twice |
| क्रियायोग्यम् | operable |
| तन्त्रधर्मः | system dharma |
Gloss table
| पदम् | अर्थः / sense |
|---|---|
| मितं द्विःपानम् | measured double drink |
| तन्त्रधर्मः | platform dharma |
English sense
Closing: drink each message once in business truth even when the network delivers it twice.
Context / topic
Topic: close.
उपसंहारन्यायः: चिह्नं सह प्रतिज्ञा; द्वारं दृढं कुरु; जन्मना सह योजय।
वृत्तमिति: ८-८-८-८।
श्लोकसूची / Verse index
१. Why inbox
२. Atomic TX
३. Keys
४. Durable gate
५. TTL
६. Reorder
७. Fail order
८. Pair outbox
९. Metrics
१०. Series
११. Five limbs
१२. Close
सन्दर्भाः / References
- Prior: outbox 2026-09-28; idempotency 2026-10-04; token bucket 2026-11-17.
- Domain: inbox consumer pattern.
- English minimizable; Sanskrit-first.
- Style: no em dash; no Oxford comma in English clauses.