Spring aws-cloud SNS http end point confirm subscription not working

Viewed 2343

In my spring boot aws-cloud SNS http end point confirm subscription is not working. When SNS confirmation comes following error coming in my application. Error :

[Request processing failed; nested exception is java.lang.IllegalArgumentException: Invoked method public abstract void org.springframework.cloud.aws.messaging.endpoint.NotificationStatus.confirmSubscription() is no accessor method!] with root cause
    java.lang.IllegalArgumentException: Invoked method public abstract void org.springframework.cloud.aws.messaging.endpoint.NotificationStatus.confirmSubscription() is no accessor method!
        at org.springframework.util.Assert.notNull(Assert.java:115) ~[spring-core-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
        at org.spring

My controller handler is :

     @NotificationSubscriptionMapping
        public void handleSubscriptionMessage( NotificationStatus status)   throws IOException {
            //Confirming SNS subscription
            status.confirmSubscription();
        }

My Pom contains following :

     <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-aws-messaging</artifactId>
          <version>1.0.4.RELEASE</version>
        </dependency>

        <!-- For Spring AWS autoconfiguration-->
        <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-aws-autoconfigure</artifactId>
          <version>1.0.4.RELEASE</version>
        </dependency>

I followed the explanation in this link

3 Answers

My Kotlin Configuration looks like this, to configure the subscription and messaging and un-subscription method argument resolving

        import com.amazonaws.services.sns.AmazonSNS
        import org.springframework.beans.factory.annotation.Autowired
        import org.springframework.cloud.aws.messaging.endpoint.config.NotificationHandlerMethodArgumentResolverConfigurationUtils
        import org.springframework.context.annotation.Configuration
        import org.springframework.web.method.support.HandlerMethodArgumentResolver
        import org.springframework.web.servlet.config.annotation.EnableWebMvc
        import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
        
        @Configuration
        @EnableWebMvc
        class ListenerWebConfiguration : WebMvcConfigurer
        {
          @Autowired
          private lateinit var amazonSNS: AmazonSNS
        
          override fun addArgumentResolvers(argumentResolvers: MutableList<HandlerMethodArgumentResolver>) {
argumentResolvers.add(NotificationHandlerMethodArgumentResolverConfigurationUtils.getNotificationHandlerMethodArgumentResolver(amazonSNS))
          }
        }
Related