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

com.jeesuite.kafka.consumer.ConsumerContext Maven / Gradle / Ivy

There is a newer version: 1.3.6
Show newest version
/**
 * 
 */
package com.jeesuite.kafka.consumer;

import java.util.Map;
import java.util.Properties;

import com.jeesuite.kafka.handler.MessageHandler;
import com.jeesuite.kafka.handler.OffsetLogHanlder;

/**
 * @description 
* @author vakin * @date 2017年2月10日 */ public class ConsumerContext { private String groupId; private String consumerId; private OffsetLogHanlder offsetLogHanlder; private Properties configs; private Map messageHandlers; private int maxProcessThreads; public ConsumerContext(Properties configs, String groupId, String consumerId, Map messageHandlers, int maxProcessThreads) { super(); this.configs = configs; this.groupId = groupId; this.consumerId = consumerId; this.messageHandlers = messageHandlers; this.maxProcessThreads = maxProcessThreads; } public String getGroupId() { return groupId; } public String getConsumerId() { return consumerId; } public Properties getProperties() { return configs; } public Map getMessageHandlers() { return messageHandlers; } public int getMaxProcessThreads() { return maxProcessThreads; } public void setOffsetLogHanlder(OffsetLogHanlder offsetLogHanlder) { this.offsetLogHanlder = offsetLogHanlder; } public OffsetLogHanlder getOffsetLogHanlder() { return offsetLogHanlder; } public long getLatestProcessedOffsets(String topic,int partition){ return offsetLogHanlder != null ? offsetLogHanlder.getLatestProcessedOffsets(groupId, topic, partition) : -1; } public void saveOffsetsBeforeProcessed(String topic,int partition,long offset){ if(offsetLogHanlder != null){ offsetLogHanlder.saveOffsetsBeforeProcessed(groupId, topic, partition, offset); } } public void saveOffsetsAfterProcessed(String topic,int partition,long offset){ if(offsetLogHanlder != null){ offsetLogHanlder.saveOffsetsAfterProcessed(groupId, topic, partition, offset); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy