185185 "annotated25" , "annotated25reply1" , "annotated25reply2" , "annotated26" , "annotated27" , "annotated28" ,
186186 "annotated29" , "annotated30" , "annotated30reply" , "annotated31" , "annotated32" , "annotated33" ,
187187 "annotated34" , "annotated35" , "annotated36" , "annotated37" , "foo" , "manualStart" , "seekOnIdle" ,
188- "annotated38" , "annotated38reply" , "annotated39" , "annotated40" , "annotated41" , "annotated42" })
188+ "annotated38" , "annotated38reply" , "annotated39" , "annotated40" , "annotated41" , "annotated42" ,
189+ "annotated43" , "annotated43reply" })
189190@ TestPropertySource (properties = "spel.props=fetch.min.bytes=420000,max.poll.records=10" )
190191public class EnableKafkaIntegrationTests {
191192
@@ -439,6 +440,15 @@ public void testInterface() throws Exception {
439440 template .send ("annotated7" , 0 , "foo" );
440441 template .flush ();
441442 assertThat (this .ifaceListener .getLatch1 ().await (60 , TimeUnit .SECONDS )).isTrue ();
443+ Map <String , Object > consumerProps = new HashMap <>(this .consumerFactory .getConfigurationProperties ());
444+ consumerProps .put (ConsumerConfig .GROUP_ID_CONFIG , "testInterface" );
445+ ConsumerFactory <Integer , String > cf = new DefaultKafkaConsumerFactory <>(consumerProps );
446+ Consumer <Integer , String > consumer = cf .createConsumer ();
447+ this .embeddedKafka .consumeFromAnEmbeddedTopic (consumer , "annotated43reply" );
448+ template .send ("annotated43" , 0 , "foo" );
449+ ConsumerRecord <Integer , String > reply = KafkaTestUtils .getSingleRecord (consumer , "annotated43reply" );
450+ assertThat (reply ).extracting (rec -> rec .value ()).isEqualTo ("FOO" );
451+ consumer .close ();
442452 }
443453
444454 @ Test
@@ -1376,8 +1386,8 @@ public MultiListenerNoDefault multiNoDefault() {
13761386 }
13771387
13781388 @ Bean
1379- public MultiListenerSendTo multiListenerSendTo () {
1380- return new MultiListenerSendTo ();
1389+ public MultiListenerSendToImpl multiListenerSendTo () {
1390+ return new MultiListenerSendToImpl ();
13811391 }
13821392
13831393 @ Bean
@@ -2299,6 +2309,10 @@ interface IfaceListener<T> {
22992309
23002310 void listen (T foo );
23012311
2312+ @ SendTo ("annotated43reply" )
2313+ @ KafkaListener (id = "ifcR" , topics = "annotated43" )
2314+ String reply (String in );
2315+
23022316 }
23032317
23042318 static class IfaceListenerImpl implements IfaceListener <String > {
@@ -2319,6 +2333,11 @@ public void listenTx(String foo) {
23192333 latch2 .countDown ();
23202334 }
23212335
2336+ @ Override
2337+ public String reply (String in ) {
2338+ return in .toUpperCase ();
2339+ }
2340+
23222341 public CountDownLatch getLatch1 () {
23232342 return latch1 ;
23242343 }
@@ -2425,15 +2444,25 @@ public void bar(@Valid ValidatedClass val) {
24252444
24262445 @ KafkaListener (id = "multiSendTo" , topics = "annotated25" )
24272446 @ SendTo ("annotated25reply1" )
2428- static class MultiListenerSendTo {
2447+ interface MultiListenerSendTo {
2448+
2449+ @ KafkaHandler
2450+ String foo (String in );
24292451
24302452 @ KafkaHandler
2453+ @ SendTo ("!{'annotated25reply2'}" )
2454+ String bar (KafkaNull nul , int key );
2455+
2456+ }
2457+
2458+ static class MultiListenerSendToImpl implements MultiListenerSendTo {
2459+
2460+ @ Override
24312461 public String foo (String in ) {
24322462 return in .toUpperCase ();
24332463 }
24342464
2435- @ KafkaHandler
2436- @ SendTo ("!{'annotated25reply2'}" )
2465+ @ Override
24372466 public String bar (@ Payload (required = false ) KafkaNull nul ,
24382467 @ Header (KafkaHeaders .RECEIVED_KEY ) int key ) {
24392468 return "BAR" ;
0 commit comments