-
Notifications
You must be signed in to change notification settings - Fork 0
/
KafkaeEXAMPLE.jmx
243 lines (240 loc) · 14.1 KB
/
KafkaeEXAMPLE.jmx
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.4.1">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="KAFKA" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">true</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group (producer)" enabled="false">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</ThreadGroup>
<hashTree>
<com.gslab.pepper.config.plaintext.PlainTextConfigElement guiclass="TestBeanGUI" testclass="com.gslab.pepper.config.plaintext.PlainTextConfigElement" testname="Pepper-Box PlainText Config" enabled="true">
<stringProp name="jsonSchema">{
"UUID":${__UUID}
}</stringProp>
<stringProp name="placeHolder">MESSAGE</stringProp>
</com.gslab.pepper.config.plaintext.PlainTextConfigElement>
<hashTree/>
<com.gslab.pepper.config.serialized.SerializedConfigElement guiclass="TestBeanGUI" testclass="com.gslab.pepper.config.serialized.SerializedConfigElement" testname="Pepper-Box Serialized Config" enabled="false">
<stringProp name="className"><POJO class name></stringProp>
<collectionProp name="objProperties"/>
<stringProp name="placeHolder">MESSAGE</stringProp>
</com.gslab.pepper.config.serialized.SerializedConfigElement>
<hashTree/>
<JavaSampler guiclass="JavaTestSamplerGui" testclass="JavaSampler" testname="Java Request" enabled="true">
<elementProp name="arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="bootstrap.servers" elementType="Argument">
<stringProp name="Argument.name">bootstrap.servers</stringProp>
<stringProp name="Argument.value">localhost:9092</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="zookeeper.servers" elementType="Argument">
<stringProp name="Argument.name">zookeeper.servers</stringProp>
<stringProp name="Argument.value"><Zookeeper List></stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="kafka.topic.name" elementType="Argument">
<stringProp name="Argument.name">kafka.topic.name</stringProp>
<stringProp name="Argument.value">invoices-service-invoice-database-events</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="key.serializer" elementType="Argument">
<stringProp name="Argument.name">key.serializer</stringProp>
<stringProp name="Argument.value">org.apache.kafka.common.serialization.StringSerializer</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="value.serializer" elementType="Argument">
<stringProp name="Argument.name">value.serializer</stringProp>
<stringProp name="Argument.value">org.apache.kafka.common.serialization.StringSerializer</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="compression.type" elementType="Argument">
<stringProp name="Argument.name">compression.type</stringProp>
<stringProp name="Argument.value">none</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="batch.size" elementType="Argument">
<stringProp name="Argument.name">batch.size</stringProp>
<stringProp name="Argument.value">16384</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="linger.ms" elementType="Argument">
<stringProp name="Argument.name">linger.ms</stringProp>
<stringProp name="Argument.value">0</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="buffer.memory" elementType="Argument">
<stringProp name="Argument.name">buffer.memory</stringProp>
<stringProp name="Argument.value">33554432</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="acks" elementType="Argument">
<stringProp name="Argument.name">acks</stringProp>
<stringProp name="Argument.value">1</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="send.buffer.bytes" elementType="Argument">
<stringProp name="Argument.name">send.buffer.bytes</stringProp>
<stringProp name="Argument.value">131072</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="receive.buffer.bytes" elementType="Argument">
<stringProp name="Argument.name">receive.buffer.bytes</stringProp>
<stringProp name="Argument.value">32768</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="security.protocol" elementType="Argument">
<stringProp name="Argument.name">security.protocol</stringProp>
<stringProp name="Argument.value">PLAINTEXT</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="message.placeholder.key" elementType="Argument">
<stringProp name="Argument.name">message.placeholder.key</stringProp>
<stringProp name="Argument.value">MESSAGE</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="kerberos.auth.enabled" elementType="Argument">
<stringProp name="Argument.name">kerberos.auth.enabled</stringProp>
<stringProp name="Argument.value">NO</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="java.security.auth.login.config" elementType="Argument">
<stringProp name="Argument.name">java.security.auth.login.config</stringProp>
<stringProp name="Argument.value"><JAAS File Location></stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="java.security.krb5.conf" elementType="Argument">
<stringProp name="Argument.name">java.security.krb5.conf</stringProp>
<stringProp name="Argument.value"><krb5.conf location></stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="sasl.kerberos.service.name" elementType="Argument">
<stringProp name="Argument.name">sasl.kerberos.service.name</stringProp>
<stringProp name="Argument.value">kafka</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="classname">com.gslab.pepper.sampler.PepperBoxKafkaSampler</stringProp>
</JavaSampler>
<hashTree/>
</hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group (consumer)" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</ThreadGroup>
<hashTree>
<JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="JSR223 Sampler" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="parameters"></stringProp>
<stringProp name="filename"></stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="script">import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.common.header.Header;
import org.apache.kafka.common.header.internals.RecordHeader;
import org.apache.kafka.common.header.Headers;
import org.apache.kafka.common.header.internals.RecordHeaders;
Properties props = new Properties();
props.put("bootstrap.servers", "localhost:9092");
props.put("group.id", "my-group");
props.put("enable.auto.commit", "true");
props.put("auto.commit.interval.ms", "1000");
props.put("session.timeout.ms", "30000");
props.put("key.deserializer",
"org.apache.kafka.common.serialization.StringDeserializer");
props.put("value.deserializer",
"org.apache.kafka.common.serialization.StringDeserializer");
org.apache.kafka.clients.consumer.KafkaConsumer<String, String> consumer = new org.apache.kafka.clients.consumer.KafkaConsumer<String, String>(props);
consumer.subscribe(Arrays.asList("invoices-service-invoice-database-events"));
System.out.println("Subscribed to topic " + "first_topic");
int i = 0;
long t = System.currentTimeMillis();
long end = t + 5000;
f = new FileOutputStream(".\\data.csv", true);
p = new PrintStream(f);
while (System.currentTimeMillis()<end)
{
org.apache.kafka.clients.consumer.ConsumerRecords<String, String> records = consumer.poll(100);
for (org.apache.kafka.clients.consumer.ConsumerRecord<String, String> record : records)
{
System.out.println("offset = " + record.offset() +" value = " + record.value( ));
p.println( "offset = " + record.offset() +" value = " + record.value());
}
consumer.commitSync();
}
consumer.close();
p.close();
f.close();</stringProp>
</JSR223Sampler>
<hashTree/>
</hashTree>
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<name>saveConfig</name>
<value class="SampleSaveConfiguration">
<time>true</time>
<latency>true</latency>
<timestamp>true</timestamp>
<success>true</success>
<label>true</label>
<code>true</code>
<message>true</message>
<threadName>true</threadName>
<dataType>true</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>true</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>false</xml>
<fieldNames>true</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<sentBytes>true</sentBytes>
<url>true</url>
<threadCounts>true</threadCounts>
<idleTime>true</idleTime>
<connectTime>true</connectTime>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
</hashTree>
</hashTree>
</jmeterTestPlan>