kafka
Apache Kafka event streaming platform. Covers producers, consumers, topics, partitions, Kafka Streams, and Connect. Use for high-throughput event-driven…
от claude-dev-suite★ 51 звезда на GitHub
Установить kafka в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Apache Kafka Core Knowledge
Deep Knowledge: Use
mcp__documentation__fetch_docswith technology:kafkafor comprehensive documentation.
Quick Start (Docker)
# docker-compose.yml
services:
kafka:
image: bitnami/kafka:latest
ports:
- "9092:9092"
environment:
- KAFKA_CFG_NODE_ID=0
- KAFKA_CFG_PROCESS_ROLES=controller,broker
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
- KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka:9093
- KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
# Start
docker-compose up -d
# Create topic
docker exec kafka kafka-topics.sh --create --topic my-topic \
--bootstrap-server localhost:9092 --partitions 3 --replication-factor 1
Core Concepts
| Concept | Description |
|---|---|
| Topic | Named stream of records, append-only log |
| Partition | Ordered, immutable sequence within topic |
| Offset | Unique ID for record within partition |
| Consumer Group | Set of consumers sharing topic consumption |
| Broker | Kafka server handling storage and requests |
| Replication Factor | Number of partition copies across brokers |
Architecture
┌─────────────────────────────────────────────────────────┐
│ Kafka Cluster │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │Broker 0 │ │Broker 1 │ │Broker 2 │ │
│ │ P0(L) │ │ P0(F) │ │ P1(L) │ │
│ │ P1(F) │ │ P1(F) │ │ P0(F) │ │
│ └─────────┘ └─────────┘ └─────────┘ │
└─────────────────────────────────────────────────────────┘
▲ │
│ ▼
┌──────────┐ ┌──────────────┐
│ Producer │ │Consumer Group│
└──────────┘ │ C1 C2 C3 │
└──────────────┘
Producer Patterns
Node.js (kafkajs)
import { Kafka, Partitioners } from 'kafkajs';
const kafka = new Kafka({
clientId: 'my-app',
brokers: ['localhost:9092'],
});
const producer = kafka.producer({
createPartitioner: Partitioners.DefaultPartitioner,
idempotent: true, // Enable exactly-once
});
await producer.connect();
// Send single message
await producer.send({
topic: 'orders',
messages: [
{
key: orderId, // Partition key
value: JSON.stringify(order),
headers: {
'correlation-id': correlationId,
'source': 'order-service',
},
},
],
});
// Batch send
await producer.sendBatch({
topicMessages: [
{
topic: 'orders',
messages: orders.map(o => ({
key: o.id,
value: JSON.stringify(o),
})),
},
],
});
await producer.disconnect();
Java (Spring Kafka)
@Configuration
public class KafkaConfig {
@Bean
public ProducerFactory<String, String> producerFactory() {
Map<String, Object> config = new HashMap<>();
config.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
config.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
config.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
config.put(ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG, true);
config.put(ProducerConfig.ACKS_CONFIG, "all");
return new DefaultKafkaProducerFactory<>(config);
}
@Bean
public KafkaTemplate<String, String> kafkaTemplate() {
return new KafkaTemplate<>(producerFactory());
}
}
@Service
public class OrderProducer {
@Autowired
private KafkaTemplate<String, String> kafkaTemplate;
public void sendOrder(Order order) {
kafkaTemplate.send("orders", order.getId(), objectMapper.writeValueAsString(order))
.whenComplete((result, ex) -> {
if (ex != null) {
log.error("Failed to send order", ex);
}
});
}
}
Python (confluent-kafka)
from confluent_kafka import Producer
import json
conf = {
'bootstrap.servers': 'localhost:9092',
'client.id': 'my-app',
'acks': 'all',
'enable.idempotence': True,
}
producer = Producer(conf)
def delivery_callback(err, msg):
if err:
print(f'Message delivery failed: {err}')
else:
print(f'Message delivered to {msg.topic()}[{msg.partition()}]')
# Send message
producer.produce(
topic='orders',
key=order_id.encode('utf-8'),
value=json.dumps(order).encode('utf-8'),
callback=delivery_callback,
headers={'correlation-id': correlation_id}
)
producer.flush() # Wait for delivery
Go (segmentio/kafka-go)
package main
import (
"context"
"encoding/json"
"github.com/segmentio/kafka-go"
)
func main() {
writer := &kafka
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
- 01
Read - 02
Grep - 03
Glob - 04
Write - 05
Edit
FAQ
Что делает скилл kafka?
Apache Kafka event streaming platform. Covers producers, consumers, topics, partitions, Kafka Streams, and Connect. Use for high-throughput event-driven architectures and real-time data pipelines. USE WHEN: user mentions "kafka", "event streaming", "kafka streams", "consumer groups", "topic partitions", asks about "high throughput messaging", "event sourcing", "log aggregation", "real-time pipelines" DO NOT USE FOR: simple queues - use `rabbitmq` or `activemq`; cloud-native lightweight - use `nats`; AWS-native - use `sqs`; Azure-native - use `azure-service-bus`; GCP-native - use `google-pubsub`
Как установить скилл kafka?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл kafka запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…