英文原文:Spring Cloud for Amazon Web Services
目录
概述
Spring Cloud for Amazon Web Services是Spring Cloud项目的一部分,可以简化与托管Amazon Web Services的集成。它提供了一种使用众所周知的Spring习语和API(如消息传递或缓存API)与AWS提供的服务进行交互的便捷方式。开发人员可以围绕托管服务构建应用程序,而无需关心基础结构或维护。
特性
- [SQS]的Spring Messaging API实现(Message Queuing Service - Amazon Simple Queue Service - AWS)。
- [ElastiCache]的Spring Cache API实现(Redis OSS and Memcached-Compatible Cache - Amazon ElastiCache - AWS)。
- 基于注释的[SNS](Push Notification Service - Amazon Simple Notification Service - AWS)端点(HTTP)映射。
- 按照[CloudFormation](Infrastructure As Code Provisioning Tool - AWS CloudFormation - AWS)堆栈中定义的逻辑名访问资源。
- 基于[RDS](Managed SQL Database - Amazon Relational Database Service (RDS) - AWS)实例的逻辑名称创建自动JDBC DataSource。
- Ant风格路径匹配[S3](Amazon S3 - Cloud Object Storage - AWS)存储桶的ResourceLoader。
基于注解的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"));
快速开始
使用Spring Initializr引导您的应用程序。
学习
文档
每个Spring项目都有自己的; 它详细解释了如何使用项目功能以及使用它们可以实现的功能。
2.1.0 RC1 PRE CURRENT | Reference Doc. | API Doc. |
2.0.2 SNAPSHOT CURRENT | Reference Doc. | API Doc. |
2.0.1 CURRENT GA | Reference Doc. | API Doc. |
1.2.4 SNAPSHOT CURRENT | Reference Doc. | API Doc. |
1.2.3 CURRENT GA | Reference Doc. | API Doc. |
1.1.4 GA | Reference Doc. | API Doc. |
1.0.4 GA | Reference Doc. | API Doc. |
示例
尝试一些例子: