Skip to content

Commit

Permalink
Updating default intervals and strategy based on .NET findings. (#26715)
Browse files Browse the repository at this point in the history
* Updating default intervals and strategy based on .NET findings.

* Updates CHANGELOG

* Adding revapi suppression for change in constant.
  • Loading branch information
conniey authored Feb 9, 2022
1 parent 27b2616 commit 6c2781a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@
"code": "java.method.added",
"new": "method java.lang.String com.azure.storage.common.StorageSharedKeyCredential::generateAuthorizationHeader(java.net.URL, java.lang.String, com.azure.core.http.HttpHeaders, boolean)",
"justification": "New method added to SharedKeyCredential in common not intended for use by customers. Only public for access by other packages."
},
{
"code": "java.field.removedWithConstant",
"old": "field com.azure.messaging.eventhubs.EventProcessorClientBuilder.DEFAULT_OWNERSHIP_EXPIRATION_FACTOR",
"justification": "The default ownership expiration factor is an implementation detail that users can override via configuration."
}
]
}
Expand Down
2 changes: 2 additions & 0 deletions sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

### Other Changes

- Updated load balancing strategy, ownership interval, and load balancing intervals. ([#25039](https://github.com/Azure/azure-sdk-for-java/issues/25039))

## 5.10.4 (2022-01-18)

### Other Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,16 @@ public class EventProcessorClientBuilder implements
AmqpTrait<EventProcessorClientBuilder>,
ConfigurationTrait<EventProcessorClientBuilder> {
/**
* Default load balancing update interval.
* Default load balancing update interval. Balancing interval should account for latency between the client
* and the storage account.
*/
public static final Duration DEFAULT_LOAD_BALANCING_UPDATE_INTERVAL = Duration.ofSeconds(10);
public static final Duration DEFAULT_LOAD_BALANCING_UPDATE_INTERVAL = Duration.ofSeconds(30);

/**
* Default ownership expiration factor.
* Default ownership expiration.
*/
public static final int DEFAULT_OWNERSHIP_EXPIRATION_FACTOR = 6;
public static final Duration DEFAULT_OWNERSHIP_EXPIRATION_INTERVAL = Duration.ofMinutes(2);

private final ClientLogger logger = new ClientLogger(EventProcessorClientBuilder.class);

private final EventHubClientBuilder eventHubClientBuilder;
Expand All @@ -134,7 +136,7 @@ public class EventProcessorClientBuilder implements
private Duration maxWaitTime;
private Duration loadBalancingUpdateInterval;
private Duration partitionOwnershipExpirationInterval;
private LoadBalancingStrategy loadBalancingStrategy = LoadBalancingStrategy.BALANCED;
private LoadBalancingStrategy loadBalancingStrategy = LoadBalancingStrategy.GREEDY;

/**
* Creates a new instance of {@link EventProcessorClientBuilder}.
Expand Down Expand Up @@ -735,9 +737,9 @@ public EventProcessorClient buildEventProcessorClient() {
if (loadBalancingUpdateInterval == null) {
loadBalancingUpdateInterval = DEFAULT_LOAD_BALANCING_UPDATE_INTERVAL;
}

if (partitionOwnershipExpirationInterval == null) {
partitionOwnershipExpirationInterval = loadBalancingUpdateInterval.multipliedBy(
DEFAULT_OWNERSHIP_EXPIRATION_FACTOR);
partitionOwnershipExpirationInterval = DEFAULT_OWNERSHIP_EXPIRATION_INTERVAL;
}

return new EventProcessorClient(eventHubClientBuilder, consumerGroup,
Expand Down

0 comments on commit 6c2781a

Please sign in to comment.