UNPKG

pg-trx-outbox

Version:

Transactional outbox of Postgres for Node.js with little Event Sourcing

20 lines (19 loc) 570 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Poller = void 0; class Poller { pollTimer; options; transfer; constructor(options, transfer) { this.options = options; this.transfer = transfer; } async start() { this.pollTimer = setInterval(() => this.transfer.transferMessages().catch(err => this.options.outboxOptions?.onError?.(err)), this.options.outboxOptions?.pollInterval ?? 5000); } async stop() { clearInterval(this.pollTimer); } } exports.Poller = Poller;