From a024a0e30175fac2a5e7468d89e2203d5433505d Mon Sep 17 00:00:00 2001 From: sjvans <30337871+sjvans@users.noreply.github.com> Date: Fri, 27 Sep 2024 10:19:49 +0200 Subject: [PATCH] event broker follow ups (#1279) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: René Jeglinsky Co-authored-by: Dr. David A. Kunz --- about/features.md | 4 +--- about/index.md | 3 ++- guides/messaging/event-broker.md | 2 +- guides/messaging/index.md | 2 +- menu.md | 1 + node.js/messaging.md | 13 ++++++++----- plugins/index.md | 16 ++++++++++++++++ 7 files changed, 30 insertions(+), 11 deletions(-) diff --git a/about/features.md b/about/features.md index 22b613b0d..07121f495 100644 --- a/about/features.md +++ b/about/features.md @@ -181,13 +181,11 @@ Following is an index of the features currently covered by CAP, with status and | [Declared Events in CDS](../cds/cdl#events) | | | | | Mock Broker (to speed up local dev) [[Node.js](../node.js/messaging#file-based)\|[Java](../java/messaging#local-testing)] | | | | | SAP Event Mesh (For single-tenant apps) [[Node.js](../node.js/messaging#event-mesh-shared)\|[Java](../java/messaging#configuring-sap-event-mesh-support)] | | | | -| SAP Event Broker (For single-tenant apps) [[Node.js](../node.js/messaging#event-broker)] | |
beta1 | | +| SAP Event Broker (For single-tenant apps) [[Node.js](../node.js/messaging#event-broker)] | |
beta | | | Composite Messaging (routing by configuration) [[Node.js](../node.js/messaging#composite-messaging)\|[Java](../java/messaging#composite-messaging-service)] | | | | | Import AsyncAPI | | | | | Export AsyncAPI | | | | -> 1 May be outsourced into a plugin, hence the status _beta_.
- ### Database Support diff --git a/about/index.md b/about/index.md index 1cd10a447..f90765d48 100644 --- a/about/index.md +++ b/about/index.md @@ -461,7 +461,8 @@ Following is an excerpt of generic features provided: - [Open Telementry → SAP Cloud Logging, Dynatrace, ...](../plugins/#telemetry) - [Attachments → SAP Object Store](../plugins/#attachments) - [Attachments → SAP Document Management Service](../plugins/#@cap-js/sdm) -- [Messaging → SAP Event Broker](../plugins/#event-broker) +- [Messaging → SAP Event Broker](../plugins/#event-broker-plugin) +- [Messaging → SAP Event Broker (Multitenancy)](../plugins/#event-broker-multitenancy) - [Messaging → Kafka](../plugins/#apache-kafka) - [Change Tracking](../plugins/#change-tracking) - [Notifications](../plugins/#notifications) diff --git a/guides/messaging/event-broker.md b/guides/messaging/event-broker.md index 4674af795..1c005a532 100644 --- a/guides/messaging/event-broker.md +++ b/guides/messaging/event-broker.md @@ -71,7 +71,7 @@ Configure your application to use the `event-broker` messaging service. [Learn more about `cds.env` profiles](../../node.js/cds-env#profiles){.learn-more} ::: tip Local Testing -Since SAP Event Broker sends events via HTTP, local +Since SAP Event Broker sends events via HTTP, you won't be able to receive events on your local machine unless you use a tunneling service. Therefore we recommend to use a messaging service of kind [`local-messaging`](../../node.js/messaging#local-messaging) for local testing. ::: diff --git a/guides/messaging/index.md b/guides/messaging/index.md index 2abf871dd..3082ea479 100644 --- a/guides/messaging/index.md +++ b/guides/messaging/index.md @@ -192,7 +192,7 @@ The message payload is in the `data` property of the inbound `msg` object. ::: tip -To have more control over imported service definitions, you can set the `model` configuration of your external service to a cds file where you define the external service and only use the imported definitions your app needs. This way, plugins like [Open Resource Discovery (ORD)](/plugins/#ord-open-resource-discovery) know which parts of the external service you actually use in your application. +To have more control over imported service definitions, you can set the `model` configuration of your external service to a cds file where you define the external service and only use the imported definitions your app needs. This way, plugins like [Open Resource Discovery (ORD)](../../plugins/#ord-open-resource-discovery) know which parts of the external service you actually use in your application. ::: diff --git a/menu.md b/menu.md index 35cd893e4..6734f78f9 100644 --- a/menu.md +++ b/menu.md @@ -225,3 +225,4 @@ - [Telemetry](plugins/#telemetry) - [Open Resource Discovery](plugins/#ord-open-resource-discovery) - [CAP Operator for K8s](plugins/#cap-operator-plugin) +- [SAP Event Broker](plugins/#event-broker-plugin) diff --git a/node.js/messaging.md b/node.js/messaging.md index 37ebe9291..1514cd822 100644 --- a/node.js/messaging.md +++ b/node.js/messaging.md @@ -405,13 +405,14 @@ If you enable the [cors middleware](https://www.npmjs.com/package/cors), [handsh Use this if you want to communicate using [SAP Event Broker](https://help.sap.com/docs/event-broker). -You need to install the package [`@cap-js/event-broker`](https://github.com/cap-js/event-broker). +The integration with SAP Event Broker is provided using the plugin [`@cap-js/event-broker`](https://github.com/cap-js/event-broker). +Hence, you first need to install the plugin: ```bash -npm install @cap-js/event-broker +npm add @cap-js/event-broker ``` -Set the `kind` of your messaging service to `event-broker`: +Then, set the `kind` of your messaging service to `event-broker`: ```jsonc "cds": { @@ -444,9 +445,10 @@ If you are not using [IAS-based Authentication](./authentication#ias), you will Your SAP Event Broker configuration must include your system namespace as well as the webhook URL. The binding parameters must set `"authentication-type": "X509_GENERATED"` to allow IAS-based authentication. Your IAS instance must be configured to include your SAP Event Broker instance under `consumed-services` in order for your application to accept requests from SAP Event Broker. -Here's an example configuration based of the mta.yaml file of the [@capire/incidents](https://github.com/cap-js/incidents-app/tree/event-broker) application, bringing it all together: +Here's an example configuration based on the _mta.yaml_ file of the [@capire/incidents](https://github.com/cap-js/incidents-app/tree/event-broker) application, bringing it all together: -```yaml +::: code-group +```yaml [mta.yaml] ID: cap.incidents modules: @@ -496,6 +498,7 @@ resources: display-name: cap.incidents #> any value, e.g., reuse MTA ID home-url: ~{incidents-srv-api/url} ``` +:::
diff --git a/plugins/index.md b/plugins/index.md index b0414876c..e1a2d6642 100644 --- a/plugins/index.md +++ b/plugins/index.md @@ -346,6 +346,22 @@ Available for: ![Java logo](../assets/logos/java.svg){style="height:3em; display:inline; margin:0 0.2em;"} +## SAP Event Broker {#event-broker-plugin} + +The plugin provides out-of-the-box support for consuming events from [SAP Event Broker](https://discovery-center.cloud.sap/serviceCatalog/sap-event-broker) -- for example emitted by SAP S/4HANA Cloud -- in stand-alone CAP applications. + +```js +const S4Bupa = await cds.connect.to ('API_BUSINESS_PARTNER') +S4bupa.on ('BusinessPartner.Changed', msg => {...}) +``` + +For more details, please see [Events and Messaging → Using SAP Event Broker](../guides/messaging/#sap-event-broker). + +Available for: + +[![Node.js](../assets/logos/nodejs.svg 'Link to the plugins repository.'){style="height:2.5em; display:inline; margin:0 0.2em;"}](https://github.com/cap-js/event-broker#readme) + +