summaryrefslogtreecommitdiffstats
path: root/docs/ncmp-async-events.rst
blob: 49bf57085bb369b50e3f8bb537e125114b2fc148 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
.. Copyright (C) 2023 Nordix Foundation

.. DO NOT CHANGE THIS LABEL FOR RELEASE NOTES - EVEN THOUGH IT GIVES A WARNING
.. _asyncEvents:


CPS Async Events
################

.. toctree::
   :maxdepth: 1

Introduction
============

Async events are triggered when a valid topic has been detected in a passthrough operation.

:download:`NCMP request response event schema <schemas/ncmp-async-request-response-event-schema-v1.json>`

Event header
^^^^^^^^^^^^

.. code-block:: json

    {
        "eventId"               : "001",
        "eventCorrelationId"    : "cps-001",
        "eventTime"             : "2022-09-28T12:24:21.003+0000",
        "eventTarget"           : "test-topic",
        "eventType"             : "org.onap.cps.ncmp.event.model.DmiAsyncRequestResponseEvent",
        "eventSchema"           : "urn:cps:org.onap.cps.ncmp.event.model.DmiAsyncRequestResponseEvent:v1",
        "forwarded-Event"       : { }
    }

Forwarded-Event Payload
^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: json

    "Forwarded-Event": {
        "eventId"               : "002",
        "eventCorrelationId"    : "cps-001",
        "eventTime"             : "2022-09-28T12:24:18.340+0000",
        "eventTarget"           : "test-topic",
        "eventType"             : "org.onap.cps.ncmp.event.model.DmiAsyncRequestResponseEvent",
        "eventSchema"           : "urn:cps:org.onap.cps.ncmp.event.model.DmiAsyncRequestResponseEvent:v1",
        "eventSource"           : "org.onap.cps.ncmp.dmi",
        "response-data-schema"  : "urn:cps:org.onap.cps.ncmp.event.model.DmiAsyncRequestResponseEvent:v1",
        "response-status"       : "OK",
        "response-code"         : "200",
        "response-data"         : { }
    }
been generated in the local system's docker image list after the build. ```bash VERSION=latest DB_USERNAME=cps DB_PASSWORD=cps docker-compose up -d or VERSION=<version> DB_USERNAME=cps DB_PASSWORD=cps docker-compose up -d ``` ## Running or debugging Java built code Before running CPS, a Postgres database instance needs to be started. This can be done with following command: ```bash docker run --name postgres -p 5432:5432 -d \ -e POSTGRES_DB=cpsdb -e POSTGRES_USER=cps -e POSTGRES_PASSWORD=cps \ postgres:12.4-alpine ``` Then CPS can be started either using a Java Archive previously built or directly from Intellij IDE. ### Running from Jar Archive Following command starts the application using JAR file: ```bash DB_HOST=localhost DB_USERNAME=cps DB_PASSWORD=cps CPS_USERNAME=cpsuser CPS_PASSWORD=cpsr0cks! \ java -jar cps-application/target/cps-application-x.y.z-SNAPSHOT.jar ``` ### Running from IntelliJ IDE Here are the steps to run or debug the application from Intellij: 1. Enable the desired maven profile form Maven Tool Window 2. Run a configuration from `Run -> Edit configurations` with following settings: * `Environment variables`: `DB_HOST=localhost;DB_USERNAME=cps;DB_PASSWORD=cps CPS_USERNAME=cpsuser CPS_PASSWORD=cpsr0cks!` ## Accessing services Swagger UI and Open API specifications are available to discover service endpoints and send requests. * `http://localhost:<port-number>/swagger-ui.html` * `http://localhost:<port-number>/api-docs/cps-core/openapi.yaml` * `http://localhost:<port-number>/api-docs/cps-ncmp/openapi.yaml` with <port-number> being either `8080` if running the plain Java build or retrieved using following command if running from `docker-compose`: ```bash docker inspect \ --format='{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' \ <cps-docker-container> ``` Enjoy CPS !