CKN.Sdk.Messaging.ServiceBus
0.0.0-alpha.0.51
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
<PackageReference Include="CKN.Sdk.Messaging.ServiceBus" Version="0.0.0-alpha.0.51" />
<PackageVersion Include="CKN.Sdk.Messaging.ServiceBus" Version="0.0.0-alpha.0.51" />
<PackageReference Include="CKN.Sdk.Messaging.ServiceBus" />
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"
#:package CKN.Sdk.Messaging.ServiceBus@0.0.0-alpha.0.51
#addin nuget:?package=CKN.Sdk.Messaging.ServiceBus&version=0.0.0-alpha.0.51&prerelease
#tool nuget:?package=CKN.Sdk.Messaging.ServiceBus&version=0.0.0-alpha.0.51&prerelease
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 | Versions 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. |
-
net10.0
- Azure.Messaging.ServiceBus (>= 7.20.2)
- CKN.Sdk.Core (>= 0.0.0-alpha.0.51)
- CKN.Sdk.Messaging (>= 0.0.0-alpha.0.51)
-
net8.0
- Azure.Messaging.ServiceBus (>= 7.20.2)
- CKN.Sdk.Core (>= 0.0.0-alpha.0.51)
- CKN.Sdk.Messaging (>= 0.0.0-alpha.0.51)
-
net9.0
- Azure.Messaging.ServiceBus (>= 7.20.2)
- CKN.Sdk.Core (>= 0.0.0-alpha.0.51)
- CKN.Sdk.Messaging (>= 0.0.0-alpha.0.51)
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 |