use of io.atlasmap.kafkaconnect.core.KafkaConnectFieldWriter in project atlasmap by atlasmap.
the class KafkaConnectModule method processPreTargetExecution.
@Override
public void processPreTargetExecution(AtlasInternalSession session) throws AtlasException {
KafkaConnectFieldWriter writer = new KafkaConnectFieldWriter(getConversionService());
writer.setSchema(extractSchema(getDataSourceMetadata()));
session.setFieldWriter(getDocId(), writer);
if (LOG.isDebugEnabled()) {
LOG.debug("{} processPreTargetExcution completed", getDocId());
}
}
use of io.atlasmap.kafkaconnect.core.KafkaConnectFieldWriter in project atlasmap by atlasmap.
the class KafkaConnectModule method writeTargetValue.
@Override
public void writeTargetValue(AtlasInternalSession session) throws AtlasException {
KafkaConnectFieldWriter writer = session.getFieldWriter(getDocId(), KafkaConnectFieldWriter.class);
if (session.head().getTargetField() instanceof FieldGroup) {
FieldGroup targetFieldGroup = (FieldGroup) session.head().getTargetField();
if (targetFieldGroup.getField().size() > 0) {
for (Field f : targetFieldGroup.getField()) {
session.head().setTargetField(f);
writer.write(session);
}
return;
}
}
writer.write(session);
}
use of io.atlasmap.kafkaconnect.core.KafkaConnectFieldWriter in project atlasmap by atlasmap.
the class KafkaConnectModule method processPostTargetExecution.
@Override
public void processPostTargetExecution(AtlasInternalSession session) throws AtlasException {
KafkaConnectFieldWriter writer = session.getFieldWriter(getDocId(), KafkaConnectFieldWriter.class);
if (writer != null && writer.getDocument() != null) {
Object outputBody = writer.getDocument();
session.setTargetDocument(getDocId(), outputBody);
} else {
AtlasUtil.addAudit(session, getDocId(), String.format("No target document created for DataSource:[id=%s, uri=%s]", getDocId(), this.getUri()), AuditStatus.WARN, null);
}
session.removeFieldWriter(getDocId());
if (LOG.isDebugEnabled()) {
LOG.debug("{}: processPostTargetExecution completed", getDocId());
}
}
Aggregations