Unable to consume SQS messages
I have upgraded my spring boot api version from 2.0 to 2.2.0 and java version from 8 to 11 . Post above up-gradation I am unable to consume the SQS messages . Please find the pom snippet below :
and to consume the message I am doing the following , please find the below code snippet
JmsConfig: (SQS Configuration class)
@Configuration(proxyBeanMethods = false) @EnableJms public class JmsConfig {
org.apache.logging.log4j.Logger LOGGER = LogManager.getLogger("CONSOLE_JSON_APPENDER");
String concurrencyValue;
private SQSConnectionFactory sqsConnectionFactory;
@PostConstruct public void init() { LOGGER.info("Listening to the queue");
}
public JmsConfig() {
sqsConnectionFactory = new SQSConnectionFactory(new ProviderConfiguration(), AmazonSQSClientBuilder.standard().withCredentials(new DefaultAWSCredentialsProviderChain())); }
@Bean public DefaultJmsListenerContainerFactory jmsListenerContainerFactory() { concurrencyValue = String.valueOf(1); DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory(); factory.setConnectionFactory(this.sqsConnectionFactory); factory.setConnectionFactory(sqsConnectionFactory); factory.setDestinationResolver(new DynamicDestinationResolver()); factory.setConcurrency(concurrencyValue); factory.setSessionAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE); return factory; }
Message Consumer Class :
@JmsListener(destination = "${ingestQueue}", containerFactory="jmsListenerContainerFactory") public void processMessage(@Payload String message) { logLevel.logLevel(); System.out.println("Incomming Payload from SQS" + message);
Can someone help me what is the mistake I am doing here or what needs to be changed .