awslabs/amazon-sqs-java-temporary-queues-client

Virtual queues are not getting deleted even after default 5 minutes time spent

gsambasiva opened this issue · 4 comments

We are currently testing temporary queues for request/response messaging.
Functionality is working fine.

But created virtual queues are not getting deleted even after 5 minutes default time period.
And I am doing this testing with latest version of amazon-sqs-java-temporary-queues-client i.e. 1.0.1

Producer Code

`AmazonSQS sqs = AmazonSQSClientBuilder.standard()
.withRegion(Regions.US_EAST_1)
.build();

AmazonSQSRequester requester = AmazonSQSRequesterClientBuilder.standard()
.withAmazonSQS(sqs)
.withIdleQueueSweepingPeriod(60, TimeUnit.SECONDS)
.build();
String requestQueueUrl = sqs.createQueue("Simple").getQueueUrl();
SQSRequestor sqsRequestor = new SQSRequestor(requester, requestQueueUrl);
SendMessageRequest request = new SendMessageRequest()
.withQueueUrl(requestQueueUrl)
.withMessageBody(msg);
Message reply = sqs.sendMessageAndGetResponse(request, MAX_TIMEOUT, TimeUnit.SECONDS);`

Consumer Code

`AmazonSQS sqs = AmazonSQSClientBuilder.defaultClient();
String requestQueueUrl = sqs.createQueue("Simple").getQueueUrl();
AmazonSQSResponder responder = AmazonSQSResponderClientBuilder.standard().withAmazonSQS(sqs).build();
SQSResponder server = new SQSResponder(responder, requestQueueUrl);
//code in accept method

MessageContent reply = new MessageContent(response.getBody(), response.getMessageAttributes());
responseClient.sendResponseMessage(MessageContent.fromMessage(message), reply);`

Here is the image for the virtual queues from aws console

image

And also attching log file for AmazonSQSIdleQueueDeletingClient background thread

sqs_temporary_queue_logs.txt

Hi there! Are you coming to this conclusion by running the code above for a while and then shutting them off, then seeing that the host queue is not cleaned up?

If so, that’s expected - there has to be at least one instance of the client running somewhere to perform the idle queue sweep. If you start up your test setup again it should clean up the queue from the last version.

Otherwise, if you have the client and server running but no messages being sent, it’s also expected that the host queue will be kept alive since the server will still be receiving from it. Keep in mind that a queue is only “idle” and automatically deleted if it is empty and has no traffic, including empty receives.

If I haven’t guessed at your context correctly, please let me know more details so I can help figure it out. :)

Closing this due to lack of reply.

Does the Amazon SQS broker delete the temporary queues automatically as well if the client is not able to ?