Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/cap-js/docs
Browse files Browse the repository at this point in the history
  • Loading branch information
renejeglinsky committed Oct 2, 2024
2 parents e1ba665 + 6e99074 commit 74494f6
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Since from './components/Since.vue';
import ScrollToTop from './components/ScrollToTop.vue'
import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client'


import '@shikijs/vitepress-twoslash/style.css'
import './custom.scss'

Expand All @@ -27,7 +28,6 @@ export default {
ctx.app.component('Concept', Concept)
ctx.app.component('Since', Since)
ctx.app.component('ScrollToTop', ScrollToTop)

ctx.app.use(TwoslashFloatingVue)
}
}
2 changes: 1 addition & 1 deletion about/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ 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 | <D/> |
| SAP Cloud Application Event Hub (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/> | | |
Expand Down
4 changes: 2 additions & 2 deletions about/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +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-plugin)
<!-- - [Messaging → SAP Event Broker (Multitenancy)](../plugins/#event-broker-multitenancy) -->
- [Messaging → SAP Cloud Application Event Hub](../plugins/#event-broker-plugin)
<!-- - [Messaging → SAP Cloud Application Event Hub (Multitenancy)](../plugins/#event-broker-multitenancy) -->
<!-- - [Messaging → Kafka](../plugins/#apache-kafka) -->
- [Change Tracking](../plugins/#change-tracking)
- [Notifications](../plugins/#notifications)
Expand Down
30 changes: 15 additions & 15 deletions guides/messaging/event-broker.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# # layout: cookbook
shorty: SAP Event Broker
shorty: SAP Cloud Application Event Hub
status: released
---

Expand All @@ -20,10 +20,10 @@ status: released



# Using SAP Event Broker in Cloud Foundry
# Using SAP Cloud Application Event Hub in Cloud Foundry

[SAP Event Broker](https://help.sap.com/docs/event-broker) is the new default offering for messaging in SAP Business Technology Platform (SAP BTP).
CAP provides out-of-the-box support for SAP Event Broker, and automatically handles many things behind the scenes, so that application coding stays agnostic and focused on conceptual messaging.
[SAP Cloud Application Event Hub](https://help.sap.com/docs/event-broker) is the new default offering for messaging in SAP Business Technology Platform (SAP BTP).
CAP provides out-of-the-box support for SAP Cloud Application Event Hub, and automatically handles many things behind the scenes, so that application coding stays agnostic and focused on conceptual messaging.

::: warning
The following guide is based on a productive (paid) account on SAP BTP.
Expand All @@ -37,21 +37,21 @@ The following guide is based on a productive (paid) account on SAP BTP.

## Consuming Events in a Stand-alone App { #consume-standalone }

This guide describes the end-to-end process of developing a stand-alone (or "single tenant") CAP application that consumes messages via SAP Event Broker.
The guide uses SAP S/4HANA as the event emitter, but this is a stand-in for any system that is able to publish CloudEvents via SAP Event Broker.
This guide describes the end-to-end process of developing a stand-alone (or "single tenant") CAP application that consumes messages via SAP Cloud Application Event Hub.
The guide uses SAP S/4HANA as the event emitter, but this is a stand-in for any system that is able to publish CloudEvents via SAP Cloud Application Event Hub.

Sample app: [@capire/incidents with Customers based on S/4's Business Partners](https://github.com/cap-js/incidents-app/tree/event-broker)


### Prerequisite: Events & Messaging in CAP

From the perspective of a CAP developer, SAP Event Broker is yet another messaging broker.
From the perspective of a CAP developer, SAP Cloud Application Event Hub is yet another messaging broker.
That is to say, CAP developers focus on [modeling their domain](../domain-modeling) and [implementing their domain-specific custom logic](../providing-services#custom-logic).
Differences between the various event transporting technologies are held as transparent as possible.

Hence, before diving into this guide, you should be familiar with the general guide for [Events & Messaging in CAP](../messaging/), as it already covers the majority of the content.

Since SAP Event Broker is based on the [CloudEvents](https://cloudevents.io/) standard, the `@topic` annotation for events in your CDS model is interpreted as the CloudEvents `type` attribute.
Since SAP Cloud Application Event Hub is based on the [CloudEvents](https://cloudevents.io/) standard, the `@topic` annotation for events in your CDS model is interpreted as the CloudEvents `type` attribute.


### Add Events and Handlers
Expand All @@ -72,24 +72,24 @@ However, please note that future [Open Resource Discovery (ORD)](https://sap.git

Configure your application to use the `event-broker` messaging service.

[Learn more about configuring SAP Event Broker in CAP Node.js](../../node.js/messaging#event-broker){.learn-more}
[Learn more about configuring SAP Cloud Application Event Hub in CAP Node.js](../../node.js/messaging#event-broker){.learn-more}

[Learn more about `cds.env` profiles](../../node.js/cds-env#profiles){.learn-more}

::: tip Local Testing
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.
Since SAP Cloud Application Event Hub 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.
:::


### Deploy to the Cloud (with MTA)

Please see [Deploy to Cloud Foundry](../deployment/to-cf) regarding deployment with MTA as well as the deployment section from [SAP Event Broker in CAP Node.js](../../node.js/messaging#event-broker).
Please see [Deploy to Cloud Foundry](../deployment/to-cf) regarding deployment with MTA as well as the deployment section from [SAP Cloud Application Event Hub in CAP Node.js](../../node.js/messaging#event-broker).


### Connecting it All Together

In SAP BTP System Landscape, add a new system of type `SAP BTP Application` for your CAP application including its integration dependencies, connect all involved systems (incl. SAP Event Broker) into a formation and enable the event subscription.
Please refer to the [official SAP Event Broker documentation](https://help.sap.com/docs/event-broker) for more info.
In SAP BTP System Landscape, add a new system of type `SAP BTP Application` for your CAP application including its integration dependencies, connect all involved systems (incl. SAP Cloud Application Event Hub) into a formation and enable the event subscription.
Please refer to the [official SAP Cloud Application Event Hub documentation](https://help.sap.com/docs/event-broker) for more info.

<!-- TODO: enable once available -->
<!-- , as described in [CAP Application as a Subscriber](https://help.sap.com/docs/event-broker/event-broker-draft-service/integration-example-using-cap-application?state=DRAFT). -->
Expand All @@ -99,7 +99,7 @@ For testing purposes, SAP S/4HANA can send technical test events of type `sap.ee
:::


<!--The following mta.yaml snippet ensures the sequential creation of the SAP Event Broker and IAS service instances, as well as binds the application to both service instances with the respectively necessary configuration.-->
<!--The following mta.yaml snippet ensures the sequential creation of the SAP Cloud Application Event Hub and IAS service instances, as well as binds the application to both service instances with the respectively necessary configuration.-->

<!--```yaml-->
<!--ID: cap.incidents-->
Expand Down Expand Up @@ -175,7 +175,7 @@ Add an _Integration Dependency_ using the _Simplified Business Eventing Template
#### 2. Activate Event Subscription
In SAP Event Broker Application, activate the subscription for the added integration dependency (cf. [Enabling SAP Event Subscriptions](https://help.sap.com/docs/event-broker/event-broker-service-guide/enable-subscriptions)).
In SAP Cloud Application Event Hub Application, activate the subscription for the added integration dependency (cf. [Enabling SAP Event Subscriptions](https://help.sap.com/docs/event-broker/event-broker-service-guide/enable-subscriptions)).
#### 3. Trigger Test Event
Expand Down
8 changes: 4 additions & 4 deletions guides/messaging/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,9 @@ Find additional information about deploying SAP Event Mesh on SAP BTP in this gu



## [Using SAP Event Broker](./event-broker) {#sap-event-broker}
## [Using SAP Cloud Application Event Hub](./event-broker) {#sap-event-broker}

CAP has growing out-of-the-box support for SAP Event Broker.
CAP has growing out-of-the-box support for SAP Cloud Application Event Hub.
As an application developer, all you need to do is configuring CAP to use `event-broker`, as in this excerpt from a _package.json_:

```jsonc
Expand All @@ -604,15 +604,15 @@ As an application developer, all you need to do is configuring CAP to use `event

::: tip Read the guide
Find additional information about deploying SAP Event Broper on SAP BTP in this guide:
[&rarr; **_Using SAP Event Broker in BTP_**](./event-broker)
[&rarr; **_Using SAP Cloud Application Event Hub in BTP_**](./event-broker)
:::



## [Events from SAP S/4HANA](./s4)
<!-- {.toc-redirect} -->

SAP S/4HANA integrates SAP Event Mesh as well as SAP Event Broker for messaging.
SAP S/4HANA integrates SAP Event Mesh as well as SAP Cloud Application Event Hub for messaging.
That makes it relatively easy for CAP-based applications to receive events from SAP S/4HANA systems.

In contrast to CAP, the asynchronous APIs of SAP S/4HANA are separate from the synchronous ones (OData, REST).
Expand Down
12 changes: 6 additions & 6 deletions guides/messaging/s4.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ status: released

# Receiving Events from SAP S/4HANA Cloud Systems

SAP S/4HANA integrates SAP Event Mesh as well as SAP Event Broker for messaging.
SAP S/4HANA integrates SAP Event Mesh as well as SAP Cloud Application Event Hub for messaging.
Hence, it is relatively easy for CAP-based application to receive events from SAP S/4HANA systems.
This guide provides detailed information on that.

Expand Down Expand Up @@ -88,7 +88,7 @@ S4bupa.on ('BusinessPartner.Changed', msg => {...})

## Configure CAP

To ease the pain of the afore-mentioned topic rewriting effects, CAP has built-in support for [SAP Event Mesh](./event-mesh) as well as [SAP Event Broker](./event-broker).
To ease the pain of the afore-mentioned topic rewriting effects, CAP has built-in support for [SAP Event Mesh](./event-mesh) as well as [SAP Cloud Application Event Hub](./event-broker).
Configure the messaging service as follows, to let it automatically create correct technical topics to subscribe to SAP S/4HANA events:

For SAP Event Mesh:
Expand All @@ -109,7 +109,7 @@ For SAP Event Mesh:

**Note:** In contrast to the default configuration recommended in the [SAP Event Mesh documentation](https://help.sap.com/docs/SAP_EM/bf82e6b26456494cbdd197057c09979f/5499e2e74e674c69b057072272c80d4f.html), ensure you configure your service instance to allow the pattern `+/+/+/ce/*` for subscriptions. That is, **do not** restrict `subscribeFilter`s to `${namespace}`!

For SAP Event Broker:
For SAP Cloud Application Event Hub:

```json
"cds": {
Expand Down Expand Up @@ -139,8 +139,8 @@ extend service S4 with {

## Configure SAP S/4HANA

As a prerequisite for consuming SAP S/4HANA events, the SAP S/4HANA system itself needs to be configured to send out specific event messages to a specific SAP Event Mesh or SAP Event Broker service instance.
How to create the necessary service instances and use them with a CAP application was already described in the previous sections [SAP Event Mesh](./event-mesh) and [SAP Event Broker](./event-broker), respectively.
As a prerequisite for consuming SAP S/4HANA events, the SAP S/4HANA system itself needs to be configured to send out specific event messages to a specific SAP Event Mesh or SAP Cloud Application Event Hub service instance.
How to create the necessary service instances and use them with a CAP application was already described in the previous sections [SAP Event Mesh](./event-mesh) and [SAP Cloud Application Event Hub](./event-broker), respectively.
A description of how to configure an SAP S/4HANA system to send out specific events is out of scope of this documentation here.
See [this documentation](https://help.sap.com/docs/SAP_S4HANA_CLOUD/0f69f8fb28ac4bf48d2b57b9637e81fa/82e97d5329044732af1efd996bfdc2ab.html) for more details.

Expand All @@ -149,7 +149,7 @@ See [this documentation](https://help.sap.com/docs/SAP_S4HANA_CLOUD/0f69f8fb28ac

Instead of adding events found on [SAP Business Accelerator Hub](https://api.sap.com/content-type/Events/events/packages) to a CDS service model, it's also possible to use a messaging service directly to consume events from SAP S/4HANA.

You have to bind the `messaging` service directly to the SAP Event Mesh or SAP Event Broker service instance that the SAP S/4HANA system sends the event messages to. Then you can consume the event by registering a handler on the `type` of the event that should be received (`sap.s4.beh.businesspartner.v1.BusinessPartner.Changed.v1` in the example):
You have to bind the `messaging` service directly to the SAP Event Mesh or SAP Cloud Application Event Hub service instance that the SAP S/4HANA system sends the event messages to. Then you can consume the event by registering a handler on the `type` of the event that should be received (`sap.s4.beh.businesspartner.v1.BusinessPartner.Changed.v1` in the example):

```js
const messaging = await cds.connect.to ('messaging')
Expand Down
2 changes: 2 additions & 0 deletions java/cds-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ type Name {
entity Person {
publicName: Name;
secretName: Name;
}
```

Expand All @@ -626,6 +627,7 @@ Note, that the propagated annotation `@cds.java.name` creates attribute and meth

:::


::: warning
This feature requires version 8.2.0 of the [CDS Command Line Interface](/tools/cds-cli).
:::
Expand Down
4 changes: 2 additions & 2 deletions menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
- [Events & Messaging](guides/messaging/)

- [SAP Event Mesh](guides/messaging/event-mesh)
- [SAP Event Broker](guides/messaging/event-broker)
- [SAP Cloud Application Event Hub](guides/messaging/event-broker)
- [Events from S/4](guides/messaging/s4)

- [Protocols/APIs](advanced/publishing-apis/)
Expand Down Expand Up @@ -226,4 +226,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)
- [SAP Cloud Application Event Hub](plugins/#event-broker-plugin)
14 changes: 7 additions & 7 deletions node.js/messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,13 @@ If you enable the [cors middleware](https://www.npmjs.com/package/cors), [handsh

<span id="aftereventmesh" />

### SAP Event Broker <Beta/> { #event-broker }
### SAP Cloud Application Event Hub <Beta/> { #event-broker }

`kind`: `event-broker`

Use this if you want to communicate using [SAP Event Broker](https://help.sap.com/docs/event-broker).
Use this if you want to communicate using [SAP Cloud Application Event Hub](https://help.sap.com/docs/event-broker).

The integration with SAP Event Broker is provided using the plugin [`@cap-js/event-broker`](https://github.com/cap-js/event-broker).
The integration with SAP Cloud Application Event Hub 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
Expand All @@ -424,9 +424,9 @@ Then, set the `kind` of your messaging service to `event-broker`:
}
```

The [CloudEvents](https://cloudevents.io/) format is enforced since it's required by SAP Event Broker.
The [CloudEvents](https://cloudevents.io/) format is enforced since it's required by SAP Cloud Application Event Hub.

Authentication in the SAP Event Broker integration is based on the [Identity Authentication service (IAS)](https://help.sap.com/docs/cloud-identity-services/cloud-identity-services/getting-started-with-identity-service-of-sap-btp) of [SAP Cloud Identity Services](https://help.sap.com/docs/cloud-identity-services).
Authentication in the SAP Cloud Application Event Hub integration is based on the [Identity Authentication service (IAS)](https://help.sap.com/docs/cloud-identity-services/cloud-identity-services/getting-started-with-identity-service-of-sap-btp) of [SAP Cloud Identity Services](https://help.sap.com/docs/cloud-identity-services).
If you are not using [IAS-based Authentication](./authentication#ias), you will need to trigger the loading of the IAS credentials into your app's `cds.env` via an additional `requires` entry:

```jsonc
Expand All @@ -443,8 +443,8 @@ If you are not using [IAS-based Authentication](./authentication#ias), you will

#### Deployment

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.
Your SAP Cloud Application Event Hub 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 Cloud Application Event Hub instance under `consumed-services` in order for your application to accept requests from SAP Cloud Application Event Hub.
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:

::: code-group
Expand Down
Loading

0 comments on commit 74494f6

Please sign in to comment.