Ingestion queue enabled

This commit is contained in:
andrea.terzani
2025-04-14 09:38:02 +02:00
parent 49037803c7
commit 41a8a83054
2 changed files with 25 additions and 1 deletions

View File

@@ -9,7 +9,7 @@ ARG JAR_FILE=target/apollo-0.0.1-SNAPSHOT.jar
# Add the application's jar to the container
ADD ${JAR_FILE} /apollo.jar
ENV JAVA_OPTS="-Xms4096m -Xmx6g -Xss2048m"
ENV JAVA_OPTS="-Xms4096m -Xmx6g -Xss512m"
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /apollo.jar"]
#ENTRYPOINT ["java","-jar","/apollo.jar"]

View File

@@ -98,6 +98,8 @@ public class KSIngestor {
}
}
public IngestionOutput ingestDocumentByIdAsync(String id) {
IngestionOutput ingestionOutput= new IngestionOutput();
Optional<KSDocument> optionalDocument = ksDocumentRepository.findById(id);
@@ -117,6 +119,28 @@ public class KSIngestor {
}
}
public IngestionOutput setDocumentInQueueIngestion(String id) {
IngestionOutput ingestionOutput= new IngestionOutput();
Optional<KSDocument> optionalDocument = ksDocumentRepository.findById(id);
if (optionalDocument.isPresent()) {
KSDocument ksDocument = optionalDocument.get();
if ("LOADED".equals(ksDocument.getIngestionStatus()) || "ERROR".equals(ksDocument.getIngestionStatus())) {
ksDocument.setIngestionStatus("INGESTION_QUEUE");
ksDocumentRepository.save(ksDocument);
ingestionOutput.setMessage("Document added to ingestion queue...");
ingestionOutput.setStatus("INGESTION_QUEUE");
return ingestionOutput;
} else {
ingestionOutput.setMessage("OOPS: Document is already Injected");
return ingestionOutput;
}
} else {
ingestionOutput.setMessage("OOPS: Document Not found");
return ingestionOutput;
}
}
@Async
private CompletableFuture<Void> ingestDocumentAsync(KSDocument ksDocument) {
ingestDocument(ksDocument);