Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceClient.UnsubscribeAsync C# (CSharp) Method

UnsubscribeAsync() public method

Initiates the asynchronous execution of the Unsubscribe operation.
public UnsubscribeAsync ( UnsubscribeRequest request, UnsubscribeResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void
request UnsubscribeRequest Container for the necessary parameters to execute the Unsubscribe operation on AmazonSimpleNotificationServiceClient.
callback UnsubscribeResponse>.AmazonServiceCallback An Action delegate that is invoked when the operation completes.
options AsyncOptions A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.
return void
        public void UnsubscribeAsync(UnsubscribeRequest request, AmazonServiceCallback<UnsubscribeRequest, UnsubscribeResponse> callback, AsyncOptions options = null)
        {
            options = options == null?new AsyncOptions():options;
            var marshaller = new UnsubscribeRequestMarshaller();
            var unmarshaller = UnsubscribeResponseUnmarshaller.Instance;
            Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
            if(callback !=null )
                callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
                    AmazonServiceResult<UnsubscribeRequest,UnsubscribeResponse> responseObject 
                            = new AmazonServiceResult<UnsubscribeRequest,UnsubscribeResponse>((UnsubscribeRequest)req, (UnsubscribeResponse)res, ex , ao.State);    
                        callback(responseObject); 
                };
            BeginInvoke<UnsubscribeRequest>(request, marshaller, unmarshaller, options, callbackHelper);
        }

Same methods

AmazonSimpleNotificationServiceClient::UnsubscribeAsync ( UnsubscribeRequest request, System cancellationToken = default(CancellationToken) ) : Task
AmazonSimpleNotificationServiceClient::UnsubscribeAsync ( string subscriptionArn, System cancellationToken = default(CancellationToken) ) : Task
AmazonSimpleNotificationServiceClient::UnsubscribeAsync ( string subscriptionArn, UnsubscribeResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void

Usage Example

Example #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();
         }
     }
 }
All Usage Examples Of Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceClient::UnsubscribeAsync
AmazonSimpleNotificationServiceClient