summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/site-docs/adoc/fragments/ct-restrequestor-io.adoc
blob: 320c99880219b810f50f6f101b57c217eec8a039 (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
//
// ============LICENSE_START=======================================================
//  Copyright (C) 2016-2018 Ericsson. All rights reserved.
// ================================================================================
// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
// 
// SPDX-License-Identifier: CC-BY-4.0
// ============LICENSE_END=========================================================
//
// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
//

== REST Requestor IO

APEX can act as REST requestor on the input as well as on the output interface.
The media type is `application/json`, so this plugin does only work with the JSON Event protocol.

=== REST Requestor Input

APEX will connect to a given URL to request an input.

[source%nowrap,json]
----
"carrierTechnologyParameters": {
  "carrierTechnology": "RESTREQUESTOR", <1>
  "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters",
  "parameters": {
    "url": "http://localhost:54321/some/path/to/rest/resource", <2>
    "httpMethod": "POST", <3>
    "restRequestTimeout": 2000 <4>
  }
},
----

<1> set REST requestor as carrier technology
<2> the URL of the HTTP server for events
<3> use HTTP PUT (remove this line to use HTTP POST)
<4> request timeout in milliseconds

Further settings are required on the consumer to define the event that is requested, for example:

[source%nowrap,json]
----
"eventName": "GuardResponseEvent", <1>
"eventNameFilter": "GuardResponseEvent", <2>
"requestorMode": true, <3>
"requestorPeer": "GuardRequestorProducer", <4>
"requestorTimeout": 500 <5>
----

<1> the event name
<2> a filter on the event
<3> the mode of the requestor
<4> a peer for the requestor
<5> a general request timeout


=== REST Requestor Output

APEX will connect to a given URL to send events, but not receive any events.

[source%nowrap,json]
----
"carrierTechnologyParameters": {
  "carrierTechnology": "RESTREQUESTOR", <1>
  "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters"
},
----

<1> set REST requestor as carrier technology

Further settings are required on the consumer to define the event that is requested, for example:

[source%nowrap,json]
----
"eventNameFilter": "GuardRequestEvent", <1>
"requestorMode": true, <2>
"requestorPeer": "GuardRequestorConsumer", <3>
"requestorTimeout": 500 <4>
----

<1> a filter on the event
<2> the mode of the requestor
<3> a peer for the requestor
<4> a general request timeout