@@ -74,6 +74,7 @@ public void before(Scenario scenario) {
74
74
* @param resource the resource
75
75
* @param type the type
76
76
* @param messages the messages
77
+ * @throws MessageNotDefinedException the message not defined exception
77
78
*/
78
79
@ Given ("send message event (.*) in partition (.*) on (.*) with type (.*)$" )
79
80
public void produceMessageWithPartition (String eventName , Integer partition , String resource ,
@@ -85,13 +86,19 @@ public void produceMessageWithPartition(String eventName, Integer partition, Str
85
86
scenario .log (builtMessage .toString ());
86
87
87
88
KafkaProducerClient
88
- .sendMessage (resource , topic , builtMessage .getId (), builtMessage .getMessage (),
89
+ .sendMessage (resource , topic , builtMessage .getKey (), builtMessage .getMessage (),
89
90
partition , builtMessage .getHeaders ());
90
91
} else {
91
92
Assertions .assertTrue (false , eventName + " is not configured for any topic. or " + type +" is not configured" );
92
93
}
93
94
}
94
95
96
+ /**
97
+ * Produce message.
98
+ *
99
+ * @param sleep the sleep
100
+ * @throws InterruptedException the interrupted exception
101
+ */
95
102
@ Given ("pause message process for (.*) milliseconds$" )
96
103
public void produceMessage (long sleep ) throws InterruptedException {
97
104
Thread .sleep (sleep );
@@ -104,6 +111,7 @@ public void produceMessage(long sleep) throws InterruptedException {
104
111
* @param resource the resource
105
112
* @param type the type
106
113
* @param messages the messages
114
+ * @throws MessageNotDefinedException the message not defined exception
107
115
*/
108
116
@ Given ("send message event (.*) on (.*) with type (.*)$" )
109
117
public void produceMessage (String eventName , String resource , String type ,
@@ -113,9 +121,9 @@ public void produceMessage(String eventName, String resource, String type,
113
121
if (topic != null && messageType != null ) {
114
122
MessageType builtMessage = messageType .buildProducerMessage (messages );
115
123
scenario .log (builtMessage .toString ());
116
- if (builtMessage .getId () != null ) {
124
+ if (builtMessage .getKey () != null ) {
117
125
KafkaProducerClient
118
- .sendMessage (resource , topic , builtMessage .getId (), builtMessage .getMessage (),
126
+ .sendMessage (resource , topic , builtMessage .getKey (), builtMessage .getMessage (),
119
127
null , builtMessage .getHeaders ());
120
128
} else {
121
129
KafkaProducerClient
@@ -134,6 +142,7 @@ public void produceMessage(String eventName, String resource, String type,
134
142
* @param resource the resource
135
143
* @param type the type
136
144
* @param messages the messages
145
+ * @throws MessageNotDefinedException the message not defined exception
137
146
*/
138
147
@ Given ("send inline message event (.*) on (.*) with type (.*)$" )
139
148
public void produceMessage (String eventName , String resource , String type ,
@@ -143,9 +152,9 @@ public void produceMessage(String eventName, String resource, String type,
143
152
if (topic != null && messageType != null ) {
144
153
MessageType builtMessage = messageType .buildProducerMessage (messages );
145
154
scenario .log (builtMessage .toString ());
146
- if (builtMessage .getId () != null ) {
155
+ if (builtMessage .getKey () != null ) {
147
156
KafkaProducerClient
148
- .sendMessage (resource , topic , builtMessage .getId (), builtMessage .getMessage (),
157
+ .sendMessage (resource , topic , builtMessage .getKey (), builtMessage .getMessage (),
149
158
null , builtMessage .getHeaders ());
150
159
} else {
151
160
KafkaProducerClient
@@ -164,6 +173,7 @@ public void produceMessage(String eventName, String resource, String type,
164
173
* @param resource the resource
165
174
* @param type the type
166
175
* @param messages the messages
176
+ * @throws MessageNotDefinedException the message not defined exception
167
177
*/
168
178
@ Given ("send mapson message event (.*) on (.*) with type (.*)$" )
169
179
public void produceMessageMapson (String eventName , String resource , String type ,
@@ -173,9 +183,9 @@ public void produceMessageMapson(String eventName, String resource, String type,
173
183
if (topic != null && messageType != null ) {
174
184
MessageType builtMessage = messageType .buildProducerMessage (messages );
175
185
scenario .log (builtMessage .toString ());
176
- if (builtMessage .getId () != null ) {
186
+ if (builtMessage .getKey () != null ) {
177
187
KafkaProducerClient
178
- .sendMessage (resource , topic , builtMessage .getId (), builtMessage .getMessage (),
188
+ .sendMessage (resource , topic , builtMessage .getKey (), builtMessage .getMessage (),
179
189
null , builtMessage .getHeaders ());
180
190
} else {
181
191
KafkaProducerClient
@@ -195,9 +205,11 @@ public void produceMessageMapson(String eventName, String resource, String type,
195
205
* @param eventName the event name
196
206
* @param id the id
197
207
* @param resource the resource
208
+ * @param type the type
198
209
* @param csvson the csvson
199
- * @throws InterruptedException the interrupted exception
200
- * @throws BadInputDataException bad input data exception
210
+ * @throws InterruptedException the interrupted exception
211
+ * @throws BadInputDataException bad input data exception
212
+ * @throws MessageNotDefinedException the message not defined exception
201
213
*/
202
214
@ Given ("verify (.*) contains (.*) on (.*) with type (.*)$" )
203
215
public void verifyConsumedJSONObject (String eventName , String id , String resource , String type ,
@@ -228,8 +240,10 @@ public void verifyConsumedJSONObject(String eventName, String id, String resourc
228
240
* @param eventName the event name
229
241
* @param id the id
230
242
* @param resource the resource
243
+ * @param type the type
231
244
* @param keyValue the key value
232
- * @throws InterruptedException interrupted exception
245
+ * @throws InterruptedException interrupted exception
246
+ * @throws MessageNotDefinedException the message not defined exception
233
247
*/
234
248
@ Given ("verify-by-elements (.*) contains (.*) on (.*) with type (.*)$" )
235
249
public void consumeMessage (String eventName , String id , String resource , String type ,
0 commit comments