Search in sources :

Example 1 with InterfaceTopicHandleStrategy

use of com.huawei.flowrecordreplay.console.rtc.consumer.strategy.InterfaceTopicHandleStrategy in project Sermant by huaweicloud.

the class RtcConsumer method logicProcess.

private void logicProcess(String topic, List<ConsumerRecord<String, String>> records, TopicPartition topicPartition) {
    InterfaceTopicHandleStrategy handler = topicHandleStrategyFactory.getTopicHandleStrategy(topic);
    try {
        handler.handleRecordByTopic(records);
        // 实时记录redis中各分区的消费偏移量offset
        String offset = String.valueOf(records.get(records.size() - 1).offset() + 1);
        redisUtil.set(topicPartition.topic() + ":" + topicPartition.partition(), offset);
        LOGGER.debug("real time partition:{}, offset:{}", topicPartition, offset);
    } catch (RedisException ex) {
        LOGGER.error("task process error", ex);
    }
}
Also used : InterfaceTopicHandleStrategy(com.huawei.flowrecordreplay.console.rtc.consumer.strategy.InterfaceTopicHandleStrategy) RedisException(io.lettuce.core.RedisException)

Aggregations

InterfaceTopicHandleStrategy (com.huawei.flowrecordreplay.console.rtc.consumer.strategy.InterfaceTopicHandleStrategy)1 RedisException (io.lettuce.core.RedisException)1