io.edurt.datacap.plugin.natived.kafka.KafkaAdapter Maven / Gradle / Ivy
The newest version!
package io.edurt.datacap.plugin.natived.kafka;
import com.google.common.base.Preconditions;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.edurt.datacap.spi.adapter.NativeAdapter;
import io.edurt.datacap.spi.model.Configure;
import io.edurt.datacap.spi.model.Response;
import io.edurt.datacap.spi.model.Time;
import io.edurt.datacap.sql.SqlBase;
import io.edurt.datacap.sql.SqlBaseToken;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.ConsumerGroupDescription;
import org.apache.kafka.clients.admin.DescribeConsumerGroupsResult;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@Slf4j
@SuppressFBWarnings(value = {"RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE", "REC_CATCH_EXCEPTION"},
justification = "I prefer to suppress these FindBugs warnings")
public class KafkaAdapter
extends NativeAdapter
{
protected KafkaConnection kafkaConnection;
private final KafkaParser parser;
public KafkaAdapter(KafkaConnection kafkaConnection, KafkaParser parser)
{
super(kafkaConnection, parser);
this.kafkaConnection = kafkaConnection;
this.parser = parser;
}
@Override
public Response handlerExecute(String content)
{
Time processorTime = new Time();
processorTime.setStart(new Date().getTime());
Response response = this.kafkaConnection.getResponse();
Configure configure = this.kafkaConnection.getConfigure();
if (response.getIsConnected()) {
List headers = new ArrayList<>();
List types = new ArrayList<>();
List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy