Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is my Amazon S3 client synchronous or asynch?

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

like image 284
MayoMan Avatar asked Feb 14 '14 11:02

MayoMan


People also ask

Is S3 synchronous or asynchronous?

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.

How does AWS S3 sync work?

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.

What is async AWS?

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.


2 Answers

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)

like image 169
Sony Kadavan Avatar answered Oct 19 '22 13:10

Sony Kadavan


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).

like image 39
Robocide Avatar answered Oct 19 '22 12:10

Robocide