diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/onap/dcaegen2/services/pmmapper/utils/RequestSender.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/org/onap/dcaegen2/services/pmmapper/utils/RequestSender.java b/src/main/java/org/onap/dcaegen2/services/pmmapper/utils/RequestSender.java index c8e29f3..ba57387 100644 --- a/src/main/java/org/onap/dcaegen2/services/pmmapper/utils/RequestSender.java +++ b/src/main/java/org/onap/dcaegen2/services/pmmapper/utils/RequestSender.java @@ -89,7 +89,8 @@ public class RequestSender { * @throws Exception
*/
public String send(String method, final String urlString, final String body, final String encodedCredentials) throws Exception {
- final UUID invocationID = logger.invoke(ONAPLogConstants.InvocationMode.SYNCHRONOUS);
+ String invocationID = Optional.ofNullable((String)MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID))
+ .orElse(logger.invoke(ONAPLogConstants.InvocationMode.SYNCHRONOUS).toString());
String requestID = Optional.ofNullable((String)MDC.get(ONAPLogConstants.MDCs.REQUEST_ID))
.orElse( UUID.randomUUID().toString());
String result = "";
@@ -134,11 +135,11 @@ public class RequestSender { return result;
}
- private HttpURLConnection getHttpURLConnection(String method, URL url, UUID invocationID, String requestID) throws IOException {
+ private HttpURLConnection getHttpURLConnection(String method, URL url, String invocationID, String requestID) throws IOException {
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setReadTimeout(DEFAULT_READ_TIMEOUT);
connection.setRequestProperty(ONAPLogConstants.Headers.REQUEST_ID, requestID);
- connection.setRequestProperty(ONAPLogConstants.Headers.INVOCATION_ID, invocationID.toString());
+ connection.setRequestProperty(ONAPLogConstants.Headers.INVOCATION_ID, invocationID);
connection.setRequestProperty(ONAPLogConstants.Headers.PARTNER_NAME, MapperConfig.CLIENT_NAME);
connection.setRequestMethod(method);
|