redis-pubsub
Redis Pub/Sub and Streams for messaging. Covers publish/subscribe, streams with consumer groups, and real-time patterns. Use for lightweight messaging and real-time features. USE WHEN: user mentions "redis pub/sub", "redis streams", "real-time messaging", "lightweight messaging", "pattern subscriptions", asks about "fast messaging", "simple pub/sub", "event streams with redis" DO NOT USE FOR: guaranteed delivery - use `kafka`, `rabbitmq`, or `pulsar`; complex routing - use `rabbitmq`; high durability needs - use `kafka`; enterprise features - use `activemq`; cloud-native - use cloud providers
What this skill does
# Redis Pub/Sub & Streams Core Knowledge
> **Full Reference**: See [advanced.md](advanced.md) for Streams consumer groups (Node.js, Java, Python), pending message recovery, TLS configuration, and Sentinel setup.
> **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `redis-pubsub` for comprehensive documentation.
## Quick Start (Docker)
```yaml
services:
redis:
image: redis:7-alpine
ports:
- "6379:6379"
command: redis-server --appendonly yes
```
## Core Concepts
| Feature | Pub/Sub | Streams |
|---------|---------|---------|
| Persistence | No | Yes |
| Consumer Groups | No | Yes |
| Message History | No | Yes |
| Delivery | Fire-and-forget | At-least-once |
| Use Case | Real-time broadcast | Event sourcing, queues |
## Pub/Sub (Node.js)
```typescript
import Redis from 'ioredis';
const publisher = new Redis({ host: 'localhost', port: 6379 });
const subscriber = new Redis({ host: 'localhost', port: 6379 });
// Subscriber
subscriber.subscribe('orders', 'notifications', (err, count) => {
console.log(`Subscribed to ${count} channels`);
});
subscriber.on('message', (channel, message) => {
const data = JSON.parse(message);
console.log(`Received on ${channel}:`, data);
});
// Pattern subscription
subscriber.psubscribe('order.*');
subscriber.on('pmessage', (pattern, channel, message) => {
console.log(`Pattern ${pattern}, Channel ${channel}:`, message);
});
// Publisher
await publisher.publish('orders', JSON.stringify({
orderId: '123',
status: 'created',
}));
```
## Pub/Sub (Java - Spring)
```java
@Configuration
public class RedisPubSubConfig {
@Bean
public RedisMessageListenerContainer container(
RedisConnectionFactory connectionFactory) {
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.addMessageListener(orderListener(), new ChannelTopic("orders"));
container.addMessageListener(orderPatternListener(), new PatternTopic("order.*"));
return container;
}
@Bean
public MessageListener orderListener() {
return (message, pattern) -> {
String body = new String(message.getBody());
Order order = objectMapper.readValue(body, Order.class);
processOrder(order);
};
}
}
@Service
public class OrderPublisher {
@Autowired
private StringRedisTemplate redisTemplate;
public void publishOrder(Order order) {
redisTemplate.convertAndSend("orders",
objectMapper.writeValueAsString(order));
}
}
```
## Pub/Sub (Python)
```python
import redis
import json
r = redis.Redis(host='localhost', port=6379, decode_responses=True)
# Subscriber (run in thread)
def subscriber():
pubsub = r.pubsub()
pubsub.subscribe('orders')
pubsub.psubscribe('order.*')
for message in pubsub.listen():
if message['type'] in ('message', 'pmessage'):
data = json.loads(message['data'])
print(f"Received: {data}")
# Publisher
r.publish('orders', json.dumps({'orderId': '123', 'status': 'created'}))
```
## Stream Commands Reference
| Command | Description |
|---------|-------------|
| `XADD` | Add entry to stream |
| `XREAD` | Read entries |
| `XREADGROUP` | Read with consumer group |
| `XACK` | Acknowledge processing |
| `XPENDING` | List pending entries |
| `XCLAIM` | Claim pending entry |
| `XTRIM` | Trim stream size |
## When NOT to Use This Skill
- Guaranteed message delivery - Pub/Sub is fire-and-forget
- Complex routing patterns - RabbitMQ is better
- High-throughput event sourcing - Kafka provides better throughput
- Multi-datacenter replication - Kafka or Pulsar handle this better
## Anti-Patterns
| Anti-Pattern | Why It's Bad | Solution |
|--------------|--------------|----------|
| Pub/Sub for critical data | No persistence | Use Streams |
| No XTRIM on streams | Memory growth | Set MAXLEN or auto-trim |
| Single consumer group | Can't scale | Use consumer groups |
| No XPENDING monitoring | Lost messages | Monitor and claim pending |
| No ACK after processing | Premature consumption | ACK only after success |
## Quick Troubleshooting
| Issue | Likely Cause | Fix |
|-------|--------------|-----|
| Messages not received | No active subscribers | Pub/Sub requires active subscribers |
| Stream growing unbounded | No XTRIM | Add MAXLEN limit |
| High memory usage | Large stream | Trim streams |
| Pending messages growing | Consumer crashes | Implement XCLAIM recovery |
| Duplicate processing | Consumer group issue | Ensure unique consumer IDs |
## Production Checklist
- [ ] Authentication enabled
- [ ] TLS configured
- [ ] Sentinel/Cluster for HA
- [ ] Stream trimming configured
- [ ] Consumer group monitoring
- [ ] Pending message handling
- [ ] Memory limits set
- [ ] Persistence configured (AOF)
## Monitoring Metrics
| Metric | Alert Threshold |
|--------|-----------------|
| Stream length | > 1000000 |
| Pending entries | > 10000 |
| Consumer lag | > 1000 |
| Memory usage | > 80% |
## Reference Documentation
Available topics: `basics`, `pubsub`, `streams`, `patterns`
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.