JiriOndrusek commented on code in PR #9040:
URL: https://github.com/apache/camel-quarkus/pull/9040#discussion_r3841760864
##########
extensions/langchain4j-ingest/runtime/src/main/java/org/apache/camel/quarkus/component/langchain4j/ingest/IngestRoutes.java:
##########
@@ -204,20 +220,49 @@ private void configureFileSource(String name,
IngestRunTimeConfig.PipelineRunTim
private void configureEndpointSource(String name, String uri,
IngestRunTimeConfig.PipelineRunTimeConfig runtime, IngestService
service) {
Expression documentId = documentIdExpression(runtime,
IngestHeaders.DOCUMENT_ID);
+ maybeAutoCreateRepository(name, runtime);
+ String repositoryName = runtime == null ? null :
runtime.source().idempotentRepository().orElse(null);
+ if (repositoryName == null) {
+ from(uri)
+ .routeId(routeId(name))
+ .process(exchange -> {
+ String id = requireDocumentId(name, documentId,
exchange);
+ exchange.getIn().setBody(service.ingest(id,
exchange.getIn().getBody(String.class)));
+ });
+ return;
+ }
+ // duplicates skip the block and the tail processor answers SKIPPED;
first write wins
+ // per id. The EIP keys on the validated id property, evaluating the
expression once
from(uri)
.routeId(routeId(name))
+ .process(exchange -> exchange.setProperty(DOCUMENT_ID_PROPERTY,
+ requireDocumentId(name, documentId, exchange)))
+ .idempotentConsumer(exchangeProperty(DOCUMENT_ID_PROPERTY),
Review Comment:
Thank you for spotting this! I fixed it.
--
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]