Consume durable history from topic beginning
Some checks failed
deploy / deploy (push) Failing after 27s
Some checks failed
deploy / deploy (push) Failing after 27s
Proof: npm test; node --test test/history-writer-static.test.mjs test/kafka-topics.test.mjs test/environment-status-history.test.mjs; node --check src/apps/history-writer.mjs. Assumptions: Durable history consumers are idempotent by event_id, so from-beginning subscription is safe when a topic has no committed group offset. Still fake: This protects durable event capture for repo-owned Kafka topics; it does not backfill events that were never published to Kafka.
This commit is contained in:
parent
eb81f892e2
commit
8507403b0f
2 changed files with 11 additions and 1 deletions
|
|
@ -106,7 +106,7 @@ const intentRequestOutcomeTopics = new Set([
|
|||
]);
|
||||
|
||||
for (const topic of topics) {
|
||||
await consumer.subscribe({ topic, fromBeginning: false });
|
||||
await consumer.subscribe({ topic, fromBeginning: true });
|
||||
}
|
||||
|
||||
const state = {
|
||||
|
|
|
|||
10
test/history-writer-static.test.mjs
Normal file
10
test/history-writer-static.test.mjs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
const source = readFileSync(new URL('../src/apps/history-writer.mjs', import.meta.url), 'utf8');
|
||||
|
||||
test('history writer consumes from beginning so first events on newly-created topics are durable', () => {
|
||||
assert.match(source, /consumer\.subscribe\(\{ topic, fromBeginning: true \}\)/);
|
||||
assert.doesNotMatch(source, /consumer\.subscribe\(\{ topic, fromBeginning: false \}\)/);
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue