...
Then, it is possible to implement listeners for both versions.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
/** * Consume event from v0 schema. */ public void consume(final org.onap.cps.event.model.v0.CpsDataUpdatedEvent eventV0) { // Map event v0 to v1 org.onap.cps.event.model.v1.CpsDataUpdatedEvent eventV1 = this.cpsDataUpdatedEventMapper.eventV0ToEventV1(eventV0); // Consume event v1 consume(eventV1); } /** * Consume event from v1 schema. */ public void consume(final org.onap.cps.event.model.v1.CpsDataUpdatedEvent eventV1) { // Map event to entity final var networkData = this.cpsDataUpdatedEventMapper.eventToEntity(eventV1); // Persist entity this.networkDataService.addNetworkData(networkData); } |
...