arunsrajan opened a new pull request, #26010: URL: https://github.com/apache/camel/pull/26010
# Description This pull request enhances the 'camel-alibaba-eventbridge' component by introducing hierarchical event validation, an in-memory TTL event source cache, multi-bus and single-bus DSL configuration for allowed event sources, and comprehensive documentation updates across 'camel-alibaba-eventbridge' and 'camel-catalog'. Fixes https://issues.apache.org/jira/browse/CAMEL-24373 ## Motivation When publishing events via Alibaba Cloud EventBridge, applications often need to: 1. Validate event buses, sources, and event types against Alibaba Cloud rules prior to publishing to avoid runtime submission failures. 2. Enforce strict static whitelists ('allowedEventSources') for single-bus and multi-bus publishing routes. 3. Cache validated cloud metadata with configurable TTL to reduce redundant Alibaba Cloud API roundtrips. 4. Support flexible configuration formats (single-bus shorthand DSL, multi-bus DSL, JSON string, Java models). ## Modifications: ### 1. 'camel-alibaba-eventbridge': - **Hierarchical Validation**: - Implemented 'EventSourceCache' providing validated caching of event buses, registered event sources, and rule filter pattern event types using Alibaba Cloud APIs ('listEventBuses', 'listRules') with configurable TTL ('eventSourceCacheTtl'). - Added 'MapCloudEventValidator' to validate and convert 'Map' payloads conforming to both Alibaba EventBridge dictionary keys and standard CloudEvents 1.0 specifications. - **Allowed Event Sources Whitelisting**: - Added 'AllowedEventBus' and 'AllowedEventSource' models. - Implemented parsing in 'AlibabaEventBridgeUtils' for: - **Single-Bus shorthand DSL**: 'source1 -> type1, type2; source2 -> type3' - **Multi-Bus DSL**: 'bus1[source1 -> type1, type2; source2 -> type3] | bus2[source3 -> type4]' - **JSON configuration**: Hierarchical multi-bus JSON and single-bus flat JSON structures. - **Java Collections / Models**: 'List<AllowedEventBus>', 'List<AllowedEventSource>', 'Map<String, ...>'. - **Component & Endpoint Options**: - Added '@UriParam' options and corresponding headers/properties: 'validateEventSource', 'validateEventType', 'validateEventSpec', 'allowedEventSources', 'eventSourceCacheTtl'. - Added response metadata handling in the producer body ('requestId', 'failedEntryCount', 'entryList'). - **Testing**: - Added unit test suite 'MapCloudEventValidationTest' (12 test cases) covering single-bus DSL, multi-bus DSL, JSON configurations, spec validation, and cache behavior. - Updated 'PutEventsTest' with test cases for multi-bus and header-based overrides. ### 2. 'camel-alibaba-common' & other Alibaba modules: - Moved common helper methods 'resolveBoolean' and 'resolveLong' into 'OpenApiClientSupport' in 'camel-alibaba-common'. - Cleaned up client configuration resolution across 'camel-alibaba-oss', 'camel-alibaba-mns', 'camel-alibaba-fc', 'camel-alibaba-sms', and 'camel-alibaba-kms'. ### 3. Documentation: - Updated 'alibaba-eventbridge-component.adoc' with detailed descriptions for: - Cloud validation and caching workflow. - Single-bus and multi-bus DSL syntax, grammar rules, and components. - JSON configuration examples. - Java DSL routing examples. - Escaped pipe characters ('\|') inside the AsciiDoc table to fix cell fragmentation. - Regenerated and synchronized catalog documentation in 'catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-eventbridge-component.adoc'. --- Co-authored-by: Antigravity <[email protected]> -- 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]
