Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to consume SQS messages #89

Open
sjhameenakshi opened this issue Mar 24, 2020 · 0 comments
Open

Unable to consume SQS messages #89

sjhameenakshi opened this issue Mar 24, 2020 · 0 comments

Comments

@sjhameenakshi
Copy link

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 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant