Git Product home page Git Product logo

Comments (1)

qmacro avatar qmacro commented on May 27, 2024

The CAP service is indicated by the "Brain (CAP service)" block in the schematic diagram.

It can be found in the cap/brain/ directory in this repository.

Overview

It is a basic CAP application with two of the three layers in use:

Layer Description
app Unused
srv A single service teched is defined exposing an entity CharityEntry, and three related helper / test functions invoke(), convert() and readEntry(party). None of these artifacts are directly needed for day-to-day Brain operation
db An entity CharityEntry is defined with a SoldToParty property as key, and a counter property. This entity is defined within the namespace charity

The service, once deployed, does not require any human intervention to function. It performs the following activities, each time an event published to the "salesorder/created" topic on the messaging bus is received:

  1. Unpacks the event data to get the sales order number
  2. Retrieves sales order header details from the Sandbox (S/4HANA mock system) OData service API_SALES_ORDER_SRV
  3. Checks to make sure that the sold-to party is one that hasn't already been processed 10 times before (aborting if so)
  4. Requests a conversion of the total net amount of the sales order to the equivalent in charity fund credits, by calling the Converter (Go microservice) conversion service
  5. Publishes a new event to the "Internal/Charityfund/Increased" topic, with the properties listed below

The properties in the event published by this CAP service are:

Property Description
salesorder The sales order number
custid The sold-to party ID (not the name)
creationdate The date that the sales order was created
credits The charity fund credits equivalent of the sales order total net amount
salesorg The sales organisation that the sales order belongs to

Remote services defined and used

The CAP service consumes the following services which are defined in package.json. Some of these employ destinations defined in the cloud (on CF - see below):

Name Kind Details
messaging enterprise-messaging Connection to the EM service instance
db sqlite Local persistence
S4SalesOrders odata Connection to the Sandbox (S/4HANA mock system) OData service. Destination apihub_mock_salesorders
ConversionService rest Connection to the Converter (Go microservice) conversion service. Destination charityfund_converter

On CF

The CAP service has been deployed to the collab CF org/space 9e079cc4trial/dev as app brain and has bindings to the following service instances in that same space:

Name Service
destination-lite Destination service instance with 'lite' plan, to enable the CAP service to access destinations
emdev Enterprise Messaging service instance with 'dev' plan (note this is a deprecated plan but the only one available in trial)
xsuaa-application Auth & Trust Management service instance with 'application' plan, to enable the CAP service to access the other instances

Deployment was done using cf push (rather than an MTA based deployment) followed by manual binding (cf bind-service) to these existing services.

Local execution

A default-env.json file is available (not in the repo) for local execution. Run from the CAP service directory with cds run.

from teched2020-developer-keynote.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.