Search in sources :

Example 1 with KafkaConnectFieldWriter

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());
    }
}
Also used : KafkaConnectFieldWriter(io.atlasmap.kafkaconnect.core.KafkaConnectFieldWriter)

Example 2 with KafkaConnectFieldWriter

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);
}
Also used : Field(io.atlasmap.v2.Field) KafkaConnectEnumField(io.atlasmap.kafkaconnect.v2.KafkaConnectEnumField) KafkaConnectField(io.atlasmap.kafkaconnect.v2.KafkaConnectField) FieldGroup(io.atlasmap.v2.FieldGroup) KafkaConnectFieldWriter(io.atlasmap.kafkaconnect.core.KafkaConnectFieldWriter)

Example 3 with KafkaConnectFieldWriter

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());
    }
}
Also used : KafkaConnectFieldWriter(io.atlasmap.kafkaconnect.core.KafkaConnectFieldWriter)

Aggregations

KafkaConnectFieldWriter (io.atlasmap.kafkaconnect.core.KafkaConnectFieldWriter)3 KafkaConnectEnumField (io.atlasmap.kafkaconnect.v2.KafkaConnectEnumField)1 KafkaConnectField (io.atlasmap.kafkaconnect.v2.KafkaConnectField)1 Field (io.atlasmap.v2.Field)1 FieldGroup (io.atlasmap.v2.FieldGroup)1