aws-sdk-java-v2-messaging
Provides AWS messaging patterns using AWS SDK for Java 2.x for SQS queues and SNS topics. Handles sending/receiving messages, FIFO queues, DLQ, subscriptions, and pub/sub patterns. Use when implementing messaging with SQS or SNS.
What this skill does
# AWS SDK for Java 2.x - Messaging (SQS & SNS)
## Overview
Provides patterns for SQS queues and SNS topics with AWS SDK for Java 2.x: client setup, queue management, message operations, subscriptions, and Spring Boot integration.
## When to Use
- Setting up SQS queues (standard or FIFO) for message buffering
- Implementing pub/sub with SNS topics and subscriptions
- Processing messages from SQS queues with long polling
- Configuring dead letter queues (DLQ) for error handling
- Integrating AWS messaging with Spring Boot applications
- Building event-driven architectures with SQS/SNS
## Examples
### Quick Setup
**Dependencies:**
```xml
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sqs</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sns</artifactId>
</dependency>
```
**Client Configuration:**
```java
SqsClient sqsClient = SqsClient.builder()
.region(Region.US_EAST_1)
.credentialsProvider(DefaultCredentialsProvider.create())
.build();
SnsClient snsClient = SnsClient.builder()
.region(Region.US_EAST_1)
.build();
```
### SQS Operations
**Create and Send Message:**
```java
String queueUrl = sqsClient.createQueue(CreateQueueRequest.builder()
.queueName("my-queue")
.build()).queueUrl();
String messageId = sqsClient.sendMessage(SendMessageRequest.builder()
.queueUrl(queueUrl)
.messageBody("Hello, SQS!")
.build()).messageId();
```
**Receive and Delete Message:**
```java
ReceiveMessageResponse response = sqsClient.receiveMessage(ReceiveMessageRequest.builder()
.queueUrl(queueUrl)
.maxNumberOfMessages(10)
.waitTimeSeconds(20)
.build());
response.messages().forEach(message -> {
processMessage(message.body());
sqsClient.deleteMessage(DeleteMessageRequest.builder()
.queueUrl(queueUrl)
.receiptHandle(message.receiptHandle())
.build());
});
```
**FIFO Queue:**
```java
Map<QueueAttributeName, String> attributes = Map.of(
QueueAttributeName.FIFO_QUEUE, "true",
QueueAttributeName.CONTENT_BASED_DEDUPLICATION, "true"
);
String fifoQueueUrl = sqsClient.createQueue(CreateQueueRequest.builder()
.queueName("my-queue.fifo")
.attributes(attributes)
.build()).queueUrl();
sqsClient.sendMessage(SendMessageRequest.builder()
.queueUrl(fifoQueueUrl)
.messageBody("Order #12345")
.messageGroupId("orders")
.messageDeduplicationId(UUID.randomUUID().toString())
.build());
```
### SNS Operations
**Create Topic and Publish:**
```java
String topicArn = snsClient.createTopic(CreateTopicRequest.builder()
.name("my-topic")
.build()).topicArn();
snsClient.publish(PublishRequest.builder()
.topicArn(topicArn)
.subject("Test Notification")
.message("Hello, SNS!")
.build());
```
**SNS to SQS Subscription:**
```java
String queueArn = sqsClient.getQueueAttributes(GetQueueAttributesRequest.builder()
.queueUrl(queueUrl)
.attributeNames(QueueAttributeName.QUEUE_ARN)
.build()).attributes().get(QueueAttributeName.QUEUE_ARN);
snsClient.subscribe(SubscribeRequest.builder()
.protocol("sqs")
.endpoint(queueArn)
.topicArn(topicArn)
.build());
```
### Spring Boot Integration
```java
@Service
@RequiredArgsConstructor
public class OrderNotificationService {
private final SnsClient snsClient;
private final ObjectMapper objectMapper;
@Value("${aws.sns.order-topic-arn}")
private String orderTopicArn;
public void sendOrderNotification(Order order) throws JsonProcessingException {
snsClient.publish(PublishRequest.builder()
.topicArn(orderTopicArn)
.subject("New Order Received")
.message(objectMapper.writeValueAsString(order))
.messageAttributes(Map.of(
"orderType", MessageAttributeValue.builder()
.dataType("String")
.stringValue(order.getType())
.build()))
.build());
}
}
```
## Instructions
### Implement Message Processing (with Validation)
1. **Create queues/topics** with appropriate configuration
2. **Send messages** and validate `messageId` is returned
3. **Receive messages** with long polling (`waitTimeSeconds: 20`)
4. **Process messages** - validate payload before processing
5. **Delete messages** only after successful processing - verify deletion response
6. **Check DLQ** periodically for failed messages using `redrivePolicy`
7. **Verify delivery** - monitor CloudWatch `NumberOfMessagesSent` metric
**Validation Checklist:**
```java
// After send
if (messageId == null || messageId.isEmpty()) {
throw new MessagingException("Message send failed - no messageId returned");
}
// After receive
if (response.messages().isEmpty()) {
log.debug("No messages available - normal with long polling");
}
// After delete
if (!deleteResponse.sdkHttpResponse().isSuccessful()) {
throw new MessagingException("Message deletion failed");
}
```
### Setup Credentials
```bash
export AWS_ACCESS_KEY_ID=your-access-key
export AWS_SECRET_ACCESS_KEY=your-secret-key
export AWS_REGION=us-east-1
```
### Monitor and Debug
- CloudWatch metrics: `ApproximateNumberOfMessages`, `NumberOfMessagesSent`, `NumberOfMessagesReceived`
- Enable SDK logging: `software.amazon.awssdk` at DEBUG level
- Use X-Ray for distributed tracing
## Best Practices
**SQS:**
- Use long polling (20-40s) to reduce empty responses and costs
- Always delete messages after successful processing
- Implement idempotent processing for duplicate handling
- Configure DLQ (`redrivePolicy`) for failed messages
- Use FIFO queues when order matters (300 msg/sec limit)
**SNS:**
- Use filter policies to reduce unnecessary deliveries
- Keep messages under 256KB
- Implement retry with exponential backoff
- Monitor `NumberOfNotificationFailed` metric
**General:**
- Use IAM roles over static credentials
- Reuse clients (they are thread-safe)
- Test with LocalStack or Testcontainers
## Detailed References
- [references/detailed-sqs-operations.md](references/detailed-sqs-operations.md)
- [references/detailed-sns-operations.md](references/detailed-sns-operations.md)
- [references/spring-boot-integration.md](references/spring-boot-integration.md)
- [references/aws-official-documentation.md](references/aws-official-documentation.md)
## Constraints and Warnings
- **Message Size**: Maximum 256KB for SQS and SNS
- **Visibility Timeout**: Undeleted messages reappear after timeout - always delete after processing
- **Input Validation**: Sanitize message body before processing - messages may contain untrusted payloads
- **FIFO Naming**: Must end with `.fifo` suffix
- **FIFO Throughput**: 300 msg/sec per queue (use partitioning for higher throughput)
- **Message Retention**: SQS retains messages max 14 days
- **DLQ Required**: Configure dead letter queue to prevent message loss
- **Region-Specific**: SQS queues are region-specific; cross-region requires SNS
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.