public UnsubscribeAsync ( UnsubscribeRequest request, System cancellationToken = default(CancellationToken) ) : Task |
||
request | UnsubscribeRequest | Container for the necessary parameters to execute the Unsubscribe operation. |
cancellationToken | System | /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// |
return | Task |
private void UnSubscribe(string subscriptionArn) { using (var client = new AmazonSimpleNotificationServiceClient(this.AwsCredentials, this.AwsRegion)) { Task <UnsubscribeResponse> t; t = client.UnsubscribeAsync(subscriptionArn); t.Wait(); if (t.IsCompleted) { this.ReloadExistingSubscriptions(); } } }
public void UnSubscribeAll() { bool reloadRequired = false; using (var client = new AmazonSimpleNotificationServiceClient(this.AwsCredentials, this.AwsRegion)) { Task <UnsubscribeResponse> t; foreach (var s in this.Subscriptions) { t = client.UnsubscribeAsync(s.SubscriptionArn); t.Wait(); if (t.IsCompleted) { reloadRequired = true; } } lock ( _LocalPendingSubscriptions) { _LocalPendingSubscriptions.Clear(); } if (reloadRequired) { this.ReloadExistingSubscriptions(); } } }