awslabs / awslabs/amazon-sqs-java-messaging-lib

Unable to consume SQS messages

Open
#89 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
183
Forks
150
PR merge metrics
No merged PRs in 30d

Description

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 :

org.springframework.boot
spring-boot-starter-parent
2.2.2.RELEASE

org.springframework.cloud
spring-cloud-dependencies
Hoxton.SR2
pom
import

org.springframework
spring-jms

com.amazonaws
amazon-sqs-java-messaging-lib
1.0.8

com.amazonaws
aws-java-sdk
1.11.749

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 .

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.