Skip to content

Commit

Permalink
Fix Storage Queue Sample issues Azure#18200 by lihong 202105271836 (A…
Browse files Browse the repository at this point in the history
  • Loading branch information
v-hongli1 authored Jul 21, 2021
1 parent 6cc3f70 commit 6ea5e87
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
import com.azure.storage.queue.models.PeekedMessageItem;
import com.azure.storage.queue.models.QueueMessageDecodingError;
import com.azure.storage.queue.models.QueueMessageItem;
import com.azure.storage.queue.models.QueueRetentionPolicy;
import com.azure.storage.queue.models.QueueServiceProperties;
import com.azure.storage.queue.models.QueueServiceStatistics;
import com.azure.storage.queue.models.QueuesSegmentOptions;

import reactor.core.publisher.Mono;

import java.time.Duration;
Expand Down Expand Up @@ -295,7 +297,11 @@ public void setPropertiesWithResponseEnableMetrics() {
// BEGIN: com.azure.storage.queue.queueServiceClient.setPropertiesWithResponseEnableMetrics#QueueServiceProperties-duration-context
QueueServiceProperties properties = client.getProperties();
properties.getMinuteMetrics().setEnabled(true);
properties.getMinuteMetrics().setIncludeApis(true);
properties.getMinuteMetrics().setRetentionPolicy(new QueueRetentionPolicy().setDays(7).setEnabled(true));
properties.getHourMetrics().setEnabled(true);
properties.getHourMetrics().setIncludeApis(true);
properties.getHourMetrics().setRetentionPolicy(new QueueRetentionPolicy().setDays(7).setEnabled(true));
Response<Void> response = client.setPropertiesWithResponse(properties, Duration.ofSeconds(1),
new Context(key1, value1));
System.out.printf("Setting Queue service properties completed with status code %d", response.getStatusCode());
Expand All @@ -310,7 +316,11 @@ public void setPropertiesEnableMetrics() {
// BEGIN: com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#QueueServiceProperties
QueueServiceProperties properties = client.getProperties();
properties.getMinuteMetrics().setEnabled(true);
properties.getMinuteMetrics().setIncludeApis(true);
properties.getMinuteMetrics().setRetentionPolicy(new QueueRetentionPolicy().setDays(7).setEnabled(true));
properties.getHourMetrics().setEnabled(true);
properties.getHourMetrics().setIncludeApis(true);
properties.getHourMetrics().setRetentionPolicy(new QueueRetentionPolicy().setDays(7).setEnabled(true));
client.setProperties(properties);
System.out.println("Setting Queue service properties completed.");
// END: com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#QueueServiceProperties
Expand Down

0 comments on commit 6ea5e87

Please sign in to comment.