03e1139a0302e76be03da0b7be2ebca29124dc5a
[policy/apex-pdp.git] /
1 //
2 // ============LICENSE_START=======================================================
3 //  Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 // ================================================================================
5 // This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
6 // Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
7 // 
8 // SPDX-License-Identifier: CC-BY-4.0
9 // ============LICENSE_END=========================================================
10 //
11 // @author Sven van der Meer (sven.van.der.meer@ericsson.com)
12 //
13
14 == Kafka IO
15
16 Kafka IO is supported by the APEX Kafka plugin.
17 The configurations below are examples.
18 APEX will take any configuration inside the parameter object and forward it to Kafka.
19 More information on Kafka specific configuration parameters can be found in the Kafka documentation:
20
21 * link:https://kafka.apache.org/090/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html[Kafka Consumer Class]
22 * link:https://kafka.apache.org/090/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html[Kafka Producer Class]
23
24
25
26 === Kafka Input
27
28 APEX will receive events from the Apache Kafka messaging system.
29 The input is uni-directional, an engine will only receive events from the input but not send any event to the input.
30
31 [source%nowrap,json]
32 ----
33 "carrierTechnologyParameters" : {
34   "carrierTechnology" : "KAFKA", <1>
35   "parameterClassName" :
36     "org.onap.policy.apex.plugins.event.carrier.kafka.KAFKACarrierTechnologyParameters",
37   "parameters" : {
38     "bootstrapServers"  : "localhost:49092", <2>
39     "groupId"           : "apex-group-id", <3>
40     "enableAutoCommit"  : true, <4>
41     "autoCommitTime"    : 1000, <5>
42     "sessionTimeout"    : 30000, <6>
43     "consumerPollTime"  : 100, <7>
44     "consumerTopicList" : ["apex-in-0", "apex-in-1"], <8>
45     "keyDeserializer"   :
46         "org.apache.kafka.common.serialization.StringDeserializer", <9>
47     "valueDeserializer" :
48         "org.apache.kafka.common.serialization.StringDeserializer" <10>
49   }
50 }
51 ----
52
53 <1> set Kafka as carrier technology
54 <2> bootstrap server and port
55 <3> a group identifier
56 <4> flag for auto-commit
57 <5> auto-commit timeout in milliseconds
58 <6> session timeout in milliseconds
59 <7> consumer poll time in milliseconds
60 <8> consumer topic list
61 <9> key for the Kafka de-serializer
62 <10> value for the Kafka de-serializer
63
64
65 === Kafka Output
66
67 APEX will send events to the Apache Kafka messaging system.
68 The output is uni-directional, an engine will send events to the output but not receive any event from the output.
69
70
71 [source%nowrap,json]
72 ----
73 "carrierTechnologyParameters" : {
74   "carrierTechnology" : "KAFKA", <1>
75   "parameterClassName" :
76     "org.onap.policy.apex.plugins.event.carrier.kafka.KAFKACarrierTechnologyParameters",
77   "parameters" : {
78     "bootstrapServers"  : "localhost:49092", <2>
79     "acks"              : "all", <3>
80     "retries"           : 0, <4>
81     "batchSize"         : 16384, <5>
82     "lingerTime"        : 1, <6>
83     "bufferMemory"      : 33554432, <7>
84     "producerTopic"     : "apex-out", <8>
85     "keySerializer"     :
86         "org.apache.kafka.common.serialization.StringSerializer", <9>
87     "valueSerializer"   :
88         "org.apache.kafka.common.serialization.StringSerializer" <10>
89   }
90 }
91 ----
92
93 <1> set Kafka as carrier technology
94 <2> bootstrap server and port
95 <3> acknowledgement strategy
96 <4> number of retries
97 <5> batch size
98 <6> time to linger in milliseconds
99 <7> buffer memory in byte
100 <8> producer topic
101 <9> key for the Kafka serializer
102 <10> value for the Kafka serializer