Skip to content

Commit 5600a02

Browse files
committed
Merge pull request #39931 from izeye
* pr/39931: Polish gh-38559 Closes gh-39931
2 parents 736f712 + c5df4e3 commit 5600a02

File tree

6 files changed

+15
-11
lines changed

6 files changed

+15
-11
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/pulsar/PulsarProperties.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -901,15 +901,15 @@ public void setParam(Map<String, String> param) {
901901
public static class Failover {
902902

903903
/**
904-
* Cluster Failover Policy.
904+
* Cluster failover policy.
905905
*/
906906
private FailoverPolicy failoverPolicy = FailoverPolicy.ORDER;
907907

908908
/**
909909
* Delay before the Pulsar client switches from the primary cluster to the backup
910910
* cluster.
911911
*/
912-
private Duration failOverDelay;
912+
private Duration failoverDelay;
913913

914914
/**
915915
* Delay before the Pulsar client switches from the backup cluster to the primary
@@ -923,7 +923,7 @@ public static class Failover {
923923
private Duration checkInterval;
924924

925925
/**
926-
* List of backupClusters The backup cluster is chosen in the sequence of the
926+
* List of backup clusters. The backup cluster is chosen in the sequence of the
927927
* given list. If all backup clusters are available, the Pulsar client chooses the
928928
* first backup cluster.
929929
*/
@@ -937,12 +937,12 @@ public void setFailoverPolicy(FailoverPolicy failoverPolicy) {
937937
this.failoverPolicy = failoverPolicy;
938938
}
939939

940-
public Duration getFailOverDelay() {
941-
return this.failOverDelay;
940+
public Duration getFailoverDelay() {
941+
return this.failoverDelay;
942942
}
943943

944-
public void setFailOverDelay(Duration failOverDelay) {
945-
this.failOverDelay = failOverDelay;
944+
public void setFailoverDelay(Duration failoverDelay) {
945+
this.failoverDelay = failoverDelay;
946946
}
947947

948948
public Duration getSwitchBackDelay() {

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/pulsar/PulsarPropertiesMapper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private void customizeServiceUrlProviderBuilder(Consumer<String> serviceUrlConsu
8383
map.from(connectionDetails::getBrokerUrl).to(autoClusterFailoverBuilder::primary);
8484
map.from(secondaryAuths::keySet).as(ArrayList::new).to(autoClusterFailoverBuilder::secondary);
8585
map.from(failoverProperties::getFailoverPolicy).to(autoClusterFailoverBuilder::failoverPolicy);
86-
map.from(failoverProperties::getFailOverDelay).to(timeoutProperty(autoClusterFailoverBuilder::failoverDelay));
86+
map.from(failoverProperties::getFailoverDelay).to(timeoutProperty(autoClusterFailoverBuilder::failoverDelay));
8787
map.from(failoverProperties::getSwitchBackDelay)
8888
.to(timeoutProperty(autoClusterFailoverBuilder::switchBackDelay));
8989
map.from(failoverProperties::getCheckInterval).to(timeoutProperty(autoClusterFailoverBuilder::checkInterval));

spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

+4
Original file line numberDiff line numberDiff line change
@@ -2060,6 +2060,10 @@
20602060
"name": "spring.neo4j.uri",
20612061
"defaultValue": "bolt://localhost:7687"
20622062
},
2063+
{
2064+
"name": "spring.pulsar.client.failover.failover-policy",
2065+
"defaultValue": "order"
2066+
},
20632067
{
20642068
"name": "spring.pulsar.function.enabled",
20652069
"type": "java.lang.Boolean",

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/pulsar/PulsarConfigurationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void whenHasUserDefinedFailoverPropertiesAddsToClient() {
144144
customizeAction.accept(pulsarClientBuilderCustomizer, target);
145145
InOrder ordered = inOrder(target);
146146
ordered.verify(target).serviceUrlProvider(Mockito.any(AutoClusterFailover.class));
147-
assertThat(pulsarProperties.getClient().getFailover().getFailOverDelay())
147+
assertThat(pulsarProperties.getClient().getFailover().getFailoverDelay())
148148
.isEqualTo(Duration.ofSeconds(15));
149149
assertThat(pulsarProperties.getClient().getFailover().getSwitchBackDelay())
150150
.isEqualTo(Duration.ofSeconds(30));

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/pulsar/PulsarPropertiesMapperTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void customizeClientBuilderWhenHasFailover() {
112112
properties.getClient().setServiceUrl("https://used.example.com");
113113
properties.getClient().getFailover().setFailoverPolicy(FailoverPolicy.ORDER);
114114
properties.getClient().getFailover().setCheckInterval(Duration.ofSeconds(5));
115-
properties.getClient().getFailover().setFailOverDelay(Duration.ofSeconds(30));
115+
properties.getClient().getFailover().setFailoverDelay(Duration.ofSeconds(30));
116116
properties.getClient().getFailover().setSwitchBackDelay(Duration.ofSeconds(30));
117117
properties.getClient().getFailover().setBackupClusters(List.of(backupCluster1, backupCluster2));
118118
PulsarConnectionDetails connectionDetails = mock(PulsarConnectionDetails.class);

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/pulsar/PulsarPropertiesTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void bindFailover() {
105105
Failover failoverProperties = properties.getFailover();
106106
List<BackupCluster> backupClusters = properties.getFailover().getBackupClusters();
107107
assertThat(properties.getServiceUrl()).isEqualTo("my-service-url");
108-
assertThat(failoverProperties.getFailOverDelay()).isEqualTo(Duration.ofMillis(30000));
108+
assertThat(failoverProperties.getFailoverDelay()).isEqualTo(Duration.ofMillis(30000));
109109
assertThat(failoverProperties.getSwitchBackDelay()).isEqualTo(Duration.ofMillis(15000));
110110
assertThat(failoverProperties.getCheckInterval()).isEqualTo(Duration.ofMillis(1000));
111111
assertThat(backupClusters.get(0).getServiceUrl()).isEqualTo("backup-service-url-1");

0 commit comments

Comments
 (0)