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