How to deploy asynchronously an application using REST in weblogic 12C? - java

I have been deploying a weblogic application using the REST api with the following snippet
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 "
I have to wait until this curl ends , but sometimes the request times out because of server configuration.
so, I thought it would be better to do this operation asynchronously, I have read in the documentation that I can use header
-X Prefer:respond-async
but is not clear how to use it, I was not able to find an useful example, once I have added the header, the request is going to return a task URL like
BODY:
{
"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
}
how do I poll that job URL to know that the application was deployed and is active ?

If you'll execute:
curl --insecure -X GET --user ${userpass} ${wlhost}/management/tenant-monitoring/applications/${appName}
when application ${appName} is not deployed, you should get 404 Not Found.
when it's deployed, you should get a JSON similar to this:
{
"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": []
}
Tested (in Postman) on WebLogic 12.2.1.4

The answer is to use the request parameter _detached= true
in the post URL,
This will start the deployment asynchronously
for an example , refer to this document.
https://docs.oracle.com/middleware/1213/wls/WLRMR/management_wls_version_deployments_application.htm#WLRMR290

Related

Marketo API export lead job fails with "Invalid smartListId" error

We are trying to export leads via Bulk Lead Extract Marketo API endpoint using smartListId filter.
Create lead export job:
Enqueue lead export job:
The job fails with "Invalid smartListId 2017":
We are having trouble understanding what might be preventing this job from succeeding. The smart list in question does not seem to be special in any way:
GET {{endpoint}}/rest/asset/v1/smartList/2017.json?includeRules=true
{
"success": true,
"errors": [],
"requestId": "a435...9089f2",
"warnings": [],
"result": [
{
"id": 2017,
"name": "Sync Error",
"description": "jh",
"createdAt": "2018-07-18T20:20:22Z+0000",
"updatedAt": "2022-08-16T16:55:27Z+0000",
"url": "https://app-sj24.marketo.com/#SL2017A1LA1",
"folder": {
"id": 1010,
"type": "Program"
},
"workspace": "Default",
"rules": {
"filterMatchType": "all",
"triggers": [],
"filters": []
}
}
]
}
What could be the reason for this smart list not working with the bulk lead extraction endpoint?

Why the component I deploy to AWS Greengrass Core fails immediately after being deployed?

I have developed a component that subscribes to a local broker in my Greengrass core device and also subscribed to the device shadow of the core device and updates it with data coming from the local broker.
All good, it works for me locally before I deploy it but once deployed it crashes and in CloudWatch I can see the following errors:
{
"timestamp": "2022-04-22 20:25:49.139",
"logLevel": "ERROR",
"traceId": "05e6b233-1b52-d773-d061-3c74057655ea",
"accountId": "***********",
"status": "Failure",
"eventType": "GetThingShadow",
"protocol": "MQTT",
"deviceShadowName": "MyName",
"topicName": "$aws/things/MyName/shadow/name/AWSManagedGreengrassV2Deployment/get",
"details": "No shadow exists with name: 'MyName~AWSManagedGreengrassV2Deployment'"
}
The second one:
{
"timestamp": "2022-04-22 20:26:08.479",
"logLevel": "ERROR",
"accountId": "********",
"status": "Success",
"eventType": "UpdateJobExecution",
"protocol": "MQTT",
"clientId": "MyName",
"jobId": "d1a10592-7d03-4cc8-aeca-1a615dc562e0",
"topicName": "$aws/things/MyName/jobs/d1a10592-7d03-4cc8-aeca-1a615dc562e0/namespace-aws-gg-deployment/update",
"details": "The destination status is FAILED. The request status is SUCCESS."
}
What could cause these issues? Can somebody give me a clue?
I found an answer to my problem.
It was the fact that the component I deployed has a different Java version compared to the one that the Greengrass Core is running.
I hope that helps somebody.

Hide build info from Actuator Info Spring boot

Currently, I'm getting build info and build info from the Actuator/info endpoint. Like
{
"git": {
"commit": {
"time": "2021-09-01T05:56:49Z",
"id": "XXXXXX"
},
"branch": "task/XXXX-1234-adding-actuator-endpoint"
},
"build": {
"version": "0.0.1-SNAPSHOT",
"artifact": "XXXXX-XXXX",
"name": "XXXX---XXXX",
"group": "no.XXX.XXX",
"time": "2021-09-01T07:18:23.786Z"
}
}
What I need to do is hide build info from this, is that possible with the Gradle actuator for spring-boot? I only need to get git info.
As per this: https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json line 249,
It should be as simple as management.info.build.enabled=false in your application.properties.

in graphite server - actuator/metrics/http.server.requests count not updating

I have a spring boot project up and running. I have also configured dependency for micrometer-registry-graphite in pom file. And I have installed graphite using docker (downloaded latest version - 1.1.6) and it is running in localhost:80
When I hit the below url it properly shows the hit count.
http://localhost:5080/api/v1/actuator/metrics/http.server.requests?tag=uri:/queue/{queueId}&tag=status:200
Below is the response,
{
"name": "http.server.requests",
"description": null,
"baseUnit": "milliseconds",
"measurements": [
{
"statistic": "COUNT",
"value": 29.0
},
{
"statistic": "TOTAL_TIME",
"value": 942.520949
},
{
"statistic": "MAX",
"value": 0.0
}
],
"availableTags": [
{
"tag": "exception",
"values": [
"None"
]
},
{
"tag": "method",
"values": [
"GET"
]
},
{
"tag": "outcome",
"values": [
"SUCCESS"
]
}
]
}
When I navigate to Graphite Browser, I'm not able to get the count value which I got previously using actuator/metrics url. [We can see the service's url queue/queueId is transformed to some hierarchy form].
And I can see different hierarchical structure (attached the image), why it is showing under exception, None and other unrelated hierarchy. Can someone please explain this and I'm in need of solution to get the hit count in graphite server.
Spring boot version: 2.2.4 RELEASE and
micrometer-registry-graphite version: 1.3.2
I have wrongly pointing my graphite server with port-80 in bootstrap.yml. But port-80 listening fo nginx, where it should point to port-2004 which is listening for carbon receiver. After this change in bootstrap.yml I'm able to resolve this issue.

Webhook call failed - Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

I am using DIalogflow (api.ai) to create chat interfaces. For now, I only have a simple intent called 'Name' regarding the question e.g. 'Who is John?' which responds 'John is a'. The json output regarding this question from Dialoglow is the following:
{
"id": "my_project_id",
"timestamp": "2018-03-20T14:41:02.561Z",
"lang": "en",
"result": {
"source": "agent",
"resolvedQuery": "Who is John",
"action": "",
"actionIncomplete": false,
"parameters": {
"given-name": "John"
},
"contexts": [],
"metadata": {
"intentId": "0fb73421-0d19-4a09-b7e9-1e767041547f",
"webhookUsed": "true",
"webhookForSlotFillingUsed": "false",
"webhookResponseTime": 2224,
"intentName": "Identity"
},
"fulfillment": {
"speech": "John is a",
"messages": [
{
"type": 0,
"speech": "John is a"
}
]
},
"score": 1
},
"status": {
"code": 206,
"errorType": "partial_content",
"errorDetails": "Webhook call failed. Error: Failed to parse webhook JSON response: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $.",
"webhookTimedOut": false
},
"sessionId": "491d57cb-0af2-45ac-a658-9e47ec6658ce",
"alternativeResultsFromKnowledgeService": {}
}
I created a webhook from Dialogflow to a simple app containing a php script deployed on Heroku so as to change the answer for the question e.g. 'Who is John' .
My PHP script prints the following answer on Heroku:
{"speech":"This is a too personal question.","displayText":"This is a too personal question.","source":"webhook"}
However as you you can see at the json output above from Dialogflow, I get the following error:
"Webhook call failed. Error: Failed to parse webhook JSON response: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $."
This is the reason why the webhook does not work and I cannot retrieve the answer ('This is a too personal question') from my php script on Heroku back to Dialogflow.
Why am I getting this error since my output is a valid json output?
Try out if the API realy is a JSON schema.
To test this you can set one up at a page like apitester.com and see the request or response of your JSON.

Categories