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

问题描述 投票:0回答:1

我一直在使用带有以下代码段的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 "

我必须等到卷曲结束后,但有时由于服务器配置,请求超时。

所以,我认为异步执行此操作会更好,我已经阅读了可以使用标头的文档

    -X Prefer:respond-async

但不清楚如何使用它,我找不到一个有用的示例,添加标头后,请求将返回任务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以了解该应用程序已部署且处于活动状态?

java deployment weblogic weblogic12c
1个回答
0
投票

如果执行:

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中,在Postman中测试)]

© www.soinside.com 2019 - 2024. All rights reserved.