简体   繁体   中英

How to set AUTO_ACKNOWLEDGE on SQS with Spring JMS?

I'm trying to setting SQS with JMS and Spring, but when I tried to set Session Acknowledge Mode with AUTO_ACKNOWLEDGE an error appears. What should I do?

I need to desapear with my message when the application gets the message.

 @Bean
    public DefaultJmsListenerContainerFactory jmsListenerContainerFactory() {
        buildConnectionFactory();
        DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
        factory.setConnectionFactory(this.connectionFactory);
        factory.setDestinationResolver(new DynamicDestinationResolver());
        factory.setConcurrency("3-10");
        factory.setSessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE);
        return factory;
    }

I expect to acknowledge the message from my queue when the listener gets it. But I'm receiving the actual error when I try to configure with AUTO_ACKNOWLEDGE: Setup of JMS message listener invoker failed for destination ... trying to recover. Cause: com.amazonaws.services.sqs.AmazonSQS.deleteMessage(Lcom/amazonaws/services/sqs/model/DeleteMessageRequest;)V

I was using version 1.0.0 of amazon-sqs-java-messaging-lib. After changing the version to 1.0.6 I could set the parameter SessionAcknowledgeMode to AUTO_ACKNOWLEDGE.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM