|
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 |
|
@@ -1004,6 +1004,12 @@ void proto(@Autowired ApplicationContext context) {
|
1004 | 1004 | this.registry.setAlwaysStartAfterRefresh(true);
|
1005 | 1005 | }
|
1006 | 1006 |
|
| 1007 | + @Test |
| 1008 | + void classLevelTwoInstancesSameClass() { |
| 1009 | + assertThat(this.registry.getListenerContainer("multiTwoOne")).isNotNull(); |
| 1010 | + assertThat(this.registry.getListenerContainer("multiTwoTwo")).isNotNull(); |
| 1011 | + } |
| 1012 | + |
1007 | 1013 | @Configuration
|
1008 | 1014 | @EnableKafka
|
1009 | 1015 | @EnableTransactionManagement(proxyTargetClass = true)
|
@@ -1739,6 +1745,16 @@ ProtoListener proto() {
|
1739 | 1745 | return new ProtoListener();
|
1740 | 1746 | }
|
1741 | 1747 |
|
| 1748 | + @Bean |
| 1749 | + MultiListenerTwoInstances multiInstanceOne() { |
| 1750 | + return new MultiListenerTwoInstances("multiTwoOne"); |
| 1751 | + } |
| 1752 | + |
| 1753 | + @Bean |
| 1754 | + MultiListenerTwoInstances multiInstanceTwo() { |
| 1755 | + return new MultiListenerTwoInstances("multiTwoTwo"); |
| 1756 | + } |
| 1757 | + |
1742 | 1758 | }
|
1743 | 1759 |
|
1744 | 1760 | static class ProtoListener {
|
@@ -2480,6 +2496,25 @@ public String bar(@Payload(required = false) KafkaNull nul,
|
2480 | 2496 |
|
2481 | 2497 | }
|
2482 | 2498 |
|
| 2499 | + @KafkaListener(id = "#{__listener.id}", topics = "multiWithTwoInstances", autoStartup = "false") |
| 2500 | + static class MultiListenerTwoInstances { |
| 2501 | + |
| 2502 | + private final String id; |
| 2503 | + |
| 2504 | + MultiListenerTwoInstances(String id) { |
| 2505 | + this.id = id; |
| 2506 | + } |
| 2507 | + |
| 2508 | + public String getId() { |
| 2509 | + return this.id; |
| 2510 | + } |
| 2511 | + |
| 2512 | + @KafkaHandler |
| 2513 | + void listen(String in) { |
| 2514 | + } |
| 2515 | + |
| 2516 | + } |
| 2517 | + |
2483 | 2518 | public interface Bar {
|
2484 | 2519 |
|
2485 | 2520 | String getBar();
|
|
0 commit comments