182182 "annotated25" , "annotated25reply1" , "annotated25reply2" , "annotated26" , "annotated27" , "annotated28" ,
183183 "annotated29" , "annotated30" , "annotated30reply" , "annotated31" , "annotated32" , "annotated33" ,
184184 "annotated34" , "annotated35" , "annotated36" , "annotated37" , "foo" , "manualStart" , "seekOnIdle" ,
185- "annotated38" , "annotated38reply" , "annotated39" , "annotated40" , "annotated41" , "annotated42" })
185+ "annotated38" , "annotated38reply" , "annotated39" , "annotated40" , "annotated41" , "annotated42" ,
186+ "annotated43" , "annotated43reply" })
186187@ TestPropertySource (properties = "spel.props=fetch.min.bytes=420000,max.poll.records=10" )
187188public class EnableKafkaIntegrationTests {
188189
@@ -431,6 +432,15 @@ public void testInterface() throws Exception {
431432 template .send ("annotated7" , 0 , "foo" );
432433 template .flush ();
433434 assertThat (this .ifaceListener .getLatch1 ().await (60 , TimeUnit .SECONDS )).isTrue ();
435+ Map <String , Object > consumerProps = new HashMap <>(this .consumerFactory .getConfigurationProperties ());
436+ consumerProps .put (ConsumerConfig .GROUP_ID_CONFIG , "testInterface" );
437+ ConsumerFactory <Integer , String > cf = new DefaultKafkaConsumerFactory <>(consumerProps );
438+ Consumer <Integer , String > consumer = cf .createConsumer ();
439+ this .embeddedKafka .consumeFromAnEmbeddedTopic (consumer , "annotated43reply" );
440+ template .send ("annotated43" , 0 , "foo" );
441+ ConsumerRecord <Integer , String > reply = KafkaTestUtils .getSingleRecord (consumer , "annotated43reply" );
442+ assertThat (reply ).extracting (rec -> rec .value ()).isEqualTo ("FOO" );
443+ consumer .close ();
434444 }
435445
436446 @ Test
@@ -1373,8 +1383,8 @@ public MultiListenerNoDefault multiNoDefault() {
13731383 }
13741384
13751385 @ Bean
1376- public MultiListenerSendTo multiListenerSendTo () {
1377- return new MultiListenerSendTo ();
1386+ public MultiListenerSendToImpl multiListenerSendTo () {
1387+ return new MultiListenerSendToImpl ();
13781388 }
13791389
13801390 @ Bean
@@ -2296,6 +2306,10 @@ interface IfaceListener<T> {
22962306
22972307 void listen (T foo );
22982308
2309+ @ SendTo ("annotated43reply" )
2310+ @ KafkaListener (id = "ifcR" , topics = "annotated43" )
2311+ String reply (String in );
2312+
22992313 }
23002314
23012315 static class IfaceListenerImpl implements IfaceListener <String > {
@@ -2316,6 +2330,11 @@ public void listenTx(String foo) {
23162330 latch2 .countDown ();
23172331 }
23182332
2333+ @ Override
2334+ public String reply (String in ) {
2335+ return in .toUpperCase ();
2336+ }
2337+
23192338 public CountDownLatch getLatch1 () {
23202339 return latch1 ;
23212340 }
@@ -2422,15 +2441,25 @@ public void bar(@Valid ValidatedClass val) {
24222441
24232442 @ KafkaListener (id = "multiSendTo" , topics = "annotated25" )
24242443 @ SendTo ("annotated25reply1" )
2425- static class MultiListenerSendTo {
2444+ interface MultiListenerSendTo {
2445+
2446+ @ KafkaHandler
2447+ String foo (String in );
24262448
24272449 @ KafkaHandler
2450+ @ SendTo ("!{'annotated25reply2'}" )
2451+ String bar (KafkaNull nul , int key );
2452+
2453+ }
2454+
2455+ static class MultiListenerSendToImpl implements MultiListenerSendTo {
2456+
2457+ @ Override
24282458 public String foo (String in ) {
24292459 return in .toUpperCase ();
24302460 }
24312461
2432- @ KafkaHandler
2433- @ SendTo ("!{'annotated25reply2'}" )
2462+ @ Override
24342463 public String bar (@ Payload (required = false ) KafkaNull nul ,
24352464 @ Header (KafkaHeaders .RECEIVED_KEY ) int key ) {
24362465 return "BAR" ;
0 commit comments