Add subscription name to Pulsar mapped config props
The subscription name config prop was not being set on the Pulsar listener container properties. This commit adds the subscription name to the Pulsar property mappers. See gh-42067
This commit is contained in:
committed by
Andy Wilkinson
parent
f024c193e4
commit
62ef81b5c8
@@ -190,6 +190,7 @@ final class PulsarPropertiesMapper {
|
||||
PulsarProperties.Consumer.Subscription properties = this.properties.getConsumer().getSubscription();
|
||||
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
|
||||
map.from(properties::getType).to(containerProperties::setSubscriptionType);
|
||||
map.from(properties::getName).to(containerProperties::setSubscriptionName);
|
||||
}
|
||||
|
||||
private void customizePulsarContainerListenerProperties(PulsarContainerProperties containerProperties) {
|
||||
|
||||
@@ -88,6 +88,7 @@ final class PulsarReactivePropertiesMapper {
|
||||
PulsarProperties.Consumer.Subscription properties = this.properties.getConsumer().getSubscription();
|
||||
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
|
||||
map.from(properties::getType).to(containerProperties::setSubscriptionType);
|
||||
map.from(properties::getName).to(containerProperties::setSubscriptionName);
|
||||
}
|
||||
|
||||
private void customizePulsarContainerListenerProperties(ReactivePulsarContainerProperties<?> containerProperties) {
|
||||
|
||||
@@ -262,12 +262,14 @@ class PulsarPropertiesMapperTests {
|
||||
void customizeContainerProperties() {
|
||||
PulsarProperties properties = new PulsarProperties();
|
||||
properties.getConsumer().getSubscription().setType(SubscriptionType.Shared);
|
||||
properties.getConsumer().getSubscription().setName("my-subscription");
|
||||
properties.getListener().setSchemaType(SchemaType.AVRO);
|
||||
properties.getListener().setObservationEnabled(true);
|
||||
properties.getTransaction().setEnabled(true);
|
||||
PulsarContainerProperties containerProperties = new PulsarContainerProperties("my-topic-pattern");
|
||||
new PulsarPropertiesMapper(properties).customizeContainerProperties(containerProperties);
|
||||
assertThat(containerProperties.getSubscriptionType()).isEqualTo(SubscriptionType.Shared);
|
||||
assertThat(containerProperties.getSubscriptionName()).isEqualTo("my-subscription");
|
||||
assertThat(containerProperties.getSchemaType()).isEqualTo(SchemaType.AVRO);
|
||||
assertThat(containerProperties.isObservationEnabled()).isTrue();
|
||||
assertThat(containerProperties.transactions().isEnabled()).isTrue();
|
||||
|
||||
@@ -120,11 +120,13 @@ class PulsarReactivePropertiesMapperTests {
|
||||
void customizeContainerProperties() {
|
||||
PulsarProperties properties = new PulsarProperties();
|
||||
properties.getConsumer().getSubscription().setType(SubscriptionType.Shared);
|
||||
properties.getConsumer().getSubscription().setName("my-subscription");
|
||||
properties.getListener().setSchemaType(SchemaType.AVRO);
|
||||
properties.getListener().setConcurrency(10);
|
||||
ReactivePulsarContainerProperties<Object> containerProperties = new ReactivePulsarContainerProperties<>();
|
||||
new PulsarReactivePropertiesMapper(properties).customizeContainerProperties(containerProperties);
|
||||
assertThat(containerProperties.getSubscriptionType()).isEqualTo(SubscriptionType.Shared);
|
||||
assertThat(containerProperties.getSubscriptionName()).isEqualTo("my-subscription");
|
||||
assertThat(containerProperties.getSchemaType()).isEqualTo(SchemaType.AVRO);
|
||||
assertThat(containerProperties.getConcurrency()).isEqualTo(10);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user