diff options
author | Bruno Sakoto <bruno.sakoto@bell.ca> | 2021-06-04 07:49:14 -0400 |
---|---|---|
committer | Bruno Sakoto <bruno.sakoto@bell.ca> | 2021-07-05 18:37:15 -0400 |
commit | c9b99347c7c425fce7a1f5f3c7e2ac500f2f0c5c (patch) | |
tree | 199b49d2db987f2c630de124356a48b1bd97657a /README.md | |
parent | 8b2193b7ed06e2ee6a90f7986921e72ca70ad90f (diff) |
Add kafka listener for data updated events
See "Running via Docker Compose" section from README.md file to have an
example of event processing
Issue-ID: CPS-371
Signed-off-by: Bruno Sakoto <bruno.sakoto@bell.ca>
Change-Id: Id3abfa32fb04e07102a5f28e6e43a9b533391188
Diffstat (limited to 'README.md')
-rwxr-xr-x | README.md | 42 |
1 files changed, 39 insertions, 3 deletions
@@ -20,12 +20,48 @@ mvn clean install -Pcps-temporal-docker -Ddocker.repository.push= ## Running via Docker Compose `docker-compose.yml` file is provided to be run with `docker-compose` tool and local image previously built. -It starts both Postgres Timescale database and CPS Temporal service. +It starts following services: -Execute following command from project root folder: +* CPS Temporal service (cps-temporal) +* Postgres Timescale database (timescaledb) +* Kafka broker (zookeeper and kafka) + +Execute following command from project root folder to start all services: + +```bash +docker-compose up +``` + +Then, use `kafkacat` tool to produce a data updated event into the Kafka topic: + +```bash +docker run -i --rm --network=host edenhill/kafkacat:1.6.0 -b localhost:19092 -t cps.cfg-state-events -D/ -P <<EOF +{ + "schema": "urn:cps:org.onap.cps:data-updated-event-schema:1.1.0-SNAPSHOT", + "id": "38aa6cc6-264d-4ede-b534-18f5c1f403ea", + "source": "urn:cps:org.onap.cps", + "type": "org.onap.cps.data-updated-event", + "content": { + "observedTimestamp": "2021-06-09T13:00:00.123-0400", + "dataspaceName": "my-dataspace", + "schemaSetName": "my-schema-set", + "anchorName": "my-anchor", + "data": { + "interface": { + "name": "itf-1", + "status": "up" + } + } + } +} +EOF +``` + +Finally, verify that CPS Temporal data is persisted as expected: ```bash -docker-compose up -d +psql -h localhost -p 5433 -d cpstemporaldb -U cpstemporal -c \ + "select * from network_data order by created_timestamp desc limit 1" ``` ## Alternative local db setup |