Andrea Cosentino created CAMEL-23458:
----------------------------------------

             Summary: camel-docling: Add consumer support for async task 
completion events
                 Key: CAMEL-23458
                 URL: https://issues.apache.org/jira/browse/CAMEL-23458
             Project: Camel
          Issue Type: Improvement
          Components: camel-docling
            Reporter: Andrea Cosentino


The component is producer-only today: {{DoclingEndpoint}} explicitly rejects 
consumer creation. This forces users who want event-driven processing of 
long-running async conversions to either poll {{CHECK_CONVERSION_STATUS}} 
themselves or set up out-of-band orchestration.

h3. Proposed feature
Add a consumer that subscribes to docling-serve task lifecycle events. Two 
viable strategies (the implementation should pick one or expose both via 
configuration):

* *Polling consumer* — periodically scans pending task ids (those previously 
submitted via {{SUBMIT_ASYNC_CONVERSION}}) and emits an exchange when a task 
transitions to {{SUCCESS}} or {{FAILURE}}
* *Webhook consumer* — exposes an HTTP endpoint that docling-serve POSTs to 
when a task completes, reusing existing Camel HTTP infrastructure

h3. Why this matters
* Enables idiomatic event-driven Camel routes: 
{{from("docling:onComplete?...").to("...")}}
* Avoids fragile sleep-based polling in user code
* Makes async conversions composable with the rest of Camel's EIPs

h3. Acceptance criteria
* {{DoclingEndpoint.createConsumer()}} returns a working consumer
* Consumer emits one exchange per task completion with the same headers/body 
shape as the synchronous {{CONVERT_*}} operations
* Configuration options for poll interval (and authentication, reusing the 
existing {{authenticationScheme}}/{{oauthProfile}} options)
* Integration tests cover both success and failure paths
* {{docling-component.adoc}} documents the consumer with a worked example




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to