Once triggered, the function will perform an API call to the Commerce mock to obtain additional details regarding the order and then cache the information into Redis.
In this step, you will bind the Commerce Mock application to the dev namespace. This will allow the APIs and Events of the mock application to be used within the namespace.
这一步会将 Commerce Mock 应用同 dev 命名空间绑定在一起,这使得 Mock 应用的 API 和 Events 能够在 dev 命名空间内被使用。
点击 Create:
Create the Events service instances - 创建事件服务实例
In this step, you will create service instances of the Events the Commerce Mock application exposes. This will allow the events to be consumed from resources within the namespaces such as functions or microservices.
选择 SAP Commerce Cloud - Events:
点击 Add 按钮,创建一个 Service 实例:
创建好的 service 实例:
Step 4: Create API service instances
In this step, you will create a service instance of the Commerce Webservices the Mock application exposes.
Mock Application 暴露的 Commerce Web Service, 可以基于其创建服务实例。该服务实例能够将 API 暴露给同一命名空间下的其他资源,比如函数和微服务。
查看两个成功创建的服务实例:
下一步,部署三个资源到 Kyma 上:
cache-order: This function will subscribe to an event published by the Commerce mock application. Once triggered, it will call back to the Commerce mock application to obtain the totalPriceWithTax and then cache the information into Redis.
redis-deployment: This deployment defines the Redis cache configuration and the associated Kubernetes service which exposes the Redis instance to the two Serverless functions.
确保 deployment 状态全部为 Running:
Add event subscription to function
In this step, you will configure the function cache-order, deployed in the previous step, to run when the order.created event is fired from the Commerce Mock application.