日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

發布時間:2023/12/19 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 如何使用 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/v1alpha1 kind: Subscription metadata:name: api-mssql-go-event-sub spec:filter:filters:- eventSource:property: sourcetype: exactvalue: ""eventType:property: typetype: exactvalue: sap.kyma.custom.mp-commerce-mock.order.created.v1protocol: ""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.c-46d70f2.kyma.shoot.live.k8s-hana.ondemand.com/

選擇 remote API:

選擇 SAP Commerce Cloud - Events:

Event topic 下拉列表里,選擇 order.created.v1,再點擊 Send Event 即可:

更多Jerry的原創文章,盡在:“汪子熙”:

總結

以上是生活随笔為你收集整理的如何使用 SAP Kyma 控制台手动发送 SAP Commerce Cloud Mock 应用暴露的事件的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。