aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorBruno Sakoto <bruno.sakoto@bell.ca>2021-08-20 18:59:25 -0400
committerBruno Sakoto <bruno.sakoto@bell.ca>2021-08-25 06:37:49 -0400
commite36f8e376dbdb8cf10d40e67a89a712bca688601 (patch)
tree95f7a5a01e3f9f7f6ac4bf98e7bd52a637e128a7 /src/main
parent976fe54b0782023ab496904481dc0cc9f4eaf4d4 (diff)
Prepare for next event schema version
Issue-ID: CPS-584, CPS-459 Signed-off-by: Bruno Sakoto <bruno.sakoto@bell.ca> Change-Id: I02ce027a4222fe3178d854628a52626c8184d987
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/cps/temporal/controller/event/listener/kafka/DataUpdatedEventListener.java10
-rwxr-xr-xsrc/main/resources/application.yml3
2 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/org/onap/cps/temporal/controller/event/listener/kafka/DataUpdatedEventListener.java b/src/main/java/org/onap/cps/temporal/controller/event/listener/kafka/DataUpdatedEventListener.java
index 2e4b88e..5fce94e 100644
--- a/src/main/java/org/onap/cps/temporal/controller/event/listener/kafka/DataUpdatedEventListener.java
+++ b/src/main/java/org/onap/cps/temporal/controller/event/listener/kafka/DataUpdatedEventListener.java
@@ -40,6 +40,7 @@ import org.springframework.util.StringUtils;
@Slf4j
public class DataUpdatedEventListener {
+ private static final String EVENT_SCHEMA_URN_PREFIX = "urn:cps:org.onap.cps:data-updated-event-schema:v";
private static final URI EVENT_SOURCE;
static {
@@ -93,12 +94,13 @@ public class DataUpdatedEventListener {
new InvalidEventEnvelopException("Validation failure", cpsDataUpdatedEvent);
// Validate schema
- if (cpsDataUpdatedEvent.getSchema() == null) {
+ if (cpsDataUpdatedEvent.getSchema() == null
+ || !cpsDataUpdatedEvent.getSchema().toString().startsWith(EVENT_SCHEMA_URN_PREFIX)) {
invalidEventEnvelopException.addInvalidField(
new InvalidEventEnvelopException.InvalidField(
- MISSING, "schema", null,
- CpsDataUpdatedEvent.Schema.URN_CPS_ORG_ONAP_CPS_DATA_UPDATED_EVENT_SCHEMA_1_1_0_SNAPSHOT
- .value()));
+ UNEXPECTED, "schema",
+ cpsDataUpdatedEvent.getSchema() != null ? cpsDataUpdatedEvent.getSchema().toString() : null,
+ EVENT_SCHEMA_URN_PREFIX + "99"));
}
// Validate id
if (!StringUtils.hasText(cpsDataUpdatedEvent.getId())) {
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index a3b1cd8..7db9510 100755
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -52,11 +52,12 @@ spring:
spring.deserializer.key.delegate.class: org.apache.kafka.common.serialization.StringDeserializer
spring.deserializer.value.delegate.class: org.springframework.kafka.support.serializer.JsonDeserializer
spring.json.value.default.type: org.onap.cps.event.model.CpsDataUpdatedEvent
+ spring.json.use.type.headers: false
app:
listener:
data-updated:
- topic: ${CPS_CHANGE_EVENT_TOPIC:cps.cfg-state-events}
+ topic: ${CPS_CHANGE_EVENT_TOPIC:cps.data-updated-events}
query:
response:
max-page-size: 10000