|
176 | 176 | * @author Venil Noronha |
177 | 177 | * @author Dimitri Penner |
178 | 178 | * @author Nakul Mishra |
| 179 | + * @author Soby Chacko |
179 | 180 | */ |
180 | 181 | @SpringJUnitConfig |
181 | 182 | @DirtiesContext |
182 | | -@EmbeddedKafka(topics = { "annotated1", "annotated2", "annotated3", |
| 183 | +@EmbeddedKafka(topics = { "annotated1", "annotated2", "annotated3", "annotated3x", |
183 | 184 | "annotated4", "annotated5", "annotated6", "annotated7", "annotated8", "annotated8reply", |
184 | 185 | "annotated9", "annotated10", |
185 | 186 | "annotated11", "annotated12", "annotated13", "annotated14", "annotated15", "annotated16", "annotated17", |
@@ -313,6 +314,10 @@ public void manyTests() throws Exception { |
313 | 314 | assertThat(this.listener.capturedRecord.value()).isEqualTo("foo"); |
314 | 315 | assertThat(this.config.listen3Exception).isNotNull(); |
315 | 316 |
|
| 317 | + template.send("annotated3x", 0, "foo"); |
| 318 | + assertThat(this.listener.latch3x.await(60, TimeUnit.SECONDS)).isTrue(); |
| 319 | + assertThat(this.listener.capturedRecord.value()).isEqualTo("foo"); |
| 320 | + |
316 | 321 | template.send("annotated4", 0, "foo"); |
317 | 322 | assertThat(this.listener.latch4.await(60, TimeUnit.SECONDS)).isTrue(); |
318 | 323 | assertThat(this.listener.capturedRecord.value()).isEqualTo("foo"); |
@@ -1840,6 +1845,8 @@ static class Listener implements ConsumerSeekAware { |
1840 | 1845 |
|
1841 | 1846 | final CountDownLatch latch3 = new CountDownLatch(1); |
1842 | 1847 |
|
| 1848 | + final CountDownLatch latch3x = new CountDownLatch(1); |
| 1849 | + |
1843 | 1850 | final CountDownLatch latch4 = new CountDownLatch(1); |
1844 | 1851 |
|
1845 | 1852 | final CountDownLatch latch5 = new CountDownLatch(1); |
@@ -2018,6 +2025,14 @@ public void listen3(ConsumerRecord<?, ?> record) { |
2018 | 2025 | this.latch3.countDown(); |
2019 | 2026 | } |
2020 | 2027 |
|
| 2028 | + @KafkaListener(id = "partitionExpression", topicPartitions = @TopicPartition(topic = "${topicThree:annotated3x}", |
| 2029 | + partitions = "${zero:0}", |
| 2030 | + partitionOffsets = @PartitionOffset(partition = "#{'*'}", initialOffset = "0"))) |
| 2031 | + public void listenPartitionSpelExpression(ConsumerRecord<?, ?> record) { |
| 2032 | + this.capturedRecord = record; |
| 2033 | + this.latch3x.countDown(); |
| 2034 | + } |
| 2035 | + |
2021 | 2036 | @KafkaListener(id = "#{'qux'}", topics = "annotated4", |
2022 | 2037 | containerFactory = "kafkaManualAckListenerContainerFactory", containerGroup = "qux#{'Group'}", |
2023 | 2038 | properties = { |
|
0 commit comments