Skip to content

Commit 6c2781a

Browse files
authored
Updating default intervals and strategy based on .NET findings. (Azure#26715)
* Updating default intervals and strategy based on .NET findings. * Updates CHANGELOG * Adding revapi suppression for change in constant.
1 parent 27b2616 commit 6c2781a

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

eng/code-quality-reports/src/main/resources/revapi/revapi.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@
192192
"code": "java.method.added",
193193
"new": "method java.lang.String com.azure.storage.common.StorageSharedKeyCredential::generateAuthorizationHeader(java.net.URL, java.lang.String, com.azure.core.http.HttpHeaders, boolean)",
194194
"justification": "New method added to SharedKeyCredential in common not intended for use by customers. Only public for access by other packages."
195+
},
196+
{
197+
"code": "java.field.removedWithConstant",
198+
"old": "field com.azure.messaging.eventhubs.EventProcessorClientBuilder.DEFAULT_OWNERSHIP_EXPIRATION_FACTOR",
199+
"justification": "The default ownership expiration factor is an implementation detail that users can override via configuration."
195200
}
196201
]
197202
}

sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
### Other Changes
1414

15+
- Updated load balancing strategy, ownership interval, and load balancing intervals. ([#25039](https://github.com/Azure/azure-sdk-for-java/issues/25039))
16+
1517
## 5.10.4 (2022-01-18)
1618

1719
### Other Changes

sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessorClientBuilder.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,16 @@ public class EventProcessorClientBuilder implements
110110
AmqpTrait<EventProcessorClientBuilder>,
111111
ConfigurationTrait<EventProcessorClientBuilder> {
112112
/**
113-
* Default load balancing update interval.
113+
* Default load balancing update interval. Balancing interval should account for latency between the client
114+
* and the storage account.
114115
*/
115-
public static final Duration DEFAULT_LOAD_BALANCING_UPDATE_INTERVAL = Duration.ofSeconds(10);
116+
public static final Duration DEFAULT_LOAD_BALANCING_UPDATE_INTERVAL = Duration.ofSeconds(30);
116117

117118
/**
118-
* Default ownership expiration factor.
119+
* Default ownership expiration.
119120
*/
120-
public static final int DEFAULT_OWNERSHIP_EXPIRATION_FACTOR = 6;
121+
public static final Duration DEFAULT_OWNERSHIP_EXPIRATION_INTERVAL = Duration.ofMinutes(2);
122+
121123
private final ClientLogger logger = new ClientLogger(EventProcessorClientBuilder.class);
122124

123125
private final EventHubClientBuilder eventHubClientBuilder;
@@ -134,7 +136,7 @@ public class EventProcessorClientBuilder implements
134136
private Duration maxWaitTime;
135137
private Duration loadBalancingUpdateInterval;
136138
private Duration partitionOwnershipExpirationInterval;
137-
private LoadBalancingStrategy loadBalancingStrategy = LoadBalancingStrategy.BALANCED;
139+
private LoadBalancingStrategy loadBalancingStrategy = LoadBalancingStrategy.GREEDY;
138140

139141
/**
140142
* Creates a new instance of {@link EventProcessorClientBuilder}.
@@ -735,9 +737,9 @@ public EventProcessorClient buildEventProcessorClient() {
735737
if (loadBalancingUpdateInterval == null) {
736738
loadBalancingUpdateInterval = DEFAULT_LOAD_BALANCING_UPDATE_INTERVAL;
737739
}
740+
738741
if (partitionOwnershipExpirationInterval == null) {
739-
partitionOwnershipExpirationInterval = loadBalancingUpdateInterval.multipliedBy(
740-
DEFAULT_OWNERSHIP_EXPIRATION_FACTOR);
742+
partitionOwnershipExpirationInterval = DEFAULT_OWNERSHIP_EXPIRATION_INTERVAL;
741743
}
742744

743745
return new EventProcessorClient(eventHubClientBuilder, consumerGroup,

0 commit comments

Comments
 (0)