I am preparing demo programme which listen from the Amazon SQS.Below is my code.
xml config
<aws-messaging:annotation-driven-queue-listener amazon-sqs="sqsClient" max-number-of-messages="10" wait-time-out="20" visibility-timeout="100" />
UserServiceListenr.java
@Configuration
@EnableSqs
@Component
public class UserServiceListenr {
@SqsListener(value = "CMR", deletionPolicy = SqsMessageDeletionPolicy.ON_SUCCESS)
public void myQueueListener(Message message) throws Exception{
try {
System.out.println("Message Listen start");
System.out.println("Message part "+message);
}catch(Exception e){
System.out.println(" message Exception " + e);
}
}
}
I have put 2 messages on SQS queue.when I try to fetch messages using this demo programme Messages shown Messages_in_flight column in my AWS console.but messages not reach to my sqsListener method and after few minutes messages shown to Messages_available column in AWS console.
Below is the Exception I got when run the programme.
QueueMessageHandler:294 - 1 message handler methods found on class com.sophos.cmr.demo.UserServiceListenr: {public void com.sophos.cmr.demo.UserServiceListenr.myQueueListener(java.lang.String) throws java.lang.Exception=org.springframework.cloud.aws.messaging.listener.QueueMessageHandler$MappingInformation@5f0e9815}
so what's going wrong if any clue?