-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend SQSMessageProducer to facilitate sending batches of JMS messages with SendMessageBatchRequest #81
Comments
Hi there! This isn’t something we have any plans to add, but you have a couple of options. You can use the buffered asynchronous client included with the SQS SDK to automatically merge individual SendMessage requests into SendMessageBatch requests: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-client-side-buffering-request-batching.html. Or you can always use the SQS API directly if you want to create your own batches requests. It depends on how much benefit you’re getting from using the JMS API. |
I have already had a look on the buffered asynchronous client but from looking at the code, JMS messages sent through SQSMessageProducer are still being sent synchronously and therefore no batching will take place.
Sure, but since I also use JMS on the receiver side without problems it would be nice to keep using it on the sender side - otherwise I would have to duplicate all the message conversion stuff that is taken care of by the SQSMessageProducer. Would you be willing to accept a PR that adds such a capability to SQSMessageProducer? |
The buffered asynchronous client will batch together synchronous calls as well: it holds calls open for up to 200 ms to wait for enough concurrent requests to fill a batch, at the cost of a bit of extra latency. The that 200 ms is configurable - see the maxBatchOpenMs setting here: https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/buffered/QueueBufferConfig.java#L43 |
I'm also certainly willing to consider a PR for adding batch sending to SQSMessageProducer though! I don't see anything wrong with adding that capability, but it's also appealing to achieve that batching while sticking to the generic JMS interfaces. |
True but the calling thread will block until sending is complete. But it should work if I use multiple threads that invoke send.
The JMS 2.0 API has support for asynchronous message sending. Do you have any plans on supporting JMS 2.0? |
But this will destroy message ordering - I am using a FIFO SQS queue. So not a real solution. |
Currently, the SQSMessageProducer only allows sending messages one by one. However the SQS supports SendMessageBatchRequest to send multiple messages with one request. While the JMS API does not support this, it would still be a useful and important feature.
The text was updated successfully, but these errors were encountered: