All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alibaba.hologres.kafka.sink.writer.HoloSqlWriter Maven / Gradle / Ivy

There is a newer version: 1.4.3
Show newest version
package com.alibaba.hologres.kafka.sink.writer;

import com.alibaba.hologres.client.HoloClient;
import com.alibaba.hologres.client.Put;
import com.alibaba.hologres.client.exception.HoloClientException;
import com.alibaba.hologres.kafka.conf.HoloSinkConfigManager;
import com.alibaba.hologres.kafka.exception.KafkaHoloException;

/** Holo sql writer: write use holo client put method(insert query). */
public class HoloSqlWriter extends AbstractHoloWriter {
    HoloClient client;

    public HoloSqlWriter(HoloSinkConfigManager configManager) {
        client = configManager.getClient();
    }

    @Override
    public void write(Put put) throws KafkaHoloException {
        try {
            client.put(put);
        } catch (HoloClientException e) {
            throw new KafkaHoloException(e);
        }
    }

    @Override
    public void flush() {
        try {
            client.flush();
        } catch (HoloClientException e) {
            throw new KafkaHoloException(e);
        }
    }

    @Override
    public void close() throws KafkaHoloException {
        if (client != null) {
            client.close();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy