Amazon AWS SDK Betriebsanweisung Seite 21

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 73
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 20
Asynchronous API for .NET 4.5, Windows Store,
and Windows Phone 8
The AWS SDK for .NET uses the new task-based asynchronous pattern for .NET 4.5, Windows Store,
and Windows Phone 8.You can use the async and await keywords to perform and manage asynchronous
operations for all AWS products without blocking.
To learn more about the task-based asynchronous pattern, see Task-based Asynchronous Pattern (TAP)
on MSDN.
Asynchronous API for .NET 3.5
The AWS SDK for .NET supports asynchronous (async) versions of most of the method calls exposed
by the .NET client classes.The async methods enable you to call AWS services without having your code
block on the response from the service. For example, you could make a request to write data to Amazon
S3 or DynamoDB and then have your code continue to do other work while AWS processes the requests.
Syntax of Async Request Methods
There are two phases to making an asynchronous request to an AWS service.The first is to call the Begin
method for the request. This method initiates the asynchronous operation. Then, after some period of
time, you would call the corresponding End method.This method retrieves the response from the service
and also provides an opportunity to handle exceptions that might have occurred during the operation.
Note
It is not required that you call the End method. Assuming that no errors are encountered, the
asynchronous operation will complete whether or not you call End.
Begin Method Syntax
In addition to taking a request object parameter, such as PutItemRequest, the async Begin methods
take two additional parameters: a callback function, and a state object. Instead of returning a service re-
sponse object, the Begin methods return a result of type IAsyncResult. For the definition of this type,
go to the MSDN documentation.
Synchronous Method
PutItemResponse PutItem(
PutItemRequest putItemRequest
)
Asynchronous Method
IAsyncResult BeginPutItem(
GetSessionTokenRequest getSessionTokenRequest,
AsyncCallback callback,
Object state
)
AsyncCallback callback
The callback function is called when the asynchronous operation completes.When the function is called,
it receives a single parameter of type IAsyncResult. The callback function has the following signature.
Version v2.0.0
17
AWS SDK for .NET Developer Guide
Asynchronous API for .NET 4.5,Windows Store, and
Windows Phone 8
Seitenansicht 20
1 2 ... 16 17 18 19 20 21 22 23 24 25 26 ... 72 73

Kommentare zu diesen Handbüchern

Keine Kommentare