summaryrefslogtreecommitdiffstats
path: root/docs/sections/components/component-specification/generated-configuration.rst
blob: ba5ae4a02101d874d4b96f071a87dc3a609c9ad7 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0

.. _generated-configuration:

Generated configuration
=======================

The DCAE platform relies on the component specification to generate the
component’s application configuration JSON at deployment time. The
component developer should expect to use this configuration JSON in
their application to provision themselves.

Pro-tip: As you build your component specification, you can use the
:any:`dcae-cli dev command <walkthrough-dev>` to view what
the resulting application configuration will look like.

Streams and services
--------------------

For both Docker and CDAP, when your component is deployed, any
``streams`` and ``services/calls`` you specified will be injected into
your configuration under the following well known structure. Your
component is required to parse this information if you have any
connectivity to DMaaP or are calling another DCAE component.

More details about the DMaaP connection objects are found
:doc:`here <../dcae-cli/dmaap-connection-objects>`.

This is best served with an example.

The following component spec snippet (from String Matching):

::

    "streams":{  
        "subscribes": [{
          "format": "VES_specification",  
          "version": "4.27.2",    
          "type": "message_router",
          "config_key" : "mr_input"
        }],
        "publishes": [{
          "format": "VES_specification",  
          "version": "4.27.2",    
          "config_key": "mr_output",
          "type": "message_router"
         }]
      },
      "services":{  
        "calls": [{
          "config_key" : "aai_broker_handle",
          "verb": "GET",
          "request": {
            "format": "get_with_query_params",
            "version": "1.0.0"
          },
          "response": {
            "format": "aai_broker_response",
            "version": "3.0.0"
          } 
        }],
        "provides": []
      },

Will turn into the following top level keys in your configuration (for
CDAP, this will be under AppConfig)

::

       "streams_publishes":{  
          "mr_output":{                // notice the config key above
             "aaf_password":"XXX",
             "type":"message_router",
             "dmaap_info":{  
                "client_role": null,
                "client_id": null,
                "location": null,
                "topic_url":"XXX"
             },
             "aaf_username":"XXX"
          }
       },
       "streams_subscribes":{  
          "mr_input":{                 // notice the config key above
             "aaf_password":"XXX",
             "type":"message_router",
             "dmaap_info":{  
                "client_role": null,
                "client_id": null,
                "location": null,
                "topic_url":"XXX"
             },
             "aaf_username":"XXX"
          }
       },
       "services_calls":{  
          "aai_broker_handle":[        // notice the config key above
             "SOME_IP:32768"   // based on deployment time, just an example
          ]
       }

These keys will always be populated regardless of whether they are
empty. So the minimal you will get, in the case of a component that
provides an HTTP service and does not call any services and has no
streams, is:

::

        "streams_publishes":{},
        "streams_subscribes":{},
        "services_calls":{}

Thus your component should expect these well-known top level keys.