Describe the bug
When using ServiceBusAdministrationClient.updateSubscription() to update a subscription's defaultMessageTimeToLive property, the change is silently ignored. The SDK correctly sets the value on the local SubscriptionProperties object, but Azure returns the original (or default infinite) TTL value. No error is thrown.
This issue was introduced in SDK version 7.16.0-beta.1 when Jackson Dataformat XML was replaced with azure-xml. The same issue was previously fixed for queues in PR #32158 (XML element ordering), but the fix was not applied to subscriptions.
Exception or Stack Trace
No exception is thrown. The update silently fails - Azure ignores the TTL change and returns the original value.
To Reproduce
Steps to reproduce the behavior:
- Create a topic
- Create a subscription with a specific TTL (e.g., 70000 seconds)
- Update the subscription with a different TTL (e.g., 50000 seconds)
- Observe that the returned TTL is not updated (stays at 70000 or reverts to infinite)
Code Snippet
import com.azure.messaging.servicebus.administration.ServiceBusAdministrationClient;
import com.azure.messaging.servicebus.administration.ServiceBusAdministrationClientBuilder;
import com.azure.messaging.servicebus.administration.models.SubscriptionProperties;
import java.time.Duration;
public class SubscriptionTTLUpdateBug {
public static void main(String[] args) {
String connectionString = "your-connection-string";
String topicName = "test-topic";
String subscriptionName = "test-subscription";
ServiceBusAdministrationClient adminClient = new ServiceBusAdministrationClientBuilder()
.connectionString(connectionString)
.buildClient();
// Step 1: Create topic
adminClient.createTopic(topicName);
// Step 2: Create subscription with TTL = 70000 seconds
SubscriptionProperties createResult = adminClient.createSubscription(
topicName,
subscriptionName,
new CreateSubscriptionOptions().setDefaultMessageTimeToLive(Duration.ofSeconds(70000))
);
System.out.println("Created TTL: " + createResult.getDefaultMessageTimeToLive());
// Output: Created TTL: PT19H26M40S (70000 seconds) - CORRECT
// Step 3: Get subscription and update TTL to 50000 seconds
SubscriptionProperties props = adminClient.getSubscription(topicName, subscriptionName);
System.out.println("Current TTL before update: " + props.getDefaultMessageTimeToLive());
// Output: PT19H26M40S (70000 seconds) - CORRECT
props.setDefaultMessageTimeToLive(Duration.ofSeconds(50000));
System.out.println("TTL after local set: " + props.getDefaultMessageTimeToLive());
// Output: PT13H53M20S (50000 seconds) - Local object is correct
// Step 4: Call updateSubscription
SubscriptionProperties updateResult = adminClient.updateSubscription(props);
System.out.println("TTL returned from Azure: " + updateResult.getDefaultMessageTimeToLive());
// Output: PT256204778H48M5.4775807S (infinite!) - BUG: Azure ignored the update!
// Step 5: Verify by getting subscription again
SubscriptionProperties verifyResult = adminClient.getSubscription(topicName, subscriptionName);
System.out.println("Verified TTL: " + verifyResult.getDefaultMessageTimeToLive());
// Output: PT256204778H48M5.4775807S (infinite!) - Confirms update was ignored
}
}
Expected behavior
After calling updateSubscription() with defaultMessageTimeToLive set to 50000 seconds (PT13H53M20S):
- The returned
SubscriptionProperties should show TTL = PT13H53M20S
- A subsequent
getSubscription() should also return TTL = PT13H53M20S
Actual behavior
- The returned
SubscriptionProperties shows TTL = PT256204778H48M5.4775807S (infinite)
- The TTL change is silently ignored
- No error or exception is thrown
Screenshots
N/A
Setup (please complete the following information):
- OS: macOS / Linux / Windows (issue is server-side, OS independent)
- IDE: IntelliJ IDEA
- Library/Libraries:
com.azure:azure-messaging-servicebus:7.17.17
com.azure:azure-xml:1.2.1
- Java version: 17
- App Server/Environment: Standalone Java application
- Frameworks: None (plain Java)
Additional context
Root Cause Analysis
This issue appears to be related to XML element ordering in the update request. A similar issue was fixed for queues in PR #32158:
The PR description states: "The updated xml should have exact same order as what we get from service."
The fix for queues reordered XML elements in QueueDescription and TopicDescription, but SubscriptionDescription was not updated.
Workaround
Set defaultMessageTimeToLive during subscription creation instead of updating:
// This works:
adminClient.createSubscription(topicName, subscriptionName,
new CreateSubscriptionOptions().setDefaultMessageTimeToLive(Duration.ofSeconds(70000)));
// This does NOT work:
SubscriptionProperties props = adminClient.getSubscription(topicName, subscriptionName);
props.setDefaultMessageTimeToLive(Duration.ofSeconds(50000));
adminClient.updateSubscription(props); // TTL change is ignored
Version Information
- Issue introduced in: 7.16.0-beta.1 (Jackson → azure-xml migration)
- Issue confirmed in: 7.17.17
- Last working version: 7.14.x (used Jackson Dataformat XML)
Related Issues
Information Checklist
Describe the bug
When using
ServiceBusAdministrationClient.updateSubscription()to update a subscription'sdefaultMessageTimeToLiveproperty, the change is silently ignored. The SDK correctly sets the value on the localSubscriptionPropertiesobject, but Azure returns the original (or default infinite) TTL value. No error is thrown.This issue was introduced in SDK version 7.16.0-beta.1 when Jackson Dataformat XML was replaced with
azure-xml. The same issue was previously fixed for queues in PR #32158 (XML element ordering), but the fix was not applied to subscriptions.Exception or Stack Trace
No exception is thrown. The update silently fails - Azure ignores the TTL change and returns the original value.
To Reproduce
Steps to reproduce the behavior:
Code Snippet
Expected behavior
After calling
updateSubscription()withdefaultMessageTimeToLiveset to 50000 seconds (PT13H53M20S):SubscriptionPropertiesshould show TTL = PT13H53M20SgetSubscription()should also return TTL = PT13H53M20SActual behavior
SubscriptionPropertiesshows TTL = PT256204778H48M5.4775807S (infinite)Screenshots
N/A
Setup (please complete the following information):
com.azure:azure-messaging-servicebus:7.17.17com.azure:azure-xml:1.2.1Additional context
Root Cause Analysis
This issue appears to be related to XML element ordering in the update request. A similar issue was fixed for queues in PR #32158:
The PR description states: "The updated xml should have exact same order as what we get from service."
The fix for queues reordered XML elements in
QueueDescriptionandTopicDescription, butSubscriptionDescriptionwas not updated.Workaround
Set
defaultMessageTimeToLiveduring subscription creation instead of updating:Version Information
Related Issues
Information Checklist