Skip to content

Commit

Permalink
Enabled RequestResponseChannelCache (CBS, Management channel cache) a…
Browse files Browse the repository at this point in the history
…nd ReactorSessionCache by default.
  • Loading branch information
anuchandy committed Oct 29, 2024
1 parent e9f1ef0 commit af7b587
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
2 changes: 2 additions & 0 deletions sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Features Added

- Enabled RequestResponseChannelCache (CBS, Management channel cache) and ReactorSessionCache by default. ([42641](https://github.com/Azure/azure-sdk-for-java/pull/42641))

### Breaking Changes

### Bugs Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ private static final class V2StackSupport {
private static final ConfigurationProperty<Boolean> SESSION_CHANNEL_CACHE_PROPERTY
= ConfigurationPropertyBuilder.ofBoolean(SESSION_CHANNEL_CACHE_KEY)
.environmentVariableName(SESSION_CHANNEL_CACHE_KEY)
.defaultValue(false) // "SessionCache" and "RequestResponseChannelCache" requires explicit opt in along with v2 stack opt in.
.defaultValue(true) // "SessionCache" and "RequestResponseChannelCache" is auto on when v2 stack is also opted in.
.shared(true)
.build();
private final AtomicReference<Boolean> sessionChannelCacheFlag = new AtomicReference<>();
Expand Down Expand Up @@ -1267,13 +1267,13 @@ boolean isSessionSyncReceiveEnabled(Configuration configuration) {
}

/**
* SessionCache and RequestResponseChannelCache not opted-in default, but the application may opt in.
* SessionCache and RequestResponseChannelCache is on by default, but the application may opt out.
*
* @param configuration the client configuration.
* @return true if SessionCache and RequestResponseChannelCache is opted-in.
* @return true if SessionCache and RequestResponseChannelCache is not opted-out.
*/
boolean isSessionChannelCacheEnabled(Configuration configuration) {
return isOptedIn(configuration, SESSION_CHANNEL_CACHE_PROPERTY, sessionChannelCacheFlag);
return !isOptedOut(configuration, SESSION_CHANNEL_CACHE_PROPERTY, sessionChannelCacheFlag);
}

// Obtain the shared connection-cache based on the V2-Stack.
Expand Down Expand Up @@ -1784,11 +1784,17 @@ public ServiceBusSessionProcessorClientBuilder processError(Consumer<ServiceBusE

/**
* Max concurrent messages that this processor should process.
*
* <p>
* This setting allows the application to configure the number of concurrent calls to the message processing
* callback {@link ServiceBusSessionProcessorClientBuilder#processMessage(Consumer)} per session, allowing
* parallel processing of multiple messages across sessions.
* </p>
* @param maxConcurrentCalls max concurrent messages that this processor should process.
*
* @return The updated {@link ServiceBusSessionProcessorClientBuilder} object.
* @throws IllegalArgumentException if {@code maxConcurrentCalls} is less than 1.
*
* @see <a href="https://learn.microsoft.com/azure/developer/java/sdk/troubleshooting-messaging-service-bus-overview#concurrency-in-servicebusprocessorclient">Concurrency in ServiceBusProcessorClient</a>
*/
public ServiceBusSessionProcessorClientBuilder maxConcurrentCalls(int maxConcurrentCalls) {
if (maxConcurrentCalls < 1) {
Expand Down Expand Up @@ -2502,9 +2508,17 @@ public ServiceBusProcessorClientBuilder maxAutoLockRenewDuration(Duration maxAut
/**
* Max concurrent messages that this processor should process. By default, this is set to 1.
*
* <p>
* This setting allows the application to configure the number of concurrent calls to the message processing
* callback {@link ServiceBusProcessorClientBuilder#processMessage(Consumer)}, enabling the processing of
* multiple messages in parallel.
* </p>
*
* @param maxConcurrentCalls max concurrent messages that this processor should process.
* @return The updated {@link ServiceBusProcessorClientBuilder} object.
* @throws IllegalArgumentException if the {@code maxConcurrentCalls} is set to a value less than 1.
*
* @see <a href="https://learn.microsoft.com/azure/developer/java/sdk/troubleshooting-messaging-service-bus-overview#concurrency-in-servicebusprocessorclient">Concurrency in ServiceBusProcessorClient</a>
*/
public ServiceBusProcessorClientBuilder maxConcurrentCalls(int maxConcurrentCalls) {
if (maxConcurrentCalls < 1) {
Expand Down

0 comments on commit af7b587

Please sign in to comment.