UnsubscribeAsync() public method

Initiates the asynchronous execution of the Unsubscribe operation.
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
Exemplo n.º 1
0
 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();
         }
     }
 }
Exemplo n.º 2
0
        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();
                }
            }
        }