[
https://issues.apache.org/jira/browse/CAMEL-23776?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Luigi De Masi resolved CAMEL-23776.
-----------------------------------
Fix Version/s: 4.21.0
Resolution: Fixed
> camel-a2a: Add a2aSubTask YAML route step for scoped progress events
> --------------------------------------------------------------------
>
> Key: CAMEL-23776
> URL: https://issues.apache.org/jira/browse/CAMEL-23776
> Project: Camel
> Issue Type: Improvement
> Reporter: Luigi De Masi
> Assignee: Luigi De Masi
> Priority: Major
> Fix For: 4.21.0
>
>
> CAMEL-23063 introduces A2A progress event emission from Camel routes through
> the Simple language function:
> {code}
> ${a2a:emit('Searching docs...')}
> {code}
> This allows route authors to emit progress updates, but common use cases
> require several explicit route steps around the actual work being performed.
> For example, a route may need to emit a progress event before a search,
> another event after the search succeeds, and another event if the search
> fails.
> This improvement proposes adding an {{a2aSubTask}} route/EIP step for scoped
> A2A progress events.
> The step should group nested route outputs and optionally emit A2A progress
> events:
> * {{emitBefore}}
> * {{emitAfter}}
> * {{emitOnError}}
> All emit fields are optional and should support Simple expressions.
> {{emitOnError}} must be able to access {{${exception.message}}}. The original
> exception must still propagate after the error progress event is emitted.
> Example:
> {code:java}
> steps:
> - a2aSubTask:
> emitBefore: Searching docs...
> emitAfter: 'Docs found: ${body.size()}'
> emitOnError: 'Error searching docs: ${exception.message}'
> steps:
> - to:
> uri: 'elasticsearch:docs?operation=Search'
> - a2aSubTask:
> emitBefore: Drafting answer...
> emitAfter: 'Answer drafted: ${body}'
> emitOnError: 'Error drafting answer: ${exception.message}'
> steps:
> - bean:
> ref: answerDraftingService
> method: draft
> - setBody:
> simple: 'Final answer: ${body}'
> {code}
> The emitted messages should support Simple expressions and should be
> evaluated against the current Exchange at the time each event is emitted.
> h3. Expected behavior:
> * {{emitBefore}} is evaluated and emitted before the nested steps are
> executed.
> * {{emitAfter}} is evaluated and emitted after the nested steps complete
> successfully.
> * {{emitOnError}} is evaluated and emitted when the nested steps throw an
> exception.
> * {{emitOnError}} must not swallow, replace, or hide the original exception.
> * All emit fields are optional.
> * The step should support one or more nested Camel route steps.
> * The nested steps should behave like normal route steps.
> * Existing {{${a2a:emit(...)}}} support remains available and unchanged.
>
> h3. The implementation should follow Camel’s standard model-based EIP
> approach, similar to kamelet / circuit-breaker:
> * define {{a2aSubTask}} in {{core/camel-core-model}}
> * let generated DSL/catalog/tooling support expose it consistently to Java
> DSL, XML DSL, YAML DSL, CLI, catalog, and other tooling
> * keep the runtime implementation in {{camel-a2a}} using a
> component-provided processor/factory
> * do not implement this as an A2A-specific YAML DSL deserializer extension
> h3. Acceptance criteria:
> * {{a2aSubTask}} is represented in the core Camel model
> * YAML support comes from generated model DSL support, not from a custom A2A
> YAML resolver
> * Java/model DSL usage is supported, not YAML-only
> * runtime processor implementation lives in {{camel-a2a}}
> * tests cover:
> * success path
> * failure path
> * no emit fields configured
> * only one emit configured
> * multiple nested steps
> * {{emitOnError}} with {{${exception.message}}}
> * original exception propagation
> * docs describe this as a Camel route/EIP step, not a YAML-only extension
--
This message was sent by Atlassian Jira
(v8.20.10#820010)