diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java
index 2f638cc893759..edc879ea7b88c 100644
--- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java
+++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java
@@ -373,19 +373,38 @@ CreateSubscriptionResult createSubscription(String topicPath, SubscriptionInfo s
ListSubscriptionsResult listSubscriptions(String topicPath) throws ServiceException;
/**
- * List subscriptions.
+ * Returns a list of subscriptions.
*
* @param topicPath
- * the topic path
+ * A String
object that represents the name of the topic for the subscriptions to retrieve.
+ *
* @param options
- * the options
- * @return the list subscriptions result
+ * A ListSubscriptionsOptions
object that represents the options to list subscriptions.
+ *
+ * @return A ListSubscriptionsResult
object that represents the result.
+ *
* @throws ServiceException
* the service exception
*/
ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscriptionsOptions options)
throws ServiceException;
+ /**
+ * Updates a subscription.
+ *
+ * @param topicName
+ * A String
option which represents the name of the topic.
+ *
+ * @param subscriptionInfo
+ * A SubscriptionInfo
option which represents the information of the subscription.
+ *
+ * @return A SubscriptionInfo
object that represents the result.
+ *
+ * @exception ServiceException
+ * If a service exception is encountered.
+ */
+ SubscriptionInfo updateSubscription(String topicName, SubscriptionInfo subscriptionInfo) throws ServiceException;
+
/**
* Creates a rule.
*
@@ -448,15 +467,16 @@ ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscriptionsOpt
ListRulesResult listRules(String topicPath, String subscriptionName) throws ServiceException;
/**
- * List rules.
+ * Returns a list of rules.
*
* @param topicPath
- * the topic path
+ * A String
object that represents the name of the topic for the subscription.
* @param subscriptionName
- * the name of the subscription
+ * A String
object that represents the name of the subscription whose rules are being
+ * retrieved.
* @param options
- * the options
- * @return the list rules result
+ * A ListRulesOptions
object that represents the options to retrieve rules.
+ *
* @throws ServiceException
* If a service exception is encountered.
*/
diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java
index 5620585bd17ab..d0a9dc8e9610c 100644
--- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java
+++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java
@@ -369,6 +369,20 @@ public ListSubscriptionsResult listSubscriptions(String topicPath) throws Servic
}
}
+ @Override
+ public SubscriptionInfo updateSubscription(String topicName, SubscriptionInfo subscriptionInfo)
+ throws ServiceException {
+ try {
+ return next.updateSubscription(topicName, subscriptionInfo);
+ }
+ catch (UniformInterfaceException e) {
+ throw processCatch(new ServiceException(e));
+ }
+ catch (ClientHandlerException e) {
+ throw processCatch(new ServiceException(e));
+ }
+ }
+
@Override
public CreateRuleResult createRule(String topicPath, String subscriptionName, RuleInfo rule)
throws ServiceException {
diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java
index a5f2d9c019238..e9ee204c9dba1 100644
--- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java
+++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java
@@ -368,6 +368,14 @@ public ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscript
return result;
}
+ @Override
+ public SubscriptionInfo updateSubscription(String topicName, SubscriptionInfo subscriptionInfo)
+ throws ServiceException {
+ return getResource().path(topicName).path("subscriptions").path(subscriptionInfo.getName())
+ .type("application/atom+xml;type=entry;charset=utf-8").header("If-Match", "*")
+ .put(SubscriptionInfo.class, subscriptionInfo);
+ }
+
@Override
public CreateRuleResult createRule(String topicPath, String subscriptionName, RuleInfo rule) {
return new CreateRuleResult(getResource().path(topicPath).path("subscriptions").path(subscriptionName)
diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusIntegrationTest.java
index 6259b2d55871e..ba47ddec891f0 100644
--- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusIntegrationTest.java
+++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusIntegrationTest.java
@@ -435,6 +435,23 @@ public void subscriptionWillReceiveMessage() throws Exception {
assertEquals("text/html", message.getContentType());
}
+ @Test
+ public void subscriptionCanBeUpdated() throws Exception {
+ // Arrange
+ String topicName = "testSubscriptionCanBeUpdated";
+ service.createTopic(new TopicInfo(topicName));
+ SubscriptionInfo originalSubscription = service.createSubscription(topicName, new SubscriptionInfo("sub"))
+ .getValue();
+ Integer expectedMaxDeliveryCount = 1024;
+
+ // Act
+ SubscriptionInfo updatedSubscription = service.updateSubscription(topicName,
+ originalSubscription.setMaxDeliveryCount(expectedMaxDeliveryCount));
+
+ // Assert
+ assertEquals(expectedMaxDeliveryCount, updatedSubscription.getMaxDeliveryCount());
+ }
+
@Test
public void rulesCanBeCreatedOnSubscriptions() throws Exception {
// Arrange