UNPKG

pegasys-orchestrate

Version:

The PegaSys Orchestrate library provides convenient access to the Codefi Orchestrate API from applications written in server-side JavaScript

30 lines (29 loc) 802 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.KafkaClient = void 0; const events_1 = require("events"); const KafkaJS = require("kafkajs"); /** * @hidden * Kafka client abstract class */ class KafkaClient extends events_1.EventEmitter { /** * Instantiates a new Kafka client * * @param brokers - List of brokers to connect to * @param kafkaConfig - Kafka client configuration */ constructor(kafkaConfig) { super(); this.isReady = false; this.kafka = new KafkaJS.Kafka(Object.assign({ clientId: 'orchestrate-sdk' }, kafkaConfig)); } /** * Returns true if the Producer is ready to produce messages */ ready() { return this.isReady; } } exports.KafkaClient = KafkaClient;