Scripts2026年7月21日·1 分钟阅读

Coravel — Near-Zero Config Task Scheduling and Queuing for .NET

Coravel provides task scheduling, queuing, caching, mailing, and event broadcasting for ASP.NET Core applications with minimal configuration, inspired by the simplicity of Laravel's task scheduler.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Coravel
直接安装命令
npx -y tokrepo@latest install f70c7ab5-8500-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

Coravel brings the ease of Laravel's task scheduling and queuing to .NET. Instead of setting up external job servers or cron daemons, you define scheduled tasks and background jobs in your application code with a fluent API that reads like English, all within the built-in DI container.

What Coravel Does

  • Schedules recurring tasks with a fluent cron-like API (daily, weekly, hourly, custom intervals)
  • Queues background jobs for async processing without external infrastructure
  • Provides an in-process event broadcasting system with listeners
  • Includes a lightweight caching layer with driver abstraction
  • Sends templated emails using Razor views with a built-in mailer

Architecture Overview

Coravel runs as hosted services within the ASP.NET Core process. The scheduler ticks on a one-minute interval and evaluates which IInvocable tasks are due based on their configured schedule. Queued tasks run on a background thread pool managed by the framework. All components integrate through IServiceCollection, so they have full access to DI-registered services, database contexts, and configuration. No external message brokers or schedulers are needed.

Self-Hosting & Configuration

  • Install via NuGet: dotnet add package coravel
  • Register the scheduler, queue, or other features in Program.cs
  • Implement IInvocable for each scheduled task or queued job
  • Configure the mailer with SMTP settings via appsettings.json
  • Use Coravel.Pro (optional) for a dashboard UI to monitor tasks

Key Features

  • Fluent scheduling API: .Daily(), .Weekly(), .Cron("0 */6 * * *"), .EveryMinute()
  • In-process job queue with error handling and retry support
  • Event broadcasting with multiple listeners per event
  • Razor-based email templates with SMTP or custom mail drivers
  • No external dependencies: runs entirely within the ASP.NET Core host

Comparison with Similar Tools

  • Hangfire — persistent job storage with dashboard; Coravel is lighter with in-process scheduling
  • Quartz.NET — enterprise-grade scheduler; Coravel trades clustering for simplicity
  • Azure Functions Timer Trigger — cloud-specific; Coravel runs anywhere your app runs
  • System.Threading.Timer — low-level; Coravel adds DI, fluent API, and error handling
  • BackgroundService — manual hosted service; Coravel provides a structured scheduling layer on top

FAQ

Q: Does Coravel persist scheduled tasks across restarts? A: No. Coravel's scheduler is in-memory. For persistent job queues, consider Hangfire or Quartz.NET. Coravel is designed for tasks defined in code that run within the application lifecycle.

Q: Can I run tasks on multiple instances? A: Coravel schedules are per-instance. For distributed locking, you would need to add an external lock mechanism or use a single-instance deployment.

Q: How do I handle task failures? A: Use .OnError(exception => ...) on the scheduler or queue to handle and log errors per-task.

Q: What is the difference between scheduled tasks and queued jobs? A: Scheduled tasks run on a recurring time-based schedule. Queued jobs are triggered by your code and processed asynchronously in the background.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产