Overview
This component contains a number of general Apache Camel components which are intended for use by the data-router.
Maven Dependency
To make use of the Camel components included in this repository, include the following artifact in your dependencies list:
<dependency>
<groupId>org.openecomp</groupId>
<artifactId>router-core</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
How to Build:
> mvn clean install
Rest Client Component
The REST client component provides a simple endpoint for sending HTTP requests to a REST endpoint.
URI Format
ecomp-rest:op[?options]
Where,
op = One of GET, PUT, POST, or DELETE
URI Options
The following option parameters must be passed in to the component for HTTPS communications:
Parameter | Description |
---|---|
ecomp-client-cert | Fully qualified path to the client certificate to use for HTTPS communications. |
ecomp-keystore | Fully qualified path to the keystore file to use for HTTP communications. |
ecomp-keystore-password | Obfuscated password for the keystore. |
IN Message
Ecomp-Rest Header Parameters
Header Name | Description |
---|---|
ecomp-url | The fully qualified URL for the HTTP request to be send. This is mandatory. |
HTTP Header Parameters
The following parameters, if they are present in the Exchange In Message Headers, will be included as header values in the HTTP request generated by the component:
HTTP Header Name |
---|
X-FromAppId |
X-TransactionId |
resourceVersion |
ETag |
If-Match |
If-None-Match |
Accept |
Message Body
For HTTP operations that require a content body, the body of the IN message will be used.
OUT Message
Headers
The following header values are populated on the OUT message:
| ecomp-response-code | The response code produced by the HTTP request. | | ecomp-response-message | The response message produced by the HTTP request. |
Message Body
For HTTP operations that produce a content body, the body of the OUT message will be populated with this result.
Example
The following route file illustrates a simple example which takes console input and invokes the rest client, using the input from the console as the content body for the REST request.
<route xmlns="http://camel.apache.org/schema/spring" trace="true">
<!-- Take some input from the console. -->
<from uri="stream:in?promptMessage=Enter Something: " />
<!-- Set the URL that we want to send our REST request to. -->
<setHeader headerName="ecomp-url">
<constant>https://localhost:9509/services/search-data-service/v1/search/indexes/gdf/documents/88</constant>
</setHeader>
<!-- Set values for some HTTP headers that we want to populate for our reqeust. -->
<setHeader headerName="X-FromAppId">
<constant>DataLayer</constant>
</setHeader>
<setHeader headerName="X-TransactionId">
<constant>gdf1</constant>
</setHeader>
<!-- Invoke the REST client, using our console input as the content body of our request. -->
<!-- Note that we provide the paths to the client certificate and keystore, as well as -->
<!-- the obfuscated password for the keystore. -->
<to uri="ecomp-rest: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&ecompKeystore=c:/dev/dl_microservice/target/swm/package/nix/dist_files/opt/app/ajsc-aai-data-layer-microservice/bundleconfig/etc/auth/tomcat_keystore&ecompKeystorePassword=70c87528c88dcd9f9c2558d30e817868"/>
</route>