Upversion artifacts to 1.8.0-SNAPSHOT
[aai/router-core.git] / README.md
1 # Overview
2 This component contains a number of general Apache Camel components which are intended for use by the data-router.
3
4 # Maven Dependency
5 To make use of the Camel components included in this repository, include the following artifact in your dependencies list:
6
7     <dependency>
8         <groupId>org.openecomp</groupId>
9         <artifactId>router-core</artifactId>
10         <version>1.0.0-SNAPSHOT</version>
11     </dependency>
12   
13 # How to Build:
14
15     > mvn clean install
16     
17
18 ## Rest Client Component
19
20 The REST client component provides a simple endpoint for sending HTTP requests to a REST endpoint.
21
22 ### URI Format
23     ecomp-rest:op[?options]
24     
25 Where,
26
27 op = One of GET, PUT, POST, or DELETE
28     
29 ### URI Options
30 The following option parameters must be passed in to the component for HTTPS communications:
31
32 | Parameter | Description |
33 | --------- | ----------- |
34 | ecomp-client-cert | Fully qualified path to the client certificate to use for HTTPS communications. |
35 | ecomp-keystore | Fully qualified path to the keystore file to use for HTTP communications. |
36 | ecomp-keystore-password | Obfuscated password for the keystore. |
37
38 ### IN Message
39
40 #### Ecomp-Rest Header Parameters
41 | Header Name | Description |
42 | ----------- | ----------- |
43 | ecomp-url | The fully qualified URL for the HTTP request to be send.  This is mandatory. |
44
45 #### HTTP Header Parameters
46 The following parameters, if they are present in the Exchange In Message Headers, will be included as header values 
47 in the HTTP request generated by the component:
48
49 | HTTP Header Name |
50 | ---------------- |
51 | X-FromAppId | 
52 | X-TransactionId |
53 | resourceVersion |
54 | ETag |
55 | If-Match |
56 | If-None-Match |
57 | Accept |
58
59 #### Message Body
60 For HTTP operations that require a content body, the body of the IN message will be used.
61
62 ### OUT Message
63
64 #### Headers
65 The following header values are populated on the OUT message:
66
67 | ecomp-response-code | The response code produced by the HTTP request. |
68 | ecomp-response-message | The response message produced by the HTTP request. |
69
70 #### Message Body
71 For HTTP operations that produce a content body, the body of the OUT message will be populated with this result.
72
73 ### Example
74
75 The following route file illustrates a simple example which takes console input and invokes the rest client, using the input from the
76 console as the content body for the REST request.
77
78
79     <route xmlns="http://camel.apache.org/schema/spring" trace="true">
80         <!-- Take some input from the console. -->
81         <from uri="stream:in?promptMessage=Enter Something: " />
82  
83         <!-- Set the URL that we want to send our REST request to. -->
84         <setHeader headerName="ecomp-url">
85             <constant>https://localhost:9509/services/search-data-service/v1/search/indexes/gdf/documents/88</constant>
86         </setHeader>
87         
88         <!-- Set values for some HTTP headers that we want to populate for our reqeust. -->
89         <setHeader headerName="X-FromAppId">
90             <constant>DataLayer</constant>
91         </setHeader>
92         <setHeader headerName="X-TransactionId">
93             <constant>gdf1</constant>
94         </setHeader>
95         
96         <!-- Invoke the REST client, using our console input as the content body of our request. -->
97         <!-- Note that we provide the paths to the client certificate and keystore, as well as   -->
98         <!-- the obfuscated password for the keystore.                                           -->  
99         <to uri="rest-client:put?ecompClientCert=c:/dev/dl_microservice/target/swm/package/nix/dist_files/opt/app/ajsc-aai-data-layer-microservice/bundleconfig/etc/auth/aai-client-cert.p12&amp;ecompKeystore=c:/dev/dl_microservice/target/swm/package/nix/dist_files/opt/app/ajsc-aai-data-layer-microservice/bundleconfig/etc/auth/tomcat_keystore&amp;ecompKeystorePassword=70c87528c88dcd9f9c2558d30e817868"/>
100   <to uri="stream:out" />
101   
102     </route>