public class LogEventsKafkaEmitter extends Object implements LogEventsEmitter
Log events provide better visibility into the progress of connector, by capturing specific and important events like failures, lifecycle events, config changes, etc. in the form of Kafka events. Further, these events are formatted as per the Cloudevents specification, which makes the consumption and usage of these events more portable and consistent across platforms.
Usage: Each Connect Worker instantiates the LogEventsKafkaEmitter based upon the worker's
configuration. From there, any class that has access to the Worker instance can obtain this
emitter and use the LogEvents
methods to log specific events of interest. Helper class
LogEvents
is provided with static methods which help in construction of ConnectLogEntry
objects and forward them to the emit(ConnectLogEntry,
String, String, String)
. In future, instance of LogEventsEmitter will also be introduced into
WorkerSourceConnectorContext, WorkerSinkConnectorContext, WorkerSourceTaskContext,
WorkerSinkTaskContext objects, enabling the connectors to capture logs of interest in the form of
LogEvents.
Constructor and Description |
---|
LogEventsKafkaEmitter() |
Modifier and Type | Method and Description |
---|---|
void |
emit(ConnectLogEntry connectLogEntry,
String subject,
String source,
String type)
Construct a connect Log Event and emit it to the preconfigured destination.
|
void |
start(Map<String,?> configs)
Start up the event logger.
|
void |
stop()
Needs to be called only once during teardown of the worker.
|
String |
toString() |
public void start(Map<String,?> configs)
configs
- the configs; may not be nullpublic void emit(ConnectLogEntry connectLogEntry, String subject, String source, String type)
LogEventsEmitter
emit
in interface LogEventsEmitter
connectLogEntry
- Payload containing details of the connect log event. May not be null.subject
- From CloudEvents spec. Subject captures what the event is about. May not
be null.source
- From CloudEvents spec. Source captures the context in which the event
happened. May not be null.type
- From CloudEvents spec. Identifies the event type. May not be null.public void stop()