{"id":"5ff97ff9-e80a-4214-9b50-9138da8e2598","shortId":"SKTePm","kind":"skill","title":"azure-eventhub-ts","tagline":"High-throughput event streaming and real-time data ingestion.","description":"# Azure Event Hubs SDK for TypeScript\n\nHigh-throughput event streaming and real-time data ingestion.\n\n## Installation\n\n```bash\nnpm install @azure/event-hubs @azure/identity\n```\n\nFor checkpointing with consumer groups:\n```bash\nnpm install @azure/eventhubs-checkpointstore-blob @azure/storage-blob\n```\n\n## Environment Variables\n\n```bash\nEVENTHUB_NAMESPACE=<namespace>.servicebus.windows.net\nEVENTHUB_NAME=my-eventhub\nSTORAGE_ACCOUNT_NAME=<storage-account>\nSTORAGE_CONTAINER_NAME=checkpoints\n```\n\n## Authentication\n\n```typescript\nimport { EventHubProducerClient, EventHubConsumerClient } from \"@azure/event-hubs\";\nimport { DefaultAzureCredential } from \"@azure/identity\";\n\nconst fullyQualifiedNamespace = process.env.EVENTHUB_NAMESPACE!;\nconst eventHubName = process.env.EVENTHUB_NAME!;\nconst credential = new DefaultAzureCredential();\n\n// Producer\nconst producer = new EventHubProducerClient(fullyQualifiedNamespace, eventHubName, credential);\n\n// Consumer\nconst consumer = new EventHubConsumerClient(\n  \"$Default\", // Consumer group\n  fullyQualifiedNamespace,\n  eventHubName,\n  credential\n);\n```\n\n## Core Workflow\n\n### Send Events\n\n```typescript\nconst producer = new EventHubProducerClient(namespace, eventHubName, credential);\n\n// Create batch and add events\nconst batch = await producer.createBatch();\nbatch.tryAdd({ body: { temperature: 72.5, deviceId: \"sensor-1\" } });\nbatch.tryAdd({ body: { temperature: 68.2, deviceId: \"sensor-2\" } });\n\nawait producer.sendBatch(batch);\nawait producer.close();\n```\n\n### Send to Specific Partition\n\n```typescript\n// By partition ID\nconst batch = await producer.createBatch({ partitionId: \"0\" });\n\n// By partition key (consistent hashing)\nconst batch = await producer.createBatch({ partitionKey: \"device-123\" });\n```\n\n### Receive Events (Simple)\n\n```typescript\nconst consumer = new EventHubConsumerClient(\"$Default\", namespace, eventHubName, credential);\n\nconst subscription = consumer.subscribe({\n  processEvents: async (events, context) => {\n    for (const event of events) {\n      console.log(`Partition: ${context.partitionId}, Body: ${JSON.stringify(event.body)}`);\n    }\n  },\n  processError: async (err, context) => {\n    console.error(`Error on partition ${context.partitionId}: ${err.message}`);\n  },\n});\n\n// Stop after some time\nsetTimeout(async () => {\n  await subscription.close();\n  await consumer.close();\n}, 60000);\n```\n\n### Receive with Checkpointing (Production)\n\n```typescript\nimport { EventHubConsumerClient } from \"@azure/event-hubs\";\nimport { ContainerClient } from \"@azure/storage-blob\";\nimport { BlobCheckpointStore } from \"@azure/eventhubs-checkpointstore-blob\";\n\nconst containerClient = new ContainerClient(\n  `https://${storageAccount}.blob.core.windows.net/${containerName}`,\n  credential\n);\n\nconst checkpointStore = new BlobCheckpointStore(containerClient);\n\nconst consumer = new EventHubConsumerClient(\n  \"$Default\",\n  namespace,\n  eventHubName,\n  credential,\n  checkpointStore\n);\n\nconst subscription = consumer.subscribe({\n  processEvents: async (events, context) => {\n    for (const event of events) {\n      console.log(`Processing: ${JSON.stringify(event.body)}`);\n    }\n    // Checkpoint after processing batch\n    if (events.length > 0) {\n      await context.updateCheckpoint(events[events.length - 1]);\n    }\n  },\n  processError: async (err, context) => {\n    console.error(`Error: ${err.message}`);\n  },\n});\n```\n\n### Receive from Specific Position\n\n```typescript\nconst subscription = consumer.subscribe({\n  processEvents: async (events, context) => { /* ... */ },\n  processError: async (err, context) => { /* ... */ },\n}, {\n  startPosition: {\n    // Start from beginning\n    \"0\": { offset: \"@earliest\" },\n    // Start from end (new events only)\n    \"1\": { offset: \"@latest\" },\n    // Start from specific offset\n    \"2\": { offset: \"12345\" },\n    // Start from specific time\n    \"3\": { enqueuedOn: new Date(\"2024-01-01\") },\n  },\n});\n```\n\n## Event Hub Properties\n\n```typescript\n// Get hub info\nconst hubProperties = await producer.getEventHubProperties();\nconsole.log(`Partitions: ${hubProperties.partitionIds}`);\n\n// Get partition info\nconst partitionProperties = await producer.getPartitionProperties(\"0\");\nconsole.log(`Last sequence: ${partitionProperties.lastEnqueuedSequenceNumber}`);\n```\n\n## Batch Processing Options\n\n```typescript\nconst subscription = consumer.subscribe(\n  {\n    processEvents: async (events, context) => { /* ... */ },\n    processError: async (err, context) => { /* ... */ },\n  },\n  {\n    maxBatchSize: 100,           // Max events per batch\n    maxWaitTimeInSeconds: 30,    // Max wait for batch\n  }\n);\n```\n\n## Key Types\n\n```typescript\nimport {\n  EventHubProducerClient,\n  EventHubConsumerClient,\n  EventData,\n  ReceivedEventData,\n  PartitionContext,\n  Subscription,\n  SubscriptionEventHandlers,\n  CreateBatchOptions,\n  EventPosition,\n} from \"@azure/event-hubs\";\n\nimport { BlobCheckpointStore } from \"@azure/eventhubs-checkpointstore-blob\";\n```\n\n## Event Properties\n\n```typescript\n// Send with properties\nconst batch = await producer.createBatch();\nbatch.tryAdd({\n  body: { data: \"payload\" },\n  properties: {\n    eventType: \"telemetry\",\n    deviceId: \"sensor-1\",\n  },\n  contentType: \"application/json\",\n  correlationId: \"request-123\",\n});\n\n// Access in receiver\nconsumer.subscribe({\n  processEvents: async (events, context) => {\n    for (const event of events) {\n      console.log(`Type: ${event.properties?.eventType}`);\n      console.log(`Sequence: ${event.sequenceNumber}`);\n      console.log(`Enqueued: ${event.enqueuedTimeUtc}`);\n      console.log(`Offset: ${event.offset}`);\n    }\n  },\n});\n```\n\n## Error Handling\n\n```typescript\nconsumer.subscribe({\n  processEvents: async (events, context) => {\n    try {\n      for (const event of events) {\n        await processEvent(event);\n      }\n      await context.updateCheckpoint(events[events.length - 1]);\n    } catch (error) {\n      // Don't checkpoint on error - events will be reprocessed\n      console.error(\"Processing failed:\", error);\n    }\n  },\n  processError: async (err, context) => {\n    if (err.name === \"MessagingError\") {\n      // Transient error - SDK will retry\n      console.warn(\"Transient error:\", err.message);\n    } else {\n      // Fatal error\n      console.error(\"Fatal error:\", err);\n    }\n  },\n});\n```\n\n## Best Practices\n\n1. **Use checkpointing** - Always checkpoint in production for exactly-once processing\n2. **Batch sends** - Use `createBatch()` for efficient sending\n3. **Partition keys** - Use partition keys to ensure ordering for related events\n4. **Consumer groups** - Use separate consumer groups for different processing pipelines\n5. **Handle errors gracefully** - Don't checkpoint on processing failures\n6. **Close clients** - Always close producer/consumer when done\n7. **Monitor lag** - Track `lastEnqueuedSequenceNumber` vs processed sequence\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.","tags":["azure","eventhub","antigravity","awesome","skills","sickn33","agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows"],"capabilities":["skill","source-sickn33","skill-azure-eventhub-ts","topic-agent-skills","topic-agentic-skills","topic-ai-agent-skills","topic-ai-agents","topic-ai-coding","topic-ai-workflows","topic-antigravity","topic-antigravity-skills","topic-claude-code","topic-claude-code-skills","topic-codex-cli","topic-codex-skills"],"categories":["antigravity-awesome-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/sickn33/antigravity-awesome-skills/azure-eventhub-ts","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add sickn33/antigravity-awesome-skills","source_repo":"https://github.com/sickn33/antigravity-awesome-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 34928 github stars · SKILL.md body (7,246 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-24T18:50:30.593Z","embedding":null,"createdAt":"2026-04-18T21:32:27.893Z","updatedAt":"2026-04-24T18:50:30.593Z","lastSeenAt":"2026-04-24T18:50:30.593Z","tsv":"'-01':350,351 '-1':136,443 '-123':174,448 '-2':143 '/$':250 '0':162,289,322,373 '1':294,331,496,537 '100':394 '12345':340 '2':338,549 '2024':349 '3':345,557 '30':400 '4':569 '5':580 '6':590 '60000':225 '68.2':140 '7':598 '72.5':133 'access':449 'account':61 'action':618 'add':124 'alway':540,593 'applic':612 'application/json':445 'ask':656 'async':191,206,220,271,296,311,315,386,390,454,480,513 'authent':67 'await':128,144,147,159,170,221,223,290,361,371,432,489,492 'azur':2,16 'azure-eventhub-t':1 'azure/event-hubs':37,73,234,419 'azure/eventhubs-checkpointstore-blob':47,242,423 'azure/identity':38,77 'azure/storage-blob':48,238 'bash':34,44,51 'batch':122,127,146,158,169,286,378,398,404,431,550 'batch.tryadd':130,137,434 'begin':321 'best':535 'blob.core.windows.net':249 'blob.core.windows.net/$':248 'blobcheckpointstor':240,256,421 'bodi':131,138,202,435 'boundari':664 'catch':497 'checkpoint':40,66,228,283,501,539,541,586 'checkpointstor':254,266 'clarif':658 'clear':631 'client':592 'close':591,594 'consist':166 'console.error':209,299,508,531 'console.log':199,279,363,374,462,466,469,472 'console.warn':524 'const':78,82,86,91,99,114,126,157,168,179,187,195,243,253,258,267,275,307,359,369,382,430,458,485 'consum':42,98,100,104,180,259,570,574 'consumer.close':224 'consumer.subscribe':189,269,309,384,452,478 'contain':64 'containercli':236,244,246,257 'containernam':251 'contenttyp':444 'context':193,208,273,298,313,317,388,392,456,482,515 'context.partitionid':201,213 'context.updatecheckpoint':291,493 'core':109 'correlationid':446 'creat':121 'createbatch':553 'createbatchopt':416 'credenti':87,97,108,120,186,252,265 'criteria':667 'data':14,31,436 'date':348 'default':103,183,262 'defaultazurecredenti':75,89 'describ':619,635 'devic':173 'deviceid':134,141,441 'differ':577 'done':597 'earliest':324 'effici':555 'els':528 'end':327 'enqueu':470 'enqueuedon':346 'ensur':564 'environ':49,647 'environment-specif':646 'err':207,297,316,391,514,534 'err.message':214,301,527 'err.name':517 'error':210,300,475,498,503,511,520,526,530,533,582 'event':8,17,25,112,125,176,192,196,198,272,276,278,292,312,329,352,387,396,424,455,459,461,481,486,488,491,494,504,568 'event.body':204,282 'event.enqueuedtimeutc':471 'event.offset':474 'event.properties':464 'event.sequencenumber':468 'eventdata':411 'eventhub':3,52,55,59 'eventhubconsumercli':71,102,182,232,261,410 'eventhubnam':83,96,107,119,185,264 'eventhubproducercli':70,94,117,409 'eventposit':417 'events.length':288,293,495 'eventtyp':439,465 'exact':546 'exactly-onc':545 'execut':614 'expert':652 'fail':510 'failur':589 'fatal':529,532 'fullyqualifiednamespac':79,95,106 'get':356,366 'grace':583 'group':43,105,571,575 'handl':476,581 'hash':167 'high':6,23 'high-throughput':5,22 'hub':18,353,357 'hubproperti':360 'hubproperties.partitionids':365 'id':156 'import':69,74,231,235,239,408,420 'info':358,368 'ingest':15,32 'input':661 'instal':33,36,46 'json.stringify':203,281 'key':165,405,559,562 'lag':600 'last':375 'lastenqueuedsequencenumb':602 'latest':333 'limit':623 'match':632 'max':395,401 'maxbatchs':393 'maxwaittimeinsecond':399 'messagingerror':518 'miss':669 'monitor':599 'my-eventhub':57 'name':56,62,65,85 'namespac':53,81,118,184,263 'new':88,93,101,116,181,245,255,260,328,347 'npm':35,45 'offset':323,332,337,339,473 'option':380 'order':565 'output':641 'overview':622 'partit':152,155,164,200,212,364,367,558,561 'partitioncontext':413 'partitionid':161 'partitionkey':172 'partitionproperti':370 'partitionproperties.lastenqueuedsequencenumber':377 'payload':437 'per':397 'permiss':662 'pipelin':579 'posit':305 'practic':536 'process':280,285,379,509,548,578,588,604 'process.env.eventhub':80,84 'processerror':205,295,314,389,512 'processev':190,270,310,385,453,479,490 'produc':90,92,115 'producer.close':148 'producer.createbatch':129,160,171,433 'producer.geteventhubproperties':362 'producer.getpartitionproperties':372 'producer.sendbatch':145 'producer/consumer':595 'product':229,543 'properti':354,425,429,438 'real':12,29 'real-tim':11,28 'receiv':175,226,302,451 'receivedeventdata':412 'relat':567 'reprocess':507 'request':447 'requir':660 'retri':523 'review':653 'safeti':663 'scope':634 'sdk':19,521 'send':111,149,427,551,556 'sensor':135,142,442 'separ':573 'sequenc':376,467,605 'servicebus.windows.net':54 'settimeout':219 'simpl':177 'skill':610,626 'skill-azure-eventhub-ts' 'source-sickn33' 'specif':151,304,336,343,648 'start':319,325,334,341 'startposit':318 'stop':215,654 'storag':60,63 'storageaccount':247 'stream':9,26 'subscript':188,268,308,383,414 'subscription.close':222 'subscriptioneventhandl':415 'substitut':644 'success':666 'task':630 'telemetri':440 'temperatur':132,139 'test':650 'throughput':7,24 'time':13,30,218,344 'topic-agent-skills' 'topic-agentic-skills' 'topic-ai-agent-skills' 'topic-ai-agents' 'topic-ai-coding' 'topic-ai-workflows' 'topic-antigravity' 'topic-antigravity-skills' 'topic-claude-code' 'topic-claude-code-skills' 'topic-codex-cli' 'topic-codex-skills' 'track':601 'transient':519,525 'treat':639 'tri':483 'ts':4 'type':406,463 'typescript':21,68,113,153,178,230,306,355,381,407,426,477 'use':538,552,560,572,608,624 'valid':649 'variabl':50 'vs':603 'wait':402 'workflow':110,616","prices":[{"id":"1b7492de-1588-44b3-a35f-ada9468ba18d","listingId":"5ff97ff9-e80a-4214-9b50-9138da8e2598","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"sickn33","category":"antigravity-awesome-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T21:32:27.893Z"}],"sources":[{"listingId":"5ff97ff9-e80a-4214-9b50-9138da8e2598","source":"github","sourceId":"sickn33/antigravity-awesome-skills/azure-eventhub-ts","sourceUrl":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/azure-eventhub-ts","isPrimary":false,"firstSeenAt":"2026-04-18T21:32:27.893Z","lastSeenAt":"2026-04-24T18:50:30.593Z"}],"details":{"listingId":"5ff97ff9-e80a-4214-9b50-9138da8e2598","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"sickn33","slug":"azure-eventhub-ts","github":{"repo":"sickn33/antigravity-awesome-skills","stars":34928,"topics":["agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows","antigravity","antigravity-skills","claude-code","claude-code-skills","codex-cli","codex-skills","cursor","cursor-skills","developer-tools","gemini-cli","gemini-skills","kiro","mcp","skill-library"],"license":"mit","html_url":"https://github.com/sickn33/antigravity-awesome-skills","pushed_at":"2026-04-24T06:41:17Z","description":"Installable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.","skill_md_sha":"31dfdc5b659be5142ed94d8acfb21b36090fb13b","skill_md_path":"skills/azure-eventhub-ts/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/azure-eventhub-ts"},"layout":"multi","source":"github","category":"antigravity-awesome-skills","frontmatter":{"name":"azure-eventhub-ts","description":"High-throughput event streaming and real-time data ingestion."},"skills_sh_url":"https://skills.sh/sickn33/antigravity-awesome-skills/azure-eventhub-ts"},"updatedAt":"2026-04-24T18:50:30.593Z"}}