Documentation for a newer release is available.
View Latest
Esta página no está disponible actualmente en Español. Si lo necesita, póngase en contacto con el servicio de asistencia de Icon (correo electrónico)
Kafka MessageLogger
| Before deciding to use a specific logger, it’s worth considering where the message and other data logging fits into your overall strategy. For example if you are using ODS, you should use the MessageLogger implementations provided by IPF Processing Data, specifically see Processing Data egress. |
Message-logger-impl provides a Kafka implementation of MessageLogger, and its specific logMessage implementation is using a SendConnector to send the messageLogEntry to a Kafka topic:
public void logMessage(final MessageLogEntry messageLogEntry) {
sendConnector.send(messageLogEntry.getProcessingContext(), messageLogEntry)
.thenAccept(outcome -> {
var deliveryReport = outcome.getDeliveryReport();
if (deliveryReport.isFailure()) {
log.error("Failed to deliver: {}. Delivery report: {}", messageLogEntry, deliveryReport);
}
})
.exceptionally(e -> {
log.error("Failed to deliver: {}.", messageLogEntry, e);
return null;
})
;
}
This uses the IPF core MessageLogEntry.
The default configuration for this logs messages to a topic called MESSAGE_LOG, but this can be changed via the ipf.conf, defaults shown below:
message.logger {
send-connector {}
kafka {
producer {
topic = MESSAGE_LOG
restart-settings = {
min-backoff = 1s
max-backoff = 5s
random-factor = 0.25
max-restarts = 5
max-restarts-within = 10m
}
kafka-clients {
client.id = message-logger
}
}
}
}
Dependencies
A starter is provided which will wire in both Kafka and Mongo loggers
<dependency>
<groupId>com.iconsolutions.ipf.core.messagelogger</groupId>
<artifactId>message-logger-starter</artifactId>
</dependency>
Alternatively you can bring in the specific Kafka dependency only:
<dependency>
<groupId>com.iconsolutions.ipf.core.messagelogger</groupId>
<artifactId>message-logger-kafka</artifactId>
</dependency>