优化单机模式落地方式
This commit is contained in:
@@ -121,28 +121,6 @@ public class SingleHttpSource extends RichHttpSourceFunction<Map<String, byte[]>
|
||||
ctx.collect(knowledgeFileCache);
|
||||
}
|
||||
}
|
||||
// ArrayList<CustomFile> customFiles = new ArrayList<>();
|
||||
// List<KnowledgeLog> knowledgeInfo = jsonMapperInstance.fromJson(configMsg, listType);
|
||||
// for (KnowledgeLog knowledgeLog : knowledgeInfo) {
|
||||
// String fileName = knowledgeLog.getName().concat(".").concat(knowledgeLog.getFormat());
|
||||
// String sha256 = knowledgeLog.getSha256();
|
||||
// String filePath = knowledgeLog.getPath();
|
||||
// String version = knowledgeLog.getVersion();
|
||||
// if (updateMap.containsKey(fileName)){
|
||||
// if ((!sha256.equals(updateMap.get(fileName)))&& ("latest".equals(version))){
|
||||
// CustomFile customFile = loadKnowledge(fileName, filePath);
|
||||
// customFiles.add(customFile);
|
||||
// updateMap.put(fileName,sha256);
|
||||
// }
|
||||
// }else {
|
||||
// updateMap.put(fileName, sha256);
|
||||
// CustomFile customFile = loadKnowledge(fileName, filePath);
|
||||
// customFiles.add(customFile);
|
||||
// }
|
||||
// }
|
||||
//// customFiles=loadKnowledge(configMsg);
|
||||
//// ctx.collectWithTimestamp(customFiles,System.currentTimeMillis());
|
||||
// ctx.collect(customFiles);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("监听nacos配置失败", e);
|
||||
@@ -221,6 +199,8 @@ private void loadKnowledge(ArrayList<Object> metaList) {
|
||||
outputStream = new FileOutputStream(file);
|
||||
byte[] bytes = IOUtils.toByteArray(inputStream);
|
||||
knowledgeFileCache.put(fileName, bytes);
|
||||
inputStream=new ByteArrayInputStream(bytes);
|
||||
IoUtil.copy(inputStream, outputStream);
|
||||
} catch (IOException ioException) {
|
||||
ioException.printStackTrace();
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user