spring-attic / aws-refapp

Refernce app for spring-cloud-aws
Apache License 2.0
132 stars 104 forks source link

Not being able to confirm subscription: java.lang.IllegalArgumentException: Invoked method public abstract void org.springframework.cloud.aws.messaging.endpoint.NotificationStatus.confirmSubscription() is no accessor method! #5

Open jchavesarias opened 8 years ago

jchavesarias commented 8 years ago

The auto configuration should have fixed that right?

I don't have any xml files, just following this aws-refapp as it is.

This is the end point controller:

@RestController @RequestMapping("/sns/messages") public class SnsEndpointResource {

private static Logger LOG = LoggerFactory.getLogger(SnsEndpointResource.class);

private final SendingTextWebSocketHandler snsSendingTextWebSocketHandler;

@Autowired
public SnsEndpointResource(@Qualifier("snsWebSocketHandler") SendingTextWebSocketHandler snsSendingTextWebSocketHandler) {
    this.snsSendingTextWebSocketHandler = snsSendingTextWebSocketHandler;
}

@NotificationSubscriptionMapping
public void confirmSubscription(NotificationStatus notificationStatus) {
    LOG.info("Received SNS subscription {}", notificationStatus);
    notificationStatus.confirmSubscription();
}

@NotificationMessageMapping
public void receiveNotification(@NotificationMessage String message, @NotificationSubject String subject) {
    LOG.info("Received SNS message {} with subject {}", message, subject);

    try {
        this.snsSendingTextWebSocketHandler.broadcastToSessions(new DataWithTimestamp<>(new SnsNotificationDTO(subject, message)));
    } catch (IOException e) {
        LOG.error("Was not able to push the message to the client.", e);
    }
}

}