aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-05-07 18:53:41 +0000
committerGerrit Code Review <gerrit@onap.org>2021-05-07 18:53:41 +0000
commit44061ae9201cdff70e753f42f497dff12a45e4b6 (patch)
tree007b2601168584d2907126e7f7ce4e5c11b9d759
parent03eb24af1d561b209945f246678166b416ab9a92 (diff)
parentac08e63b69998f51cafc8b2b2b4a475dbc7d9dd3 (diff)
Merge "Changes to retain executionProperties per event flow for better context handling" into honolulu
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java6
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java10
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java9
3 files changed, 6 insertions, 19 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java
index 410c83c40..ce00210e8 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java
@@ -128,10 +128,10 @@ public class ApexGrpcProducer extends ApexPluginsEventProducer implements CdsPro
LOGGER.error("Sending event \"{}\" by {} to CDS failed.", eventName, this.name);
}
- consumeEvent(executionId, cdsResponse.get());
+ consumeEvent(executionId, executionProperties, cdsResponse.get());
}
- private void consumeEvent(long executionId, ExecutionServiceOutput event) {
+ private void consumeEvent(long executionId, Properties executionProperties, ExecutionServiceOutput event) {
// Find the peered consumer for this producer
final PeeredReference peeredRequestorReference = peerReferenceMap.get(EventHandlerPeeredMode.REQUESTOR);
if (peeredRequestorReference == null) {
@@ -148,7 +148,7 @@ public class ApexGrpcProducer extends ApexPluginsEventProducer implements CdsPro
// Use the consumer to consume this response event in APEX
final ApexGrpcConsumer grpcConsumer = (ApexGrpcConsumer) consumer;
try {
- grpcConsumer.getEventReceiver().receiveEvent(executionId, new Properties(),
+ grpcConsumer.getEventReceiver().receiveEvent(executionId, executionProperties,
JsonFormat.printer().print(event));
} catch (ApexEventException | InvalidProtocolBufferException e) {
throw new ApexEventRuntimeException("Consuming gRPC response failed.", e);
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java
index 452ecf8e5..fc7c11e9e 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,9 +51,6 @@ public class ApexRestClientConsumer extends ApexPluginsEventConsumer {
// The amount of time to wait in milliseconds between checks that the consumer thread has stopped
private static final long REST_CLIENT_WAIT_SLEEP_TIME = 50;
- // The Key for property
- private static final String HTTP_CODE_STATUS = "HTTP_CODE_STATUS";
-
// The REST parameters read from the parameter service
private RestClientCarrierTechnologyParameters restConsumerProperties;
@@ -171,12 +169,8 @@ public class ApexRestClientConsumer extends ApexPluginsEventConsumer {
throw new ApexEventRuntimeException(errorMessage);
}
- // build a key and value property in excutionProperties
- Properties executionProperties = new Properties();
- executionProperties.put(HTTP_CODE_STATUS, response.getStatus());
-
// Send the event into Apex
- eventReceiver.receiveEvent(executionProperties, eventJsonString);
+ eventReceiver.receiveEvent(new Properties(), eventJsonString);
} catch (final Exception e) {
LOGGER.warn("error receiving events on thread {}", consumerThread.getName(), e);
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java
index d7ee0a5ee..81997e351 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java
@@ -71,9 +71,6 @@ public class ApexRestRequestorConsumer extends ApexPluginsEventConsumer {
// stopped
private static final long REST_REQUESTOR_WAIT_SLEEP_TIME = 50;
- // The Key for property
- private static final String HTTP_CODE_STATUS = "HTTP_CODE_STATUS";
-
// The REST parameters read from the parameter service
private RestRequestorCarrierTechnologyParameters restConsumerProperties;
@@ -335,12 +332,8 @@ public class ApexRestRequestorConsumer extends ApexPluginsEventConsumer {
throw new ApexEventRuntimeException(errorMessage);
}
- // build a key and value property in excutionProperties
- Properties executionProperties = new Properties();
- executionProperties.put(HTTP_CODE_STATUS, response.getStatus());
-
// Send the event into Apex
- eventReceiver.receiveEvent(request.getExecutionId(), executionProperties, eventJsonString);
+ eventReceiver.receiveEvent(request.getExecutionId(), inputExecutionProperties, eventJsonString);
synchronized (eventsReceivedLock) {
eventsReceived++;