Skip to content
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

Updating default intervals and strategy based on .NET findings. #26715

Merged
merged 3 commits into from
Feb 9, 2022
Merged
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 @@ -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