diff options
author | 2018-03-28 17:22:56 +0100 | |
---|---|---|
committer | 2018-03-29 18:38:17 +0100 | |
commit | 837cbcdc2562c0cd041ed558d05bb7dbba4be603 (patch) | |
tree | 370e72f52e0420e0fa633de73a6fd47d03d17422 /src/main/java/org/onap/crud/service/CrudAsyncResponseConsumer.java | |
parent | 0c19b1386259b7144bc6c95954f965c469835522 (diff) |
Update published event to include header and body
Originally, the published event only contained the raw graph
request payload.
This has now been updated to include the following changes:
- encapsulate the graph request in a body property
- add new event header with details such as timestamp, request-id,
event-type
Issue-ID: AAI-954
Change-Id: I780b6f52a01aafdcd7d09156e9d3a99c25be90a3
Signed-off-by: Michael Arrastia <MArrasti@amdocs.com>
Diffstat (limited to 'src/main/java/org/onap/crud/service/CrudAsyncResponseConsumer.java')
-rw-r--r-- | src/main/java/org/onap/crud/service/CrudAsyncResponseConsumer.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/org/onap/crud/service/CrudAsyncResponseConsumer.java b/src/main/java/org/onap/crud/service/CrudAsyncResponseConsumer.java index 01b4c2d..94c1e1b 100644 --- a/src/main/java/org/onap/crud/service/CrudAsyncResponseConsumer.java +++ b/src/main/java/org/onap/crud/service/CrudAsyncResponseConsumer.java @@ -27,6 +27,7 @@ import javax.naming.OperationNotSupportedException; import org.onap.aai.cl.api.Logger; import org.onap.aai.cl.eelf.LoggerFactory; import org.onap.crud.event.GraphEvent; +import org.onap.crud.event.envelope.GraphEventEnvelope; import org.onap.crud.logging.CrudServiceMsgs; import org.onap.aai.event.api.EventConsumer; @@ -76,7 +77,8 @@ public class CrudAsyncResponseConsumer extends TimerTask { for (String event : events) { try { - GraphEvent graphEvent = GraphEvent.fromJson(event); + GraphEventEnvelope graphEventEnvelope = GraphEventEnvelope.fromJson(event); + GraphEvent graphEvent = graphEventEnvelope.getBody(); auditLogger.info(CrudServiceMsgs.ASYNC_RESPONSE_CONSUMER_INFO, "Event received of type: " + graphEvent.getObjectType() + " with key: " + graphEvent.getObjectKey() + " , transaction-id: " @@ -92,7 +94,7 @@ public class CrudAsyncResponseConsumer extends TimerTask { if (CrudAsyncGraphEventCache.get(graphEvent.getTransactionId()) != null) { CrudAsyncGraphEventCache.get(graphEvent.getTransactionId()) - .populateGraphEvent(graphEvent); + .populateGraphEventEnvelope(graphEventEnvelope); } else { logger.error(CrudServiceMsgs.ASYNC_DATA_SERVICE_ERROR, "Request timed out. Not sending response for transaction-id: " |