打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
如何使用 SAP Kyma 控制台手动发送 SAP Commerce Cloud Mock 应用暴露的事件

网址:https://developers.sap.com/tutorials/cp-kyma-microservice-trigger.html

本地路径: C:\Code\referenceCode\SAP Kyma教程例子\api-mssql-go

(1) This tutorial relies on the Commerce mock application to publish events into the Kyma runtime.

(2) bind the Commerce mock application to the dev Namespace

(3) we will create a service instance of the SAP Commerce Cloud - Events.

(4) The service instance will allow for any microservice or lambda function within the dev Namespace to subscribe to these events by defining an event subscription.

借助这个 mock 应用的 service instance,我们可以让 dev 命名空间的任何微服务或者Lambda Function,订阅 service instance 暴露出的事件。

The subscription pairs an event source, the Commerce mock application, and the event type, order.created, to a subscriber.

订阅实际上是一个抽象,包含了事件源,mock 应用,和订阅事件类型。

这个订阅的源代码,用 yaml 文件定义如下:

apiVersion: eventing.kyma-project.io/v1alpha1kind: Subscriptionmetadata:  name: api-mssql-go-event-subspec:  filter:    filters:    - eventSource:        property: source        type: exact        value: ""      eventType:        property: type        type: exact        value: sap.kyma.custom.mp-commerce-mock.order.created.v1  protocol: ""  protocolsettings: {}  sink: http://api-mssql-go.dev.svc.cluster.local:80/orderCodeEvent

在cmd/api/main.go 里,为 /orderCodeEvent 这个 endpoint,注册一个处理函数:ConsumeOrderCode

bind the mock application to the dev Namespace. This process is used to enable the usage of the APIs and events of the mock application to the bounded Namespace.

把 mock 应用绑定到 dev namespace,这样才能让该命名空间的应用,消费这个 mock 应用暴露出的事件。

也要为 mock 应用暴露出的 event,创建一个 instance.

点击 dev namespace,进入 Service Management -> Catalog, 选择 mp-commerce-mock 应用:

选择该 mock 应用 service plan 中的 SAP Commerce Cloud - Events:

点 Add 按钮,创建新的实例:

测试

在 API rules 里,点击 commerce-mock 的 host 超链接:

https://commerce.http://c-46d70f2.kyma.shoot.live.k8s-hana.ondemand.com/

选择 remote API:

选择 SAP Commerce Cloud - Events:

Event topic 下拉列表里,选择 order.created.v1,再点击 Send Event 即可:

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存
猜你喜欢
类似文章
青龙面板拉取常用脚本(JD签到)目前在维护的脚本更新(2021
利用VBA代码快速合并多个工作簿到一个工作簿
Zlibrary | 全球最大电子书资源网站最新网址 新手使用指南
二十四山立向线法大全
微信上可直接复制使用的emoji符号大全
潘长宏制作的四款GIF翻页图片
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服