gpt4 book ai didi

java - 如何在 weblogic 12C 中使用 REST 异步部署应用程序?

转载 作者:行者123 更新时间:2023-12-01 16:33:01 27 4
gpt4 key购买 nike

我一直在使用 REST api 和以下代码片段部署 weblogic 应用程序

    curl --insecure -X POST  --user ${userpass} -F\"deployment=@${appFileName}\" -F\"model={name: '${appName}',  deploymentOptions: { retireGracefully: 'false', timeout: '0' } , ${appType} ${appPlanVersion} targets: [ ${appTargets} ]}\" ${wlhost}/management/wls/latest/deployments/application "

我必须等到这个curl结束,但有时请求会因为服务器配置而超时。

所以,我认为异步执行此操作会更好,我在文档中读到可以使用 header

    -X Prefer:respond-async

但不清楚如何使用它,我找不到有用的示例,一旦我添加了 header ,请求将返回一个任务 URL,例如正文:

    {
"links": [{
"rel": "job",
"href": "http:\//localhost:7001/management/weblogic/latest/domainRuntime/deploymentManager/deploymentProgressObjects/fairShare"
}],
"operationType": 5,
"state": "STATE_RUNNING",
"applicationName": "fairShare",
"progress": "processing",
"completed": false
}

如何轮询该作业 URL 以了解应用程序已部署且处于 Activity 状态?

最佳答案

如果您执行:

curl --insecure -X GET --user ${userpass} ${wlhost}/management/tenant-monitoring/applications/${appName}

当应用程序 ${appName} 未部署时,您应该得到 404 Not Found。

部署后,您应该获得类似于以下内容的 JSON:

{
"body": {
"item": {
"name": "${appName}",
"type": "ear",
"state": "STATE_ACTIVE",
"health": "HEALTH_WARN",
"targetStates": [
{
"target": "wls",
"state": "STATE_ACTIVE"
}
],
"dataSources": [],
"workManagers": [
{
"pendingRequests": 0,
"completedRequests": 125,
"name": "default",
"server": "wls"
}
],
"minThreadsConstraints": [],
"maxThreadsConstraints": [],
"requestClasses": []
}
},
"messages": []
}

在 WebLogic 12.2.1.4 上测试(在 Postman 中)

关于java - 如何在 weblogic 12C 中使用 REST 异步部署应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62012509/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com