Jiri Ondrusek created CAMEL-26341:
-------------------------------------

             Summary: camel-langchain4j-ingest: answer FILTERED for a media 
document whose type cannot be determined
                 Key: CAMEL-26341
                 URL: https://issues.apache.org/jira/browse/CAMEL-26341
             Project: Camel
          Issue Type: Improvement
          Components: camel-ai
            Reporter: Jiri Ondrusek
            Assignee: Jiri Ondrusek


With {{modality=media}}, the producer takes the media type from the 
{{contentType}} option, else from the file extension of the document id 
({{MediaTypes.fromDocumentId}}). When neither gives a type, it throws 
{{IllegalArgumentException}}: "cannot tell the media type of document '...' 
from its extension. Set the contentType endpoint option."

A directory that also holds files of other kinds (a README, a temp file, an 
editor backup) therefore fails the exchange for each such file, again on every 
poll, because a failed exchange does not keep its idempotent key. Committing 
the key instead would keep the file skipped even after a configuration fix, so 
the exchange cannot simply succeed either.

Proposal: for a document whose type cannot be determined, answer a {{FILTERED}} 
result like the {{includeId}}/{{excludeId}} filters do. It then wrote nothing 
and releases its dedup claim. A hint is logged at debug level so a misspelled 
extension can still be found. Documents with {{contentType}} set are not 
affected.

Found while reviewing the Camel Quarkus ingest extension (CAMEL-QUARKUS pull 
request 9340), which has to translate this case.

_Generated with [Claude Code|https://claude.com/claude-code] on behalf of 
[~jondruse]_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to