aws / aws-sdk-net

The official AWS SDK for .NET. For more information on the AWS SDK for .NET, see our web site:
http://aws.amazon.com/sdkfornet/
Apache License 2.0
2.07k stars 861 forks source link

Equivalent of AmazonSQSBufferedAsyncClient Java based implementation in dotnet #1645

Open niklr opened 4 years ago

niklr commented 4 years ago

I would like to implement simple request batching using client-side buffering—calls made from the client are first buffered and then sent as a batch request to Amazon SQS. It seems Java already has an implementation for such a use case as described here:

https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-client-side-buffering-request-batching.html

Unfortunately, I couldn't find an equivalent of AmazonSQSBufferedAsyncClient in aws-sdk-net. Does it exist or are there any alternatives?


This is a :question: general question

ashishdhingra commented 4 years ago

Hi @niklr,

As per documentation/example, the Java SDK class AmazonSQSBufferedAsyncClient allows for simple request batching using client-side buffering. Client-side buffering allows up to 10 requests to be buffered and sent as a batch request, decreasing your cost of using Amazon SQS and reducing the number of sent requests.

While I could not find a similar named class in .NET SDK, if you refer the documentation Sending an Amazon SQS Message Batch, the SendMessageBatch() method of AmazonSQSClient class offers somewhat similar functionality. Please let me know if it works for your scenario.

Thanks, Ashish

niklr commented 4 years ago

Hi @ashishdhingra

Unfortunately this does not work for my scenario. The buffering is the key part. I would like to delay SendMessageBatch() until the buffer contains 10 messages or a certain amount of time has passed (e.g. 5 seconds).

ashishdhingra commented 4 years ago

Hi @niklr,

Thanks for your response. Unfortunately, I do not see an equivalent class in .NET for AmazonSQSBufferedAsyncClient. The SendMessageBatch() is the closest match, but looks like it doesn't support buffering.

I was looking at the code for Java SDK's AmazonSQSBufferredAsyncClient class and it appears that it maintains a buffer of messages. While sending the message, it still uses realSQS.sendMessageBatchAsync(sendMessageBatchRequest). Also this class is just an extension of AmazonSQSAsync class. May be you could use the similar idea in .NET and try extending AmazonSQSClient class to implement custom buffered implementation.

Hope this helps. Please let me know if we could close this issue if this provides some guidance.

Thanks, Ashish

niklr commented 4 years ago

I would love to see this feature implemented in .NET as well. Feel free to close it if not worthy to put on the backlog/roadmap.

In any case, thanks for the guidance!

ashishdhingra commented 4 years ago

Hi @niklr,

I think this would be good to have feature in .NET SDK. Hence I have converted this guidance issue into feature-request. I'm not sure how sooner it would be implemented, but hopefully it would be planned by development team to put it in their backlog.

Thanks, Ashish

github-actions[bot] commented 3 years ago

We have noticed this issue has not recieved attention in a year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.

github-actions[bot] commented 2 years ago

We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.

dsharkou commented 2 years ago

Hi @ashishdhingra! Please reopen the issue, I also interested in such feature in .Net

birojnayak commented 2 years ago

@ashishdhingra do you know which team owns this feature ? else I can take a look how to enable this... we also have one internal use case...