[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EF904VX7XMDFBASM0TTMEG":3,"skill-same:01M6EF904VX7XMDFBASM0TTMEG":66},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":21,"linkOnly":22,"markdownContent":23,"markdownBody":23,"frontMatter":24,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":30,"ownerHtmlUrl":31,"ownerBlogUrl":6,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M6EF904VX7XMDFBASM0TTMEG","kafka-js",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fkafka-js\u002FSKILL.md",[],[18,19,20],"kafka","js","kafka js","2026-11-10 10:12:30",false,"# KafkaJS — Apache Kafka Client for Node.js\n\nYou are an expert in KafkaJS, the pure JavaScript Apache Kafka client for Node.js. You help developers build event-driven architectures with producers, consumers, consumer groups, exactly-once semantics, SASL authentication, and admin operations — processing millions of events per second for real-time analytics, event sourcing, log aggregation, and microservices communication.\n\n## Core Capabilities\n\n### Producer\n\n```typescript\nimport { Kafka, Partitioners, CompressionTypes } from \"kafkajs\";\n\nconst kafka = new Kafka({\n  clientId: \"my-app\",\n  brokers: [\"kafka1:9092\", \"kafka2:9092\", \"kafka3:9092\"],\n  ssl: true,\n  sasl: { mechanism: \"plain\", username: process.env.KAFKA_USER!, password: process.env.KAFKA_PASS! },\n  retry: { initialRetryTime: 300, retries: 10 },\n});\n\nconst producer = kafka.producer({\n  createPartitioner: Partitioners.DefaultPartitioner,\n  idempotent: true,                       \u002F\u002F Exactly-once delivery\n  transactionalId: \"order-service\",\n});\n\nawait producer.connect();\n\n\u002F\u002F Send single message\nawait producer.send({\n  topic: \"orders\",\n  messages: [\n    {\n      key: order.userId,                  \u002F\u002F Same user → same partition → ordered\n      value: JSON.stringify({ type: \"order.created\", data: order }),\n      headers: { \"correlation-id\": requestId, \"source\": \"order-service\" },\n    },\n  ],\n  compression: CompressionTypes.GZIP,\n});\n\n\u002F\u002F Transactional send (atomic multi-topic)\nconst transaction = await producer.transaction();\ntry {\n  await transaction.send({ topic: \"orders\", messages: [{ key: order.id, value: JSON.stringify(order) }] });\n  await transaction.send({ topic: \"notifications\", messages: [{ key: order.userId, value: JSON.stringify(notification) }] });\n  await transaction.commit();\n} catch (err) {\n  await transaction.abort();\n}\n```\n\n### Consumer\n\n```typescript\nconst consumer = kafka.consumer({\n  groupId: \"order-processor\",\n  sessionTimeout: 30000,\n  heartbeatInterval: 3000,\n  maxBytesPerPartition: 1048576,          \u002F\u002F 1MB per partition fetch\n});\n\nawait consumer.connect();\nawait consumer.subscribe({ topics: [\"orders\", \"payments\"], fromBeginning: false });\n\nawait consumer.run({\n  eachMessage: async ({ topic, partition, message }) => {\n    const event = JSON.parse(message.value!.toString());\n\n    switch (topic) {\n      case \"orders\":\n        await processOrder(event);\n        break;\n      case \"payments\":\n        await processPayment(event);\n        break;\n    }\n  },\n});\n\n\u002F\u002F Batch processing for throughput\nawait consumer.run({\n  eachBatch: async ({ batch, resolveOffset, heartbeat }) => {\n    for (const message of batch.messages) {\n      await processMessage(message);\n      resolveOffset(message.offset);\n      await heartbeat();                  \u002F\u002F Prevent session timeout on long batches\n    }\n  },\n});\n\n\u002F\u002F Graceful shutdown\nconst shutdown = async () => {\n  await consumer.disconnect();\n  await producer.disconnect();\n  process.exit(0);\n};\nprocess.on(\"SIGTERM\", shutdown);\n```\n\n## Installation\n\n```bash\nnpm install kafkajs\n```\n\n## Best Practices\n\n1. **Idempotent producer** — Enable `idempotent: true` for exactly-once delivery; prevents duplicate messages on retries\n2. **Key-based partitioning** — Use message keys (userId, orderId) to ensure related events go to the same partition (ordered)\n3. **Consumer groups** — Add more consumers to a group for horizontal scaling; Kafka auto-rebalances partitions\n4. **Manual offset commits** — Commit offsets after processing, not before; prevents data loss on consumer crashes\n5. **Heartbeat in batches** — Call `heartbeat()` during long batch processing to prevent session timeout\n6. **Dead-letter topics** — Send failed messages to a DLT (`topic.DLT`) after retries; don't block the consumer\n7. **Schema validation** — Use Avro\u002FProtobuf with Schema Registry for strong typing across producers\u002Fconsumers\n8. **Compression** — Use GZIP or LZ4 compression; reduces network bandwidth 60-80% for JSON payloads\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FTerminalSkills\u002Fskills\u002Fkafka-js",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill kafka-js",{"tool":40,"command":41},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill kafka-js",{"tool":43,"command":44},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill kafka-js","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fkafka-js\u002FSKILL.md",true,[48,54,58,62],{"path":49,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":52,"sourceHtmlUrl":53},"checklist.md","REFERENCE","参考文档",14349,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.qoder\u002Fskills\u002Fbmad-create-story\u002Fchecklist.md",{"path":55,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":56,"sourceHtmlUrl":57},"discover-inputs.md",3911,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.qoder\u002Fskills\u002Fbmad-create-story\u002Fdiscover-inputs.md",{"path":59,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":60,"sourceHtmlUrl":61},"template.md",948,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.qoder\u002Fskills\u002Fbmad-create-story\u002Ftemplate.md",{"path":63,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":64,"sourceHtmlUrl":65},"workflow.md",19932,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.qoder\u002Fskills\u002Fbmad-create-story\u002Fworkflow.md",[67,81,91,100,106,113],{"skillNo":68,"name":69,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":77,"publishedAt":21},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[72],{"categoryNo":73,"categoryName":74,"taxonomyType":75,"taxonomyTypeDesc":76},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[78,79,80],"model","model hierarchy","model hierarchy skill",{"skillNo":82,"name":83,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":87,"publishedAt":21},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[86],{"categoryNo":73,"categoryName":74,"taxonomyType":75,"taxonomyTypeDesc":76},[88,89,90],"MCP","zoom","zoom mcp",{"skillNo":92,"name":93,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":21},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[97,98,99,89],"sdk","zoom apps sdk","apps",{"skillNo":101,"name":102,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":21},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[102],{"skillNo":107,"name":108,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":112,"publishedAt":21},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[111],{"categoryNo":73,"categoryName":74,"taxonomyType":75,"taxonomyTypeDesc":76},[108],{"skillNo":114,"name":115,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":21},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[115]]