private HiveProducerRecord convertTo(Record record) throws Exception { Map<String, Object> rawValue = record.getValueRaw(); //Set partition values for hive table Map<String, String> partitionKVs = Maps.newHashMapWithExpectedSize(1); partitionKVs.put(TimePropertyEnum.DAY_DATE.toString(), rawValue.get(TimePropertyEnum.DAY_DATE.toString()).toString()); return parseToHiveProducerRecord(HiveReservoirReporter.getTableFromSubject(record.getType()), partitionKVs, rawValue); }
public boolean onRecordUpdate(final List<Record> records) { try { for (Record record : records) { String topic = decorateTopic(record.getType()); if (!checkAvailable(topic)) { if (nRecordSkip % maxRecordSkipForLogNum == 0) { nRecordSkip = 0; logger.warn("Skip to send record to topic " + topic); } nRecordSkip++; continue; } if (nRecord % maxRecordForLogNum == 0) { nRecord = 0; sendWrapper(topic, record, produceCallback); } else { sendWrapper(topic, record, null); } nRecord++; } } catch (Exception e) { logger.error(e.getMessage(), e); return false; } return true; }