我目前正在尝试将java应用程序(在前提下运行)连接到SAP事件网格,以接收某些SAP系统发布的消息。
同事们提供了一个包含凭据和端点的json文件:
{
"namespace": ":)",
"xsappname": ":)",
"management": [
{
"oa2": {
"clientid": ":)",
"clientsecret": ":)",
"tokenendpoint": "https://whatever.authentication.eu20.hana.ondemand.com/oauth/token",
"granttype": "client_credentials"
},
"uri": "https://em-hub-backend.cfapps.eu20.hana.ondemand.com"
}
],
"serviceinstanceid": ":)",
"messaging": [
{
"oa2": {
"clientid": ":)",
"clientsecret": ":)",
"tokenendpoint": "https://whatever.authentication.eu20.hana.ondemand.com/oauth/token",
"granttype": "client_credentials"
},
"protocol": [
"amqp10ws"
],
"broker": {
"type": "sapmgw"
},
"uri": "wss://em-messaging-gateway.cfapps.eu20.hana.ondemand.com/protocols/amqp10ws"
},
{
"oa2": {
"clientid": ":)",
"clientsecret": ":)",
"tokenendpoint": "https://whatever.authentication.eu20.hana.ondemand.com/oauth/token",
"granttype": "client_credentials"
},
"protocol": [
"mqtt311ws"
],
"broker": {
"type": "sapmgw"
},
"uri": "wss://em-messaging-gateway.cfapps.eu20.hana.ondemand.com/protocols/mqtt311ws"
},
{
"oa2": {
"clientid": ":)",
"clientsecret": ":)",
"tokenendpoint": "https://whatever.authentication.eu20.hana.ondemand.com/oauth/token",
"granttype": "client_credentials"
},
"protocol": [
"httprest"
],
"broker": {
"type": "saprestmgw"
},
"uri": "https://em-pubsub.cfapps.eu20.hana.ondemand.com"
}
]
}根据SAP帮助页面,有3种支持的协议(https://help.sap.com/viewer/bf82e6b26456494cbdd197057c09979f/Cloud/en-US/3f424ff1ae3b4bc084c4f1ea0be96f54.html)
我想REST的性能很差。所以我会选择AMQP或者MQTT而不是WS。很难找到支持AMQP或MQTT以及安全websockets和oauth身份验证的java客户端库。
我已经看过SAP云sdk了。但是,功能概述告诉我,消息传递仍然处于计划状态,这意味着它还不可用。
你有什么建议让我在这里取得进展吗?
发布于 2021-04-30 18:06:37
UPD:我的同事建议XBEM库目前是SAP事件消费的最佳选择。CAP和SDK的库在它的基础上增加了方便。在这里查看更多的文档。
SAP Cloud SDK为S/4HANA的Enterprise提供了实验支持,但由于支持由帽子实现而停止了它。他们承诺发布一个库,该库可以用作依赖项,以简化Java和Node.js的事件消耗。它似乎花费的时间比承诺的要长,请参阅屏幕截图中的当前状态:

当库发布时,SDK计划为类型安全访问事件提供额外的方便。目前,这是不可能的,因为没有普遍可用的版本。
如果您有一个租户应用程序,您仍然可以尝试CAP的库。如需参考,请参阅其文档
如果您希望在SDK中支持Enterprise网格,请创建一个特性请求这里。
https://stackoverflow.com/questions/67313176
复制相似问题