spring-cloud-aws icon indicating copy to clipboard operation
spring-cloud-aws copied to clipboard

Messages not consumed from SQS queue

Open vijayrcse opened this issue 3 years ago • 19 comments

Type: Bug

Component: SQS

Describe the bug I have @SqsListener configured in one of the method of my spring @Service class. I am using version of spring-cloud-aws-messaging 2.2.6.RELEASE At times ( very rarely ) I see that messages in the queue is not getting consumed. The listener method is not even invoked.

I had to bounce our spring boot container process to fix the issue. There is nothing in the logs with respect to errors. As of now using only the default configuration and not customized task executor or SimpleMessageListenerContainer bean. Unable to reproduce the issue in test environments. Could you please suggest what could be wrong here and how I can troubleshoot this issue ?

Sample @SqlListener(value="${queue.name}", deletionPolicy=SqsMessageDeletionPolicy.ON_SUCCESS) { ... }

vijayrcse avatar Mar 19 '22 13:03 vijayrcse

I have this same issue. First time using this library though, so I have no idea if its a config issue or an actual bug. Nobody has replied to anything ive posted

LarcomDev avatar Aug 14 '22 01:08 LarcomDev

Also, I have the same issue too

manjian14 avatar Aug 18 '22 06:08 manjian14

I still have this issue. We are bouncing the container process when we come across this issue. Any inputs would help.

vijayrcse avatar Aug 18 '22 06:08 vijayrcse

@manjian14 @vijayrcse do you use the latest 2.4.2 version? There were many fixes in SQS integration since 2.2.6. Also, I am not able to reproduce this issue so if you could send a sample project with instructions how to reproduce it would be great.

maciejwalkowiak avatar Aug 21 '22 06:08 maciejwalkowiak

I use 2.2.6.RELEASE. I tried to reproduce this issue in lower environment, but we couldn't. We could upgrade to 2.4,2 and see if this issue exist

vijayrcse avatar Aug 21 '22 12:08 vijayrcse

Sounds good to me!

maciejwalkowiak avatar Aug 21 '22 19:08 maciejwalkowiak

2.2.6.RELEASE working fine, when I upgraded to the latest version '2.4.2' sending a message within SQS is working but is not getting consumed. The listener method is not invoked, my code changes between the old and latest version is the change the used package, and removes the SQS enable annotations because that was deprecated

manjian14 avatar Aug 22 '22 06:08 manjian14

@manjian14 can you share a sample that reproduces it? We have a sample how to use SQS https://github.com/awspring/spring-cloud-aws/tree/2.4.x/spring-cloud-aws-samples/spring-cloud-aws-sqs-sample

maciejwalkowiak avatar Aug 22 '22 07:08 maciejwalkowiak

Thank you, I tried your sample, and in the fact, my Implementation is very simple, just send and receive a message within SQS, only the changes which I have done after moving from 2.2.6.RELEASE to 2.4.2 is to create SQS Bean because SQSEnable was deprecated, and my SQS Bean is also simple, I don't use any credentials at the code level, because my project gets access to sqs by aws roles, my spring-boot version is 2.7.3 / Java 11

manjian14 avatar Aug 22 '22 08:08 manjian14

@manjian14 did it work after upgrade? If not, maybe there is a permission problem or the queue does not exist? I'd need more details to figure the root cause.

maciejwalkowiak avatar Aug 23 '22 04:08 maciejwalkowiak

after upgrade, sending a message via sqs is working, but not consumed to the listener, I don't think it's related to AWS permission because the older version working fine and with the latest version I am able to send a message

manjian14 avatar Aug 23 '22 06:08 manjian14

the only major change is I replaced this he EnableSqs annotation with my own bean

@Bean public AmazonSQSAsync amazonSQSAsync(){ return AmazonSQSAsyncClientBuilder.standard().withRegion(Regions.US_EAST_1).build();

}

manjian14 avatar Aug 23 '22 06:08 manjian14

Unfortunately I cannot reproduce it. Please create a repository with minimal example that reproduces this issue.

maciejwalkowiak avatar Aug 23 '22 10:08 maciejwalkowiak

I figure out something if I added @EnableSqs " which is deprecated" the latest lib 2.4.2 start work, otherwise, if I remove the EnableSqs , the code not consuming to the listener

manjian14 avatar Aug 23 '22 14:08 manjian14

Then it means that for some reason the autoconfiguration is not triggered. Run application with debug mode (debug=true in application.properties and look for SqsAutoConfiguration).

maciejwalkowiak avatar Aug 24 '22 04:08 maciejwalkowiak

Thank you, the issue has been fixed, the problem was related to autoconfiguration dependency

manjian14 avatar Aug 24 '22 07:08 manjian14

Awesome!

@vijayrcse are you guys working together or do you have a separate issue? If so, can you also verify that it is not an autoconfiguration problem?

maciejwalkowiak avatar Aug 24 '22 10:08 maciejwalkowiak

nop, this is a separate issue, but I believe is the same reason

manjian14 avatar Aug 24 '22 10:08 manjian14

Issue raised by @manjian14 is a separate issue. Original issue reported by me on 2.2.6 still remains. We are looking at upgrading to 2.4.2 sooner

vijayrcse avatar Aug 25 '22 04:08 vijayrcse

Hey @maciejwalkowiak, maybe we can close this one in hopes that it won't happen in 3.0? Even if the problem did appear, I don't think info from this thread would be helpful. WDYT?

tomazfernandes avatar Mar 14 '23 23:03 tomazfernandes