UNPKG

@ydbjs/topic

Version:

YDB Topics client for publish-subscribe messaging. Provides at-least-once delivery, exactly-once publishing, FIFO guarantees, and scalable message processing for unstructured data.

21 lines 780 B
import { _flush } from "./_flush.js"; export const _on_write_response = function on_write_response(ctx, input) { // Process each acknowledgment in the response. let acks = new Map(); for (let ack of input.acks) { acks.set(ack.seqNo, ack.messageWriteStatus.case); } // Acknowledge messages that have been processed. for (let i = ctx.inflight.length - 1; i >= 0; i--) { const message = ctx.inflight[i]; if (acks.has(message.seqNo)) { ctx.onAck?.(message.seqNo, acks.get(message.seqNo)); ctx.inflight.splice(i, 1); } } // Clear the acknowledgment map. acks.clear(); // If there are still messages in the buffer, flush them. _flush(ctx); }; //# sourceMappingURL=_write_response.js.map