CKN.Sdk.Scheduling.Quartz 0.0.0-alpha.0.55

This is a prerelease version of CKN.Sdk.Scheduling.Quartz.
dotnet add package CKN.Sdk.Scheduling.Quartz --version 0.0.0-alpha.0.55
                    
NuGet\Install-Package CKN.Sdk.Scheduling.Quartz -Version 0.0.0-alpha.0.55
                    
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.Scheduling.Quartz" Version="0.0.0-alpha.0.55" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CKN.Sdk.Scheduling.Quartz" Version="0.0.0-alpha.0.55" />
                    
Directory.Packages.props
<PackageReference Include="CKN.Sdk.Scheduling.Quartz" />
                    
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.Scheduling.Quartz --version 0.0.0-alpha.0.55
                    
#r "nuget: CKN.Sdk.Scheduling.Quartz, 0.0.0-alpha.0.55"
                    
#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.Scheduling.Quartz@0.0.0-alpha.0.55
                    
#: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.Scheduling.Quartz&version=0.0.0-alpha.0.55&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CKN.Sdk.Scheduling.Quartz&version=0.0.0-alpha.0.55&prerelease
                    
Install as a Cake Tool

CKN.Sdk.Scheduling.Quartz

Mühendislik Amacı (Engineering Intent): CKN.Sdk.Scheduling.Quartz, Java ekosisteminden port edilmiş, oldukça köklü, gelişmiş ve karmaşık zamanlama senaryolarını destekleyen Quartz.NET kütüphanesini projeye entegre eder. Neden var? Hangfire'ın sunmadığı çok gelişmiş takvimleme (iş günleri, tatiller hariç), karmaşık CRON ifadeleri, Cron-Trigger kombinasyonları ve "Stateful" (durumlu) görevler gibi spesifik gereksinimleri karşılamak için. Ne zaman kullanılmalı? "Her ayın 3. cuma günü saat 15:00'te çalışsın ama o gün resmi tatilse bir sonraki iş günü çalışsın" gibi çok gelişmiş bir takvim/zamanlama mimarisi gerektiren B2B veya ERP tarzı sistemlerde tercih edilmelidir.

🚀 Hızlı Başlangıç

Kurulum

dotnet add package CKN.Sdk.Scheduling.Quartz

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

using CKN.Sdk.Scheduling.Quartz;
using Quartz;

var builder = WebApplication.CreateBuilder(args);

// Quartz'ı .NET Hosted Service olarak arka planda çalışmak üzere kaydeder
builder.Services.AddCknQuartz(q =>
{
    // Örnek bir Job'u DI'a tanıtma
    var jobKey = new JobKey("EmailCampaignJob");
    q.AddJob<EmailCampaignJob>(opts => opts.WithIdentity(jobKey));
    
    // Bu Job için tetikleyici (Trigger) oluşturma (Örn: Her saat başı)
    q.AddTrigger(opts => opts
        .ForJob(jobKey)
        .WithIdentity("EmailCampaignJob-trigger")
        .WithCronSchedule("0 0 * * * ?")); // Cron expression
});

var app = builder.Build();

💡 Gerçek Hayat Senaryoları

Senaryo 1: Gelişmiş IJob İmplementasyonu (Durumlu Görev)

Aynı anda sadece tek bir örneğinin çalışması gereken (Concurrency kontrolü) ve kendi içinde durum tutan (Stateful) görev tanımı.

using Quartz;

// DisallowConcurrentExecution: Aynı job henüz bitmemişse, sıradaki trigger'ı bekletir.
[DisallowConcurrentExecution]
public class EmailCampaignJob(ILogger<EmailCampaignJob> logger) : IJob
{
    public async Task Execute(IJobExecutionContext context)
    {
        logger.LogInformation("E-posta kampanyası çalışıyor...");
        
        // JobDataMap üzerinden göreve özel parametrelere erişim
        var campaignId = context.JobDetail.JobDataMap.GetIntValue("CampaignId");
        
        await Task.Delay(5000); // Uzun süren işlem
        
        logger.LogInformation($"Kampanya {campaignId} tamamlandı.");
    }
}

Senaryo 2: Dinamik Job Eklemek (Çalışma Zamanı)

Kod yazarken değil, kullanıcı arayüzünden yeni bir görev kurduğunda (Runtime) dinamik olarak Quartz'a görev ekleme (Varyasyon).

public class SchedulerService(ISchedulerFactory schedulerFactory)
{
    public async Task ScheduleNewCampaignAsync(int campaignId, DateTime runAt)
    {
        var scheduler = await schedulerFactory.GetScheduler();

        var job = JobBuilder.Create<EmailCampaignJob>()
            .WithIdentity($"campaign-{campaignId}")
            .UsingJobData("CampaignId", campaignId)
            .Build();

        var trigger = TriggerBuilder.Create()
            .WithIdentity($"campaign-trigger-{campaignId}")
            .StartAt(runAt) // İstenen spesifik tarihte çalıştır
            .Build();

        await scheduler.ScheduleJob(job, trigger);
    }
}

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

  • Soru: Quartz, görevleri (Jobs) veritabanında (persistent) tutabilir mi?
  • Cevap: Evet, appsettings.json ve DI yapılandırması üzerinden AdoJobStore (SQL Server, Postgres vb.) kullanılarak görevlerin ve tetikleyicilerin (triggers) veritabanında tutulması sağlanabilir.
  • Soru: Neden Hangfire yerine Quartz seçeyim?
  • Cevap: Yönetim paneline (Dashboard) ihtiyacınız yoksa ve "Sadece hafta içi çalış, tatilleri atla" gibi karmaşık Cron/Takvim kurallarına ihtiyacınız varsa Quartz rakipsizdir. Hangfire ise daha çok kullanım kolaylığı ve hazır arayüzü ile öne çıkar.
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.55 57 9/28/2026
0.0.0-alpha.0.51 50 9/25/2026
0.0.0-alpha.0.50 51 9/25/2026
0.0.0-alpha.0.38 79 9/6/2026
0.0.0-alpha.0.37 71 9/6/2026