[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FD2B037AB9PKPH6AC17NP7":3,"skill-same:01M6FD2B037AB9PKPH6AC17NP7":48},{"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},"01M6FD2B037AB9PKPH6AC17NP7","azure-eventhub-dotnet",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\u002Fmicrosoft\u002Fskills\u002Fazure-eventhub-dotnet\u002FSKILL.md",[],[18,19,20],"dotnet","azure","azure eventhub dotnet","2026-11-10 10:12:30",false,"# Azure.Messaging.EventHubs (.NET)\n\nHigh-throughput event streaming SDK for sending and receiving events via Azure Event Hubs.\n\n## Installation\n\n```bash\n# Core package (sending and simple receiving)\ndotnet add package Azure.Messaging.EventHubs\n\n# Processor package (production receiving with checkpointing)\ndotnet add package Azure.Messaging.EventHubs.Processor\n\n# Authentication\ndotnet add package Azure.Identity\n\n# For checkpointing (required by EventProcessorClient)\ndotnet add package Azure.Storage.Blobs\n```\n\n**Current Versions**: Azure.Messaging.EventHubs v5.12.2, Azure.Messaging.EventHubs.Processor v5.12.2\n\n## Environment Variables\n\n```bash\nEVENTHUB_FULLY_QUALIFIED_NAMESPACE=\u003Cnamespace>.servicebus.windows.net\nEVENTHUB_NAME=\u003Cevent-hub-name>\n\n# For checkpointing (EventProcessorClient)\nBLOB_STORAGE_CONNECTION_STRING=\u003Cstorage-connection-string>\nBLOB_CONTAINER_NAME=\u003Ccheckpoint-container>\n\n# Alternative: Connection string auth (not recommended for production)\nEVENTHUB_CONNECTION_STRING=Endpoint=sb:\u002F\u002F\u003Cnamespace>.servicebus.windows.net\u002F;SharedAccessKeyName=...\n```\n\n## Authentication\n\n```csharp\nusing Azure.Identity;\nusing Azure.Messaging.EventHubs;\nusing Azure.Messaging.EventHubs.Producer;\n\n\u002F\u002F Always use DefaultAzureCredential for production\nvar credential = new DefaultAzureCredential();\n\nvar fullyQualifiedNamespace = Environment.GetEnvironmentVariable(\"EVENTHUB_FULLY_QUALIFIED_NAMESPACE\");\nvar eventHubName = Environment.GetEnvironmentVariable(\"EVENTHUB_NAME\");\n\nvar producer = new EventHubProducerClient(\n    fullyQualifiedNamespace,\n    eventHubName,\n    credential);\n```\n\n**Required RBAC Roles**:\n- **Sending**: `Azure Event Hubs Data Sender`\n- **Receiving**: `Azure Event Hubs Data Receiver`\n- **Both**: `Azure Event Hubs Data Owner`\n\n## Client Types\n\n| Client | Purpose | When to Use |\n|--------|---------|-------------|\n| `EventHubProducerClient` | Send events immediately in batches | Real-time sending, full control over batching |\n| `EventHubBufferedProducerClient` | Automatic batching with background sending | High-volume, fire-and-forget scenarios |\n| `EventHubConsumerClient` | Simple event reading | Prototyping only, NOT for production |\n| `EventProcessorClient` | Production event processing | **Always use this for receiving in production** |\n\n## Core Workflow\n\n### 1. Send Events (Batch)\n\n```csharp\nusing Azure.Identity;\nusing Azure.Messaging.EventHubs;\nusing Azure.Messaging.EventHubs.Producer;\n\nawait using var producer = new EventHubProducerClient(\n    fullyQualifiedNamespace,\n    eventHubName,\n    new DefaultAzureCredential());\n\n\u002F\u002F Create a batch (respects size limits automatically)\nusing EventDataBatch batch = await producer.CreateBatchAsync();\n\n\u002F\u002F Add events to batch\nvar events = new[]\n{\n    new EventData(BinaryData.FromString(\"{\\\"id\\\": 1, \\\"message\\\": \\\"Hello\\\"}\")),\n    new EventData(BinaryData.FromString(\"{\\\"id\\\": 2, \\\"message\\\": \\\"World\\\"}\"))\n};\n\nforeach (var eventData in events)\n{\n    if (!batch.TryAdd(eventData))\n    {\n        \u002F\u002F Batch is full - send it and create a new one\n        await producer.SendAsync(batch);\n        batch = await producer.CreateBatchAsync();\n        \n        if (!batch.TryAdd(eventData))\n        {\n            throw new Exception(\"Event too large for empty batch\");\n        }\n    }\n}\n\n\u002F\u002F Send remaining events\nif (batch.Count > 0)\n{\n    await producer.SendAsync(batch);\n}\n```\n\n### 2. Send Events (Buffered - High Volume)\n\n```csharp\nusing Azure.Messaging.EventHubs.Producer;\n\nvar options = new EventHubBufferedProducerClientOptions\n{\n    MaximumWaitTime = TimeSpan.FromSeconds(1)\n};\n\nawait using var producer = new EventHubBufferedProducerClient(\n    fullyQualifiedNamespace,\n    eventHubName,\n    new DefaultAzureCredential(),\n    options);\n\n\u002F\u002F Handle send success\u002Ffailure\nproducer.SendEventBatchSucceededAsync += args =>\n{\n    Console.WriteLine($\"Batch sent: {args.EventBatch.Count} events\");\n    return Task.CompletedTask;\n};\n\nproducer.SendEventBatchFailedAsync += args =>\n{\n    Console.WriteLine($\"Batch failed: {args.Exception.Message}\");\n    return Task.CompletedTask;\n};\n\n\u002F\u002F Enqueue events (sent automatically in background)\nfor (int i = 0; i \u003C 1000; i++)\n{\n    await producer.EnqueueEventAsync(new EventData($\"Event {i}\"));\n}\n\n\u002F\u002F Flush remaining events before disposing\nawait producer.FlushAsync();\n```\n\n### 3. Receive Events (Production - EventProcessorClient)\n\n```csharp\nusing Azure.Identity;\nusing Azure.Messaging.EventHubs;\nusing Azure.Messaging.EventHubs.Consumer;\nusing Azure.Messaging.EventHubs.Processor;\nusing Azure.Storage.Blobs;\n\n\u002F\u002F Blob container for checkpointing\nvar blobClient = new BlobContainerClient(\n    Environment.GetEnvironmentVariable(\"BLOB_STORAGE_CONNECTION_STRING\"),\n    Environment.GetEnvironmentVariable(\"BLOB_CONTAINER_NAME\"));\n\nawait blobClient.CreateIfNotExistsAsync();\n\n\u002F\u002F Create processor\nvar processor = new EventProcessorClient(\n    blobClient,\n    EventHubConsumerClient.DefaultConsumerGroup,\n    fullyQualifiedNamespace,\n    eventHubName,\n    new DefaultAzureCredential());\n\n\u002F\u002F Handle events\nprocessor.ProcessEventAsync += async args =>\n{\n    Console.WriteLine($\"Partition: {args.Partition.PartitionId}\");\n    Console.WriteLine($\"Data: {args.Data.EventBody}\");\n    \n    \u002F\u002F Checkpoint after processing (or batch checkpoints)\n    await args.UpdateCheckpointAsync();\n};\n\n\u002F\u002F Handle errors\nprocessor.ProcessErrorAsync += args =>\n{\n    Console.WriteLine($\"Error: {args.Exception.Message}\");\n    Console.WriteLine($\"Partition: {args.PartitionId}\");\n    return Task.CompletedTask;\n};\n\n\u002F\u002F Start processing\nawait processor.StartProcessingAsync();\n\n\u002F\u002F Run until cancelled\nawait Task.Delay(Timeout.Infinite, cancellationToken);\n\n\u002F\u002F Stop gracefully\nawait processor.StopProcessingAsync();\n```\n\n### 4. Partition Operations\n\n```csharp\n\u002F\u002F Get partition IDs\nstring[] partitionIds = await producer.GetPartitionIdsAsync();\n\n\u002F\u002F Send to specific partition (use sparingly)\nvar options = new SendEventOptions\n{\n    PartitionId = \"0\"\n};\nawait producer.SendAsync(events, options);\n\n\u002F\u002F Use partition key (recommended for ordering)\nvar batchOptions = new CreateBatchOptions\n{\n    PartitionKey = \"customer-123\"  \u002F\u002F Events with same key go to same partition\n};\nusing var batch = await producer.CreateBatchAsync(batchOptions);\n```\n\n## EventPosition Options\n\nControl where to start reading:\n\n```csharp\n\u002F\u002F Start from beginning\nEventPosition.Earliest\n\n\u002F\u002F Start from end (new events only)\nEventPosition.Latest\n\n\u002F\u002F Start from specific offset\nEventPosition.FromOffset(12345)\n\n\u002F\u002F Start from specific sequence number\nEventPosition.FromSequenceNumber(100)\n\n\u002F\u002F Start from specific time\nEventPosition.FromEnqueuedTime(DateTimeOffset.UtcNow.AddHours(-1))\n```\n\n## ASP.NET Core Integration\n\n```csharp\n\u002F\u002F Program.cs\nusing Azure.Identity;\nusing Azure.Messaging.EventHubs.Producer;\nusing Microsoft.Extensions.Azure;\n\nbuilder.Services.AddAzureClients(clientBuilder =>\n{\n    clientBuilder.AddEventHubProducerClient(\n        builder.Configuration[\"EventHub:FullyQualifiedNamespace\"],\n        builder.Configuration[\"EventHub:Name\"]);\n    \n    clientBuilder.UseCredential(new DefaultAzureCredential());\n});\n\n\u002F\u002F Inject in controller\u002Fservice\npublic class EventService\n{\n    private readonly EventHubProducerClient _producer;\n    \n    public EventService(EventHubProducerClient producer)\n    {\n        _producer = producer;\n    }\n    \n    public async Task SendAsync(string message)\n    {\n        using var batch = await _producer.CreateBatchAsync();\n        batch.TryAdd(new EventData(message));\n        await _producer.SendAsync(batch);\n    }\n}\n```\n\n## Best Practices\n\n1. **Use `EventProcessorClient` for receiving** — Never use `EventHubConsumerClient` in production\n2. **Checkpoint strategically** — After N events or time interval, not every event\n3. **Use partition keys** — For ordering guarantees within a partition\n4. **Reuse clients** — Create once, use as singleton (thread-safe)\n5. **Use `await using`** — Ensures proper disposal\n6. **Handle `ProcessErrorAsync`** — Always register error handler\n7. **Batch events** — Use `CreateBatchAsync()` to respect size limits\n8. **Use buffered producer** — For high-volume scenarios with automatic batching\n\n## Error Handling\n\n```csharp\nusing Azure.Messaging.EventHubs;\n\ntry\n{\n    await producer.SendAsync(batch);\n}\ncatch (EventHubsException ex) when (ex.Reason == EventHubsException.FailureReason.ServiceBusy)\n{\n    \u002F\u002F Retry with backoff\n    await Task.Delay(TimeSpan.FromSeconds(5));\n}\ncatch (EventHubsException ex) when (ex.IsTransient)\n{\n    \u002F\u002F Transient error - safe to retry\n    Console.WriteLine($\"Transient error: {ex.Message}\");\n}\ncatch (EventHubsException ex)\n{\n    \u002F\u002F Non-transient error\n    Console.WriteLine($\"Error: {ex.Reason} - {ex.Message}\");\n}\n```\n\n## Checkpointing Strategies\n\n| Strategy | When to Use |\n|----------|-------------|\n| Every event | Low volume, critical data |\n| Every N events | Balanced throughput\u002Freliability |\n| Time-based | Consistent checkpoint intervals |\n| Batch completion | After processing a logical batch |\n\n```csharp\n\u002F\u002F Checkpoint every 100 events\nprivate int _eventCount = 0;\n\nprocessor.ProcessEventAsync += async args =>\n{\n    \u002F\u002F Process event...\n    \n    _eventCount++;\n    if (_eventCount >= 100)\n    {\n        await args.UpdateCheckpointAsync();\n        _eventCount = 0;\n    }\n};\n```\n\n## Related SDKs\n\n| SDK | Purpose | Install |\n|-----|---------|---------|\n| `Azure.Messaging.EventHubs` | Core sending\u002Freceiving | `dotnet add package Azure.Messaging.EventHubs` |\n| `Azure.Messaging.EventHubs.Processor` | Production processing | `dotnet add package Azure.Messaging.EventHubs.Processor` |\n| `Azure.ResourceManager.EventHubs` | Management plane (create hubs) | `dotnet add package Azure.ResourceManager.EventHubs` |\n| `Microsoft.Azure.WebJobs.Extensions.EventHubs` | Azure Functions binding | `dotnet add package Microsoft.Azure.WebJobs.Extensions.EventHubs` |\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fmicrosoft\u002Fskills\u002Fazure-eventhub-dotnet",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 azure-eventhub-dotnet",{"tool":40,"command":41},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill azure-eventhub-dotnet",{"tool":43,"command":44},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill azure-eventhub-dotnet","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fmicrosoft\u002Fskills\u002Fazure-eventhub-dotnet\u002FSKILL.md",true,[],[49,63,73,82,88,95],{"skillNo":50,"name":51,"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":52,"categories":53,"keywords":59,"publishedAt":21},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[54],{"categoryNo":55,"categoryName":56,"taxonomyType":57,"taxonomyTypeDesc":58},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[60,61,62],"model","model hierarchy","model hierarchy skill",{"skillNo":64,"name":65,"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":66,"categories":67,"keywords":69,"publishedAt":21},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[68],{"categoryNo":55,"categoryName":56,"taxonomyType":57,"taxonomyTypeDesc":58},[70,71,72],"MCP","zoom","zoom mcp",{"skillNo":74,"name":75,"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":76,"categories":77,"keywords":78,"publishedAt":21},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[79,80,81,71],"sdk","zoom apps sdk","apps",{"skillNo":83,"name":84,"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":85,"categories":86,"keywords":87,"publishedAt":21},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[84],{"skillNo":89,"name":90,"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":91,"categories":92,"keywords":94,"publishedAt":21},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[93],{"categoryNo":55,"categoryName":56,"taxonomyType":57,"taxonomyTypeDesc":58},[90],{"skillNo":96,"name":97,"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":98,"categories":99,"keywords":100,"publishedAt":21},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[97]]