@@ -14,7 +14,7 @@ use crate::{
14
14
publish_error:: PublishErrorResponse , query_offset:: QueryOffsetResponse ,
15
15
query_publisher_sequence:: QueryPublisherResponse , sasl_handshake:: SaslHandshakeResponse ,
16
16
superstream_partitions:: SuperStreamPartitionsResponse ,
17
- superstream_route:: SuperStreamRouteResponse , tune:: TunesCommand ,
17
+ superstream_route:: SuperStreamRouteResponse , tune:: TunesCommand , consumer_update :: ConsumerUpdateCommand
18
18
} ,
19
19
error:: DecodeError ,
20
20
protocol:: commands:: * ,
@@ -72,6 +72,7 @@ pub enum ResponseKind {
72
72
ExchangeCommandVersions ( ExchangeCommandVersionsResponse ) ,
73
73
SuperStreamPartitions ( SuperStreamPartitionsResponse ) ,
74
74
SuperStreamRoute ( SuperStreamRouteResponse ) ,
75
+ ConsumerUpdate ( ConsumerUpdateCommand ) ,
75
76
}
76
77
77
78
impl Response {
@@ -107,6 +108,9 @@ impl Response {
107
108
ResponseKind :: SuperStreamRoute ( super_stream_route_command) => {
108
109
Some ( super_stream_route_command. correlation_id )
109
110
}
111
+ ResponseKind :: ConsumerUpdate ( consumer_update_command) => {
112
+ Some ( consumer_update_command. correlation_id )
113
+ }
110
114
}
111
115
}
112
116
@@ -188,6 +192,8 @@ impl Decoder for Response {
188
192
. map ( |( remaining, kind) | ( remaining, ResponseKind :: SuperStreamPartitions ( kind) ) ) ?,
189
193
COMMAND_ROUTE => SuperStreamRouteResponse :: decode ( input)
190
194
. map ( |( remaining, kind) | ( remaining, ResponseKind :: SuperStreamRoute ( kind) ) ) ?,
195
+ COMMAND_CONSUMER_UPDATE => ConsumerUpdateCommand :: decode ( input)
196
+ . map ( |( remaining, kind) | ( remaining, ResponseKind :: ConsumerUpdate ( kind) ) ) ?,
191
197
n => return Err ( DecodeError :: UnsupportedResponseType ( n) ) ,
192
198
} ;
193
199
Ok ( ( input, Response { header, kind } ) )
@@ -228,22 +234,24 @@ mod tests {
228
234
query_publisher_sequence:: QueryPublisherResponse ,
229
235
sasl_handshake:: SaslHandshakeResponse ,
230
236
superstream_partitions:: SuperStreamPartitionsResponse ,
231
- superstream_route:: SuperStreamRouteResponse , tune:: TunesCommand ,
237
+ superstream_route:: SuperStreamRouteResponse , tune:: TunesCommand , consumer_update :: ConsumerUpdateCommand
232
238
} ,
233
239
protocol:: {
234
240
commands:: {
235
241
COMMAND_CLOSE , COMMAND_DELIVER , COMMAND_HEARTBEAT , COMMAND_METADATA ,
236
242
COMMAND_METADATA_UPDATE , COMMAND_OPEN , COMMAND_PARTITIONS , COMMAND_PEER_PROPERTIES ,
237
243
COMMAND_PUBLISH_CONFIRM , COMMAND_PUBLISH_ERROR , COMMAND_QUERY_OFFSET ,
238
244
COMMAND_QUERY_PUBLISHER_SEQUENCE , COMMAND_ROUTE , COMMAND_SASL_AUTHENTICATE ,
239
- COMMAND_SASL_HANDSHAKE , COMMAND_TUNE ,
245
+ COMMAND_SASL_HANDSHAKE , COMMAND_TUNE , COMMAND_CONSUMER_UPDATE ,
240
246
} ,
241
247
version:: PROTOCOL_VERSION ,
242
248
} ,
243
249
response:: COMMAND_EXCHANGE_COMMAND_VERSIONS ,
244
250
types:: Header ,
245
251
ResponseCode ,
246
252
} ;
253
+ use crate :: protocol:: commands:: COMMAND_CONSUMER_UPDATE ;
254
+
247
255
impl Encoder for ResponseKind {
248
256
fn encoded_size ( & self ) -> u32 {
249
257
match self {
@@ -273,6 +281,9 @@ mod tests {
273
281
ResponseKind :: SuperStreamRoute ( super_stream_response) => {
274
282
super_stream_response. encoded_size ( )
275
283
}
284
+ ResponseKind :: ConsumerUpdate ( consumer_update_response) => {
285
+ consumer_update_response. encoded_size ( )
286
+ }
276
287
}
277
288
}
278
289
@@ -307,6 +318,9 @@ mod tests {
307
318
ResponseKind :: SuperStreamRoute ( super_stream_command_versions) => {
308
319
super_stream_command_versions. encode ( writer)
309
320
}
321
+ ResponseKind :: ConsumerUpdate ( consumer_update_command_version) => {
322
+ consumer_update_command_version. encode ( writer)
323
+ }
310
324
}
311
325
}
312
326
}
@@ -494,4 +508,13 @@ mod tests {
494
508
COMMAND_ROUTE
495
509
) ;
496
510
}
511
+
512
+ #[ test]
513
+ fn consumer_update_response_test ( ) {
514
+ response_test ! (
515
+ ConsumerUpdateCommand ,
516
+ ResponseKind :: ConsumerUpdate ,
517
+ COMMAND_CONSUMER_UPDATE
518
+ ) ;
519
+ }
497
520
}
0 commit comments