Skip to content

Commit

Permalink
event broker follow ups (#1279)
Browse files Browse the repository at this point in the history
Co-authored-by: René Jeglinsky <[email protected]>
Co-authored-by: Dr. David A. Kunz <[email protected]>
  • Loading branch information
3 people authored Sep 27, 2024
1 parent 90abb35 commit a024a0e
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 11 deletions.
4 changes: 1 addition & 3 deletions about/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) | <X/> | <X/> | <X/> |
| Mock Broker (to speed up local dev) [[Node.js](../node.js/messaging#file-based)\|[Java](../java/messaging#local-testing)] | <Na/> | <X/> | <X/> |
| SAP Event Mesh (For single-tenant apps) [[Node.js](../node.js/messaging#event-mesh-shared)\|[Java](../java/messaging#configuring-sap-event-mesh-support)] | <Na/> | <X/> | <X/> |
| SAP Event Broker (For single-tenant apps) [[Node.js](../node.js/messaging#event-broker)] | <Na/> | <X/><br>beta<sup>1</sup> | <D/> |
| SAP Event Broker (For single-tenant apps) [[Node.js](../node.js/messaging#event-broker)] | <Na/> | <X/><br>beta | <D/> |
| Composite Messaging (routing by configuration) [[Node.js](../node.js/messaging#composite-messaging)\|[Java](../java/messaging#composite-messaging-service)] | <Na/> | <X/> | <X/> |
| Import AsyncAPI | <O/> | | |
| Export AsyncAPI | <X/> | | |

> <sup>1</sup> May be outsourced into a plugin, hence the status _beta_. <br>
<span id="events-messaging-more" />

### Database Support
Expand Down
3 changes: 2 additions & 1 deletion about/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion guides/messaging/event-broker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
:::


Expand Down
2 changes: 1 addition & 1 deletion guides/messaging/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
:::


Expand Down
1 change: 1 addition & 0 deletions menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
13 changes: 8 additions & 5 deletions node.js/messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -496,6 +498,7 @@ resources:
display-name: cap.incidents #> any value, e.g., reuse MTA ID
home-url: ~{incidents-srv-api/url}
```
:::
<div id="aftereventbroker" />
Expand Down
16 changes: 16 additions & 0 deletions plugins/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 &rarr; 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)


<div id="internal-plugins" />

<div id="upcoming-plugins" />
Expand Down

0 comments on commit a024a0e

Please sign in to comment.