Improvements from anna fork
[anna.git] / example / diameter / launcher / deployments / aots / agents / KAFKA / ACTIONS.md
1 # KAFKA actions
2
3 ## consume_json
4
5 Consume until reception of json message.
6
7 Arguments: json[, auto_offset_reset, timeout, background, debug]
8 * json: json file that we want to wait for ('any' to skip matching).
9 * timeout: timeout for the operation in seconds.
10 * auto_offset_reset: auto offset reset (earliest, latest, etc.). By default: latest.
11 * background: "yes"|["no"]. Executes the step in background. By default is blocking, allowing to gather the result code for the step.
12 * debug: "yes"|["no"]. Python kafka library debug information.
13
14 Example:
15 ```
16 - action: SMPC/consume_json
17   arguments:
18     json: expected.json
19     timeout: 5
20     auto_offset_reset: earliest
21 ```
22
23 ## produce_json
24
25 Produces a json message to the kafka message bus.
26
27 Arguments: json[, delay_ms, background, debug]
28 * json: json file that we want to produce.
29 * delay_ms: delay before producing in milliseconds.
30 * background: "yes"|["no"]. Executes the step in background. By default is blocking, allowing to gather the result code for the step.
31 * debug: "yes"|["no"]. Python kafka library debug information.
32
33 Example:
34 ```
35 - action: SMPC/produce_json:
36   arguments:
37     json: produced.json
38 ```
39
40 ## admin
41
42 Administration actions.
43
44 Arguments: operation[, debug]
45 * operation: only 'clean_topic' implemented
46 * debug: "yes"|["no"]. Python kafka library debug information.
47
48 clean_topic: administration operation to clear message bus in case you want to consume reading earliest messages in the queue. By default, consumer offsets to latest message, but it won't see nothing if it is launched after production of the expected message. Depending on the way you define the test case, you will need clean or not the message bus.
49
50 * Example(1): given an 'SMPC' kafka node:
51
52 ```
53 - action: SMPC/admin:
54   arguments:
55     operation: clean_topic
56
57 - action: AF/send_xml_to_entity
58   arguments:
59     xml: AAR.xml
60
61 - action: SPMC/consume_json
62   arguments:
63     json: expected.json
64     auto_offset_reset: earliest
65 ```
66
67 * Example(2): given an 'SMPC' kafka node:
68
69 ```
70 - action: SPMC/consume_json
71   arguments:
72     json: expected.json
73     background: "yes"
74
75 - action: AF/send_xml_to_entity
76   arguments:
77     xml: AAR.xml
78 ```
79
80 * Example(3): given an 'SMPC' kafka node:
81
82 ```
83 - action: SPMC/produce_json
84   arguments:
85     json: produced.json
86     delay_ms: 200
87     background: "yes"
88
89 - action: AF/wait_xml_from_entity
90   arguments:
91     xml: ASR.xml
92 ```
93