Here is my code
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
public class AwsS3Helper
{
private AmazonS3 s3Client;
public AwsS3Helper()
{
try
{
AWSCredentials credentials = new PropertiesCredentials ....
s3Client = new AmazonS3Client( credentials );
s3Client.putObject(putObjectRequest);
What I would like to know is, is this an asynchronous or synchronous operation? I use DynamoDB and it has 2 different clients, an async and sync one, but I don't see any other S3Client in the Amazon SDK
A method is asynchronous if it includes the Async suffix in its name. For example, the Amazon S3 method PutObject is synchronous, while PutObjectAsync is asynchronous. Like all asynchronous operations, an asynchronous SDK method returns before its main task is finished.
The s3 sync command synchronizes the contents of a bucket and a directory, or the contents of two buckets. Typically, s3 sync copies missing or outdated files or objects between the source and target.
Several AWS services, such as Amazon Simple Storage Service (Amazon S3) and Amazon Simple Notification Service (Amazon SNS), invoke functions asynchronously to process events. When you invoke a function asynchronously, you don't wait for a response from the function code.
This statement, from the documentation is pointing to a synchronous operation. Moreover it doesnt take any parameter for async indication of the result.
"Amazon S3 never stores partial objects; if during this call an exception wasn't thrown, the entire object was stored." http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3Client.html#putObject(com.amazonaws.services.s3.model.PutObjectRequest)
as answered it is not Async, although the Sdk has Async clients for other services. this is also confirmed here (https://github.com/aws/aws-sdk-java/issues/140)
but also note that in the new version of the sdk (2.0) you have Async client for s3 (https://github.com/aws/aws-sdk-java-v2).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With