MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / createKafkaEventsConsumer

Function createKafkaEventsConsumer

packages/queue/src/kafka.ts:216–230  ·  view source on GitHub ↗
(options?: {
  groupId?: string;
})

Source from the content-addressed store, hash-verified

214const consumers = new Set<Consumer>();
215
216export const createKafkaEventsConsumer = (options?: {
217 groupId?: string;
218}): Consumer => {
219 const client = getKafka();
220 const consumer = client.consumer({
221 groupId: options?.groupId || KAFKA_CONSUMER_GROUP,
222 sessionTimeout: KAFKA_SESSION_TIMEOUT_MS,
223 heartbeatInterval: KAFKA_HEARTBEAT_INTERVAL_MS,
224 minBytes: KAFKA_MIN_BYTES,
225 maxWaitTimeInMs: KAFKA_MAX_WAIT_MS,
226 maxBytesPerPartition: KAFKA_MAX_BYTES_PER_PARTITION,
227 });
228 consumers.add(consumer);
229 return consumer;
230};
231
232export const disconnectKafka = async (): Promise<void> => {
233 const tasks: Promise<unknown>[] = [];

Callers 1

startKafkaEventsConsumerFunction · 0.90

Calls 3

getKafkaFunction · 0.85
consumerMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected