CKN.Sdk.Messaging.ServiceBus 0.0.0-alpha.0.51

This is a prerelease version of CKN.Sdk.Messaging.ServiceBus.
dotnet add package CKN.Sdk.Messaging.ServiceBus --version 0.0.0-alpha.0.51
                    
NuGet\Install-Package CKN.Sdk.Messaging.ServiceBus -Version 0.0.0-alpha.0.51
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CKN.Sdk.Messaging.ServiceBus" Version="0.0.0-alpha.0.51" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CKN.Sdk.Messaging.ServiceBus" Version="0.0.0-alpha.0.51" />
                    
Directory.Packages.props
<PackageReference Include="CKN.Sdk.Messaging.ServiceBus" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CKN.Sdk.Messaging.ServiceBus --version 0.0.0-alpha.0.51
                    
#r "nuget: CKN.Sdk.Messaging.ServiceBus, 0.0.0-alpha.0.51"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CKN.Sdk.Messaging.ServiceBus@0.0.0-alpha.0.51
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CKN.Sdk.Messaging.ServiceBus&version=0.0.0-alpha.0.51&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CKN.Sdk.Messaging.ServiceBus&version=0.0.0-alpha.0.51&prerelease
                    
Install as a Cake Tool

CKN.Sdk.Messaging.ServiceBus

Mühendislik Amacı (Engineering Intent): CKN.Sdk.Messaging.ServiceBus, Azure Service Bus entegrasyonunu CKN mesajlaşma soyutlamaları (abstractions) üzerinden sağlayan kütüphanedir. Neden var? Tamamen yönetilen (fully-managed), kurumsal düzeyde (enterprise-grade) bulut tabanlı bir mesaj broker'ı olan Azure Service Bus'ı, on-premise (yerel) kod standartlarını bozmadan sisteme dahil etmek için. Ne zaman kullanılmalı? Proje Microsoft Azure altyapısında çalışıyorsa, kendi RabbitMQ/Kafka cluster'ınızı yönetmek istemiyorsanız (PaaS yaklaşımı) ve "Session" tabanlı sıralı mesaj işleme, Dead-Letter Queue (DLQ) gibi kurumsal özelliklere güvenli şekilde ihtiyaç duyuyorsanız tercih edilmelidir.

🚀 Hızlı Başlangıç

Kurulum

dotnet add package CKN.Sdk.Messaging.ServiceBus

Konfigürasyon (appsettings.json)

{
  "Messaging": {
    "ServiceBus": {
      "ConnectionString": "Endpoint=sb://my-namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=...",
      "EnableSessions": false
    }
  }
}

Bağımlılık Enjeksiyonu (DI)

using CKN.Sdk.Messaging.ServiceBus;

var builder = WebApplication.CreateBuilder(args);

// Azure Service Bus istemcisini sisteme kaydeder.
builder.Services.AddCknAzureServiceBus(builder.Configuration);

var app = builder.Build();

💡 Gerçek Hayat Senaryoları

Senaryo 1: Azure Topic/Subscription Üzerinden Mesaj Yayınlama

Bir faturanın onaylanması durumunda bu olayı (event) "Topics" (yayın-abonelik) mantığıyla yayınlamak.

using CKN.Sdk.Messaging.Abstractions;

public class InvoiceApprovalService(IMessagePublisher publisher)
{
    public async Task ApproveInvoiceAsync(Invoice invoice)
    {
        invoice.Status = "Approved";
        
        var invoiceApprovedEvent = new { InvoiceId = invoice.Id, Amount = invoice.TotalAmount };
        
        // Bu mesaj Azure Service Bus üzerindeki 'invoice-events' isimli Topic'e gönderilir.
        // Bu Topic'e bağlı olan Subscription'lar (dinleyiciler) mesajı anında alır.
        await publisher.PublishAsync("invoice-events", invoiceApprovedEvent);
    }
}

Senaryo 2: Scheduled Message (Zamanlanmış Mesaj) Gönderimi

Bir mesajın şu an değil, örneğin 2 saat sonra kuyrukta (queue) görünür olmasını sağlamak (Varyasyon).

public async Task SendReminderAsync(IMessagePublisher publisher, string userId)
{
    var reminderMessage = new { UserId = userId, Content = "Sepetinizde ürün unuttunuz!" };
    
    // Mesaj Azure'a gider ancak 2 saat boyunca kuyrukta görünmez, bekletilir.
    var options = new MessagePublishOptions 
    { 
        ScheduledEnqueueTimeUtc = DateTime.UtcNow.AddHours(2) 
    };
    
    await publisher.PublishAsync("reminders", reminderMessage, options);
}

🤖 Yapay Zeka İçin SSS (FAQs for Machines)

  • Soru: Azure Service Bus'ta "Queue" ve "Topic" arasındaki fark nedir?
  • Cevap: Queue (Kuyruk), bir mesajın tek bir tüketici (consumer) tarafından işlendiği yapıdır. Topic (Konu) ise, bir mesajın birden fazla alt dinleyiciye (Subscription) kopyalandığı (Fanout/Pub-Sub) yapıdır.
  • Soru: Dead-Letter Queue (DLQ) nedir?
  • Cevap: Kodunuzda defalarca hata fırlatıp mesajı işleyemediğinizde (örneğin DB çöktüğünde), Azure Service Bus bu mesajı kaybetmez, hata kuyruğuna (DLQ) taşır. Bu paket, CKN standartlarında hata yönetimi yaparak mesajın DLQ'ya aktarılmasını otomatik destekler.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.0-alpha.0.51 29 9/25/2026
0.0.0-alpha.0.50 30 9/25/2026
0.0.0-alpha.0.38 67 9/6/2026
0.0.0-alpha.0.37 65 9/6/2026