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

Cannot Resolve SqsListener

Open donaldhook opened this issue 10 years ago • 3 comments

I am trying to create sqs listener and the @SqsListenter is not resolving in STS. I am not sure what I am missing on my pom. Adding spring-cloud-aws-autoconfigure does not help.

Thanks in advance!

My pom has the following dependencies

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-aws</artifactId>
        <version>${spring-cloud-aws-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-aws-messaging</artifactId>
        <version>${spring-cloud-aws-version}</version>
    </dependency>

Class package com.boelter.integration.listener.beercup;

import com.amazonaws.services.sqs.AmazonSQS; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.aws.messaging.core.QueueMessagingTemplate; import org.springframework.messaging.support.MessageBuilder; import org.springframework.cloud.aws.messaging.core.*;

public class BeercupQuotesListener {

@SqsListener("quotes")    <--- THIS IS WHAT IS NOT RESOLVING
public void queueListener(String message) {
    // ...
}

}

donaldhook avatar Mar 07 '16 01:03 donaldhook

Hello @donaldhook , is your class registered in the spring application (e.g. by using @Component or any other component annotation) ?

aemruli avatar Mar 10 '16 16:03 aemruli

It looks like the 1.0.x release simply doesn't have the listener.annotation package build into it for some reason. I downloaded every version on Maven Central (1.0.0 through 1.0.4) and none of them have a listener.annotation directory.

soverby avatar Apr 04 '16 20:04 soverby

Hello @soverby the @SqsListener annotation has been introduced in 1.1, if you are using 1.0.x you have to use the org.springframework.messaging.handler.annotation.MessageMapping annotation (which does not support any deletion mode)

aemruli avatar Apr 13 '16 21:04 aemruli