Skip to content

Polish gh-38559 #39931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -901,15 +901,15 @@ public void setParam(Map<String, String> param) {
public static class Failover {

/**
* Cluster Failover Policy.
* Cluster failover policy.
*/
private FailoverPolicy failoverPolicy = FailoverPolicy.ORDER;

/**
* Delay before the Pulsar client switches from the primary cluster to the backup
* cluster.
*/
private Duration failOverDelay;
private Duration failoverDelay;

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

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

public Duration getFailOverDelay() {
return this.failOverDelay;
public Duration getFailoverDelay() {
return this.failoverDelay;
}

public void setFailOverDelay(Duration failOverDelay) {
this.failOverDelay = failOverDelay;
public void setFailoverDelay(Duration failoverDelay) {
this.failoverDelay = failoverDelay;
}

public Duration getSwitchBackDelay() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private void customizeServiceUrlProviderBuilder(Consumer<String> serviceUrlConsu
map.from(connectionDetails::getBrokerUrl).to(autoClusterFailoverBuilder::primary);
map.from(secondaryAuths::keySet).as(ArrayList::new).to(autoClusterFailoverBuilder::secondary);
map.from(failoverProperties::getFailoverPolicy).to(autoClusterFailoverBuilder::failoverPolicy);
map.from(failoverProperties::getFailOverDelay).to(timeoutProperty(autoClusterFailoverBuilder::failoverDelay));
map.from(failoverProperties::getFailoverDelay).to(timeoutProperty(autoClusterFailoverBuilder::failoverDelay));
map.from(failoverProperties::getSwitchBackDelay)
.to(timeoutProperty(autoClusterFailoverBuilder::switchBackDelay));
map.from(failoverProperties::getCheckInterval).to(timeoutProperty(autoClusterFailoverBuilder::checkInterval));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2060,6 +2060,10 @@
"name": "spring.neo4j.uri",
"defaultValue": "bolt://localhost:7687"
},
{
"name": "spring.pulsar.client.failover.failover-policy",
"defaultValue": "order"
},
{
"name": "spring.pulsar.function.enabled",
"type": "java.lang.Boolean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void whenHasUserDefinedFailoverPropertiesAddsToClient() {
customizeAction.accept(pulsarClientBuilderCustomizer, target);
InOrder ordered = inOrder(target);
ordered.verify(target).serviceUrlProvider(Mockito.any(AutoClusterFailover.class));
assertThat(pulsarProperties.getClient().getFailover().getFailOverDelay())
assertThat(pulsarProperties.getClient().getFailover().getFailoverDelay())
.isEqualTo(Duration.ofSeconds(15));
assertThat(pulsarProperties.getClient().getFailover().getSwitchBackDelay())
.isEqualTo(Duration.ofSeconds(30));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void customizeClientBuilderWhenHasFailover() {
properties.getClient().setServiceUrl("https://used.example.com");
properties.getClient().getFailover().setFailoverPolicy(FailoverPolicy.ORDER);
properties.getClient().getFailover().setCheckInterval(Duration.ofSeconds(5));
properties.getClient().getFailover().setFailOverDelay(Duration.ofSeconds(30));
properties.getClient().getFailover().setFailoverDelay(Duration.ofSeconds(30));
properties.getClient().getFailover().setSwitchBackDelay(Duration.ofSeconds(30));
properties.getClient().getFailover().setBackupClusters(List.of(backupCluster1, backupCluster2));
PulsarConnectionDetails connectionDetails = mock(PulsarConnectionDetails.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void bindFailover() {
Failover failoverProperties = properties.getFailover();
List<BackupCluster> backupClusters = properties.getFailover().getBackupClusters();
assertThat(properties.getServiceUrl()).isEqualTo("my-service-url");
assertThat(failoverProperties.getFailOverDelay()).isEqualTo(Duration.ofMillis(30000));
assertThat(failoverProperties.getFailoverDelay()).isEqualTo(Duration.ofMillis(30000));
assertThat(failoverProperties.getSwitchBackDelay()).isEqualTo(Duration.ofMillis(15000));
assertThat(failoverProperties.getCheckInterval()).isEqualTo(Duration.ofMillis(1000));
assertThat(backupClusters.get(0).getServiceUrl()).isEqualTo("backup-service-url-1");
Expand Down
Loading