UNPKG

@restorecommerce/chassis-srv

Version:

Restore Commerce microservice chassis

42 lines 1.45 kB
import { Events, Topic } from '@restorecommerce/kafka-client'; import { RedisClientType } from 'redis'; import { type ServiceConfig } from '@restorecommerce/service-config'; import { type Logger } from '@restorecommerce/logger'; /** * Stores the offsets of the provided topics to redis periodically */ export declare class OffsetStore { protected readonly kafkaEvents: Events; protected readonly config: ServiceConfig; protected readonly logger?: Logger; protected readonly redisClient?: RedisClientType; protected readonly timerID: NodeJS.Timeout[]; protected readonly prefix: string; constructor(kafkaEvents: Events, config: ServiceConfig, logger?: Logger, redisClient?: RedisClientType); /** * updates the topic offset in redis periodically * */ updateTopicOffsets(): Promise<void>; /** * stores the offset to redis * @param {object} topic Topic object * @param {object} redisClient * @return {object} */ storeOffset(topic: Topic, topicName: string): Promise<void>; /** * get the offset value for the topic from redis * @param {string} topic Topic name * @return {object} */ getOffset(topicName: string): Promise<bigint>; /** * stops the redis client * @param {object} topic Topic object * @param {object} redisClient * @return {object} */ stop(): Promise<void>; } //# sourceMappingURL=index.d.ts.map