Search in sources :

Example 6 with FieldType

use of io.openmessaging.connector.api.data.FieldType in project rocketmq-externals by apache.

the class FileSinkTask method put.

@Override
public void put(Collection<SinkDataEntry> sinkDataEntries) {
    for (SinkDataEntry record : sinkDataEntries) {
        Object[] payloads = record.getPayload();
        log.trace("Writing line to {}: {}", logFilename(), payloads);
        Schema schema = record.getSchema();
        List<Field> fields = schema.getFields();
        for (Field field : fields) {
            FieldType type = field.getType();
            if (type.equals(FieldType.STRING)) {
                log.info("Writing line to {}: {}", logFilename(), payloads[field.getIndex()]);
                outputStream.println(String.valueOf(payloads[field.getIndex()]));
            }
        }
    }
}
Also used : Field(io.openmessaging.connector.api.data.Field) SinkDataEntry(io.openmessaging.connector.api.data.SinkDataEntry) Schema(io.openmessaging.connector.api.data.Schema) FieldType(io.openmessaging.connector.api.data.FieldType)

Aggregations

Field (io.openmessaging.connector.api.data.Field)6 FieldType (io.openmessaging.connector.api.data.FieldType)6 Map (java.util.Map)5 PreparedStatement (java.sql.PreparedStatement)3 SQLException (java.sql.SQLException)3 ResultSet (com.datastax.oss.driver.api.core.cql.ResultSet)2 SimpleStatement (com.datastax.oss.driver.api.core.cql.SimpleStatement)2 ResultSet (java.sql.ResultSet)2 Delete (com.datastax.oss.driver.api.querybuilder.delete.Delete)1 DeleteSelection (com.datastax.oss.driver.api.querybuilder.delete.DeleteSelection)1 InsertInto (com.datastax.oss.driver.api.querybuilder.insert.InsertInto)1 RegularInsert (com.datastax.oss.driver.api.querybuilder.insert.RegularInsert)1 Schema (io.openmessaging.connector.api.data.Schema)1 SinkDataEntry (io.openmessaging.connector.api.data.SinkDataEntry)1