You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* Since SourceConfig & SinkConfig inherit form common/Config they also both inherit from EventEmitter.*/constconfig=newSourceConfig(..)||newSinkConfig(..);// "error" -> when an error occures (has a default listener)config.on("error",error=>..);// "produced" -> when a kafka message is producedconfig.on("produced",messageKey=>..);// "consumed" -> when a kafka message is consumedconfig.on("consumed",messageKey=>..);// "empty" -> when a kafka message is ignored, because its record content was null or "null"config.on("empty",messageKey=>..);// "request" -> when a web request is receivedconfig.on("request",({method, url, headers, body})=>..);// others:// "get-stats" -> whenever the base-config asks for the current kafka stats// "consumer-stats" -> sink consumer kafka stats (when triggered by "get-stats")// "producer-stats" -> source producer kafka stats (when triggered by "get-stats")
Suggested Events for Connectors
/* Connectors and Tasks do receive a reference to the "parentConfig" instance (that inherits from EE) in the .start() methods as optional third parameter this instance can be used to subscripe and to publish events to the base EE. its suggest to emit the following events:*/// "model-upsert" -> whenever a model is to be upserted in a sink taskparentConfig.emit("model-upsert","id");// "model-delete" -> whenever a model is to be deleted in a sink taskparentConfig.emit("model-delete","id");// "record-read" -> whenever a record is polled from db in a source taskparentConfig.emit("record-read","key");
Adding Custom Stats to /admin/stats
//listen for a stats requestconfig.on("get-stats",()=>{conststatsKey="postgres";conststatsValue={connections: 5,otherStuff: {}};//emit stats event with key and valueconfig.emit("any-stats",statsKey,statsValue);});