|
50 | 50 | import org.springframework.pulsar.config.PulsarListenerEndpointRegistry;
|
51 | 51 | import org.springframework.pulsar.core.CachingPulsarProducerFactory;
|
52 | 52 | import org.springframework.pulsar.core.DefaultPulsarProducerFactory;
|
| 53 | +import org.springframework.pulsar.core.DefaultPulsarReaderFactory; |
53 | 54 | import org.springframework.pulsar.core.DefaultSchemaResolver;
|
54 | 55 | import org.springframework.pulsar.core.DefaultTopicResolver;
|
55 | 56 | import org.springframework.pulsar.core.PulsarAdministration;
|
56 | 57 | import org.springframework.pulsar.core.PulsarConsumerFactory;
|
57 | 58 | import org.springframework.pulsar.core.PulsarProducerFactory;
|
| 59 | +import org.springframework.pulsar.core.PulsarReaderFactory; |
58 | 60 | import org.springframework.pulsar.core.PulsarTemplate;
|
59 | 61 | import org.springframework.pulsar.core.SchemaResolver;
|
60 | 62 | import org.springframework.pulsar.core.SchemaResolver.SchemaResolverCustomizer;
|
@@ -490,6 +492,35 @@ private void assertHasProducerFactoryOfType(Class<?> producerFactoryType,
|
490 | 492 |
|
491 | 493 | }
|
492 | 494 |
|
| 495 | + @Nested |
| 496 | + class ReaderFactoryAutoConfigurationTests { |
| 497 | + |
| 498 | + @Test |
| 499 | + void readerFactoryIsAutoConfiguredByDefault() { |
| 500 | + contextRunner.run((context) -> assertThat(context).hasNotFailed().hasSingleBean(PulsarReaderFactory.class) |
| 501 | + .getBean(PulsarReaderFactory.class).isExactlyInstanceOf(DefaultPulsarReaderFactory.class)); |
| 502 | + } |
| 503 | + |
| 504 | + @Test |
| 505 | + void readerFactoryCanBeConfigured() { |
| 506 | + contextRunner.withPropertyValues("spring.pulsar.reader.topic-names=foo", |
| 507 | + "spring.pulsar.reader.receiver-queue-size=200", "spring.pulsar.reader.reader-name=test-reader", |
| 508 | + "spring.pulsar.reader.subscription-name=test-subscription", |
| 509 | + "spring.pulsar.reader.subscription-role-prefix=test-prefix", |
| 510 | + "spring.pulsar.reader.read-compacted=true", "spring.pulsar.reader.reset-include-head=true") |
| 511 | + .run((context -> assertThat(context).hasNotFailed().getBean(PulsarReaderFactory.class) |
| 512 | + .extracting("readerConfig") |
| 513 | + .hasFieldOrPropertyWithValue("topicNames", new String[] { "foo" }) |
| 514 | + .hasFieldOrPropertyWithValue("receiverQueueSize", 200) |
| 515 | + .hasFieldOrPropertyWithValue("readerName", "test-reader") |
| 516 | + .hasFieldOrPropertyWithValue("subscriptionName", "test-subscription") |
| 517 | + .hasFieldOrPropertyWithValue("subscriptionRolePrefix", "test-prefix") |
| 518 | + .hasFieldOrPropertyWithValue("readCompacted", true) |
| 519 | + .hasFieldOrPropertyWithValue("resetIncludeHead", true))); |
| 520 | + } |
| 521 | + |
| 522 | + } |
| 523 | + |
493 | 524 | @Configuration(proxyBeanMethods = false)
|
494 | 525 | static class InterceptorTestConfiguration {
|
495 | 526 |
|
|
0 commit comments