亚马逊云服务的春云是一个社区运营的项目 。网站已 https://awspring.io/ ,源代码库位于 https://github.com/awspring/spring-cloud-aws 。
Spring Cloud for Amazon Web Services 简化了与托管 Amazon Web Services 的集成。它提供了一种便捷的方式,利用知名的 Spring 语句和 API,如消息或缓存 API,与 AWS 提供的服务进行交互。开发者可以围绕托管服务构建应用,而无需担心基础设施或维护。
特征
基于注释的SQS队列监听器
@MessageMapping("logicalQueueName")
private void receiveMessage(Person person, @Header("SenderId") String senderId) {
// ...
}
基于注释的SNS监听器
@Controller
@RequestMapping("/sns/receive")
public class SnsEndpointController {
@NotificationMessageMapping
public void receiveNotification(@NotificationMessage String message, @NotificationSubject String subject) {
// ...
}
@NotificationSubscriptionMapping
public void confirmSubscription(NotificationStatus notificationStatus) {
notificationStatus.confirmSubscription();
}
消息模板
snsTemplate.sendNotification("SnsTopic", "message", "subject");
sqsTemplate.convertAndSend("Queue", new Person("John", "Doe"));