Conversation
Open
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: Add ORD Integration Dependency support via messaging.subscribe()
Summary
This PR adds support for generating ORD Integration Dependencies for consumed events using the
messaging.subscribe()method with aneventResourceOrdIdoption.When both
@cap-js/event-brokerand@cap-js/ordplugins are installed, consumed events are automatically documented in the application's ORD metadata.Motivation
Applications using Event Broker to consume external CloudEvents (e.g., from S/4HANA) should declare these dependencies in their ORD document for:
cds-feature-event-hub) behaviorChanges
Modified Files
cds-plugin.jssubscribe()method witheventResourceOrdIdoption supportREADME.mdUsage
Subscribe to events with ORD metadata
Use
messaging.subscribe()with theeventResourceOrdIdoption to both subscribe to events and declare them in ORD:Result: ORD Integration Dependency
At runtime, the ORD document at
/.well-known/open-resource-discoveryincludes:{ "integrationDependencies": [ { "ordId": "customer.myapp:integrationDependency:consumedEvents:v1", "title": "Consumed Events", "aspects": [ { "title": "Subscribed Event Types", "eventResources": [ { "ordId": "sap.s4:eventResource:CE_SALESORDEREVENTS:v1", "subset": [ { "eventType": "sap.s4.beh.salesorder.v1.SalesOrder.Changed.v1" } ] }, { "ordId": "sap.s4:eventResource:CE_BUSINESSPARTNEREVENTS:v1", "subset": [ { "eventType": "sap.s4.beh.businesspartner.v1.BusinessPartner.Created.v1" } ] } ] } ] } ] }Multiple Event Types per Event Resource
When multiple events belong to the same event resource, they are automatically grouped:
Results in:
{ "ordId": "sap.s4:eventResource:CE_SALESORDEREVENTS:v1", "subset": [ { "eventType": "sap.s4.beh.salesorder.v1.SalesOrder.Changed.v1" }, { "eventType": "sap.s4.beh.salesorder.v1.SalesOrder.Created.v1" } ] }How It Works
messaging.subscribe()calls: The plugin interceptssubscribe()calls and stores mappings of event types to Event Resource ORD IDscds.once('served')): Plugin registers a provider with the ORD plugin's Extension Registrysubscribe() Method Signature
eventTypestringoptionsobjecteventResourceOrdIdhandlerfunctionThe
eventResourceOrdIdoption specifies the ORD ID of the external Event Resource that contains this event type.Design Decisions
Why messaging.subscribe() instead of CDS annotations?
Using
subscribe()consolidates event subscription and ORD declaration in one place. This ensures the ORD metadata always matches what the application actually subscribes to.Runtime-Only Support
Integration Dependencies are only generated at runtime, matching the Java plugin behavior. Build-time would require parsing service implementation code.
Comparison with Java Plugin
cds-feature-event-hub)@cap-js/event-broker)OrdIntegrationDependencyProvider)eventResourceOrdIdinsubscribe()callsubscribe()method interceptionChecklist
References
Related PR for ORD plugin to add the extension registry: cap-js/ord#399