|
185 | 185 | "annotated29", "annotated30", "annotated30reply", "annotated31", "annotated32", "annotated33", |
186 | 186 | "annotated34", "annotated35", "annotated36", "annotated37", "foo", "manualStart", "seekOnIdle", |
187 | 187 | "annotated38", "annotated38reply", "annotated39", "annotated40", "annotated41", "annotated42", |
188 | | - "annotated43", "annotated43reply"}) |
| 188 | + "annotated43", "annotated43reply" }) |
189 | 189 | @TestPropertySource(properties = "spel.props=fetch.min.bytes=420000,max.poll.records=10") |
190 | 190 | public class EnableKafkaIntegrationTests { |
191 | 191 |
|
@@ -1009,6 +1009,12 @@ void proto(@Autowired ApplicationContext context) { |
1009 | 1009 | this.registry.setAlwaysStartAfterRefresh(true); |
1010 | 1010 | } |
1011 | 1011 |
|
| 1012 | + @Test |
| 1013 | + void classLevelTwoInstancesSameClass() { |
| 1014 | + assertThat(this.registry.getListenerContainer("multiTwoOne")).isNotNull(); |
| 1015 | + assertThat(this.registry.getListenerContainer("multiTwoTwo")).isNotNull(); |
| 1016 | + } |
| 1017 | + |
1012 | 1018 | @Configuration |
1013 | 1019 | @EnableKafka |
1014 | 1020 | @EnableTransactionManagement(proxyTargetClass = true) |
@@ -1731,6 +1737,16 @@ ProtoListener proto() { |
1731 | 1737 | return new ProtoListener(); |
1732 | 1738 | } |
1733 | 1739 |
|
| 1740 | + @Bean |
| 1741 | + MultiListenerTwoInstances multiInstanceOne() { |
| 1742 | + return new MultiListenerTwoInstances("multiTwoOne"); |
| 1743 | + } |
| 1744 | + |
| 1745 | + @Bean |
| 1746 | + MultiListenerTwoInstances multiInstanceTwo() { |
| 1747 | + return new MultiListenerTwoInstances("multiTwoTwo"); |
| 1748 | + } |
| 1749 | + |
1734 | 1750 | } |
1735 | 1751 |
|
1736 | 1752 | static class ProtoListener { |
@@ -2461,6 +2477,25 @@ public String bar(@Payload(required = false) KafkaNull nul, |
2461 | 2477 |
|
2462 | 2478 | } |
2463 | 2479 |
|
| 2480 | + @KafkaListener(id = "#{__listener.id}", topics = "multiWithTwoInstances", autoStartup = "false") |
| 2481 | + static class MultiListenerTwoInstances { |
| 2482 | + |
| 2483 | + private final String id; |
| 2484 | + |
| 2485 | + MultiListenerTwoInstances(String id) { |
| 2486 | + this.id = id; |
| 2487 | + } |
| 2488 | + |
| 2489 | + public String getId() { |
| 2490 | + return this.id; |
| 2491 | + } |
| 2492 | + |
| 2493 | + @KafkaHandler |
| 2494 | + void listen(String in) { |
| 2495 | + } |
| 2496 | + |
| 2497 | + } |
| 2498 | + |
2464 | 2499 | public interface Bar { |
2465 | 2500 |
|
2466 | 2501 | String getBar(); |
|
0 commit comments