shibd commented on code in PR #15693:
URL: https://github.com/apache/pulsar/pull/15693#discussion_r887451594
##########
pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/functions/FunctionUtils.java:
##########
@@ -98,24 +95,29 @@ public static Functions searchForFunctions(String
functionsDirectory, boolean al
try (DirectoryStream<Path> stream = Files.newDirectoryStream(path,
"*.nar")) {
for (Path archive : stream) {
try {
- FunctionDefinition cntDef =
FunctionUtils.getFunctionDefinition(archive.toString());
+
+ NarClassLoader ncl = NarClassLoaderBuilder.builder()
+ .narFile(new File(archive.toString()))
+ .build();
+
+ FunctionArchive.FunctionArchiveBuilder
functionArchiveBuilder = FunctionArchive.builder();
+ FunctionDefinition cntDef =
FunctionUtils.getFunctionDefinition(ncl);
log.info("Found function {} from {}", cntDef, archive);
- log.error(cntDef.getName());
- log.error(cntDef.getFunctionClass());
+
+ functionArchiveBuilder.archivePath(archive);
+
+ functionArchiveBuilder.classLoader(ncl);
+ functionArchiveBuilder.functionDefinition(cntDef);
+
if (alwaysPopulatePath ||
!StringUtils.isEmpty(cntDef.getFunctionClass())) {
- functions.functions.put(cntDef.getName(), archive);
+ functions.put(cntDef.getName(),
functionArchiveBuilder.build());
}
-
- functions.functionsDefinitions.add(cntDef);
Review Comment:
Thanks for your confirm.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]