githubEdit

TickerQ

TickerQarrow-up-right is a high-performance, reflection-free background task scheduler for .NET that uses source generators. Brighter provides integration with TickerQ for scheduler functionality, offering a modern, lightweight alternative for distributed scheduling.

TickerQ Overview

TickerQ is designed for performance and cloud-native environments. Unlike traditional schedulers, it leverages .NET source generators to avoid runtime reflection, making it extremely fast and memory-efficient. Key features include:

  • Reflection-Free: Uses source generators for compile-time job discovery

  • High Performance: Minimal memory footprint and fast startup

  • Dashboard: Built-in real-time dashboard for monitoring jobs

  • Persistence: Support for Entity Framework Core

  • Flexible Scheduling: Cron expressions and time-based scheduling

  • Clean API: Modern, type-safe API design

For more information, visit the TickerQ websitearrow-up-right.

How Brighter Integrates with TickerQ

Brighter integrates with TickerQ through:

  1. TickerQBrighterJob: A specialized job that executes scheduled Brighter messages

  2. TickerQSchedulerFactory: Factory that creates Brighter's message scheduler backed by TickerQ

  3. TickerQScheduler: Scheduler that schedules Brighter messages using TickerQ

When you schedule a message with Brighter:

  1. Brighter uses the TickerQ manager to schedule a job

  2. TickerQ persists the job (if configured)

  3. At the scheduled time, TickerQ triggers the execution

  4. The TickerQBrighterJob dispatches the message via Brighter's Command Processor

NuGet Packages

Install the required NuGet packages:

For persistence, add the EF Core package:

Configuration

Basic Configuration

Configure Brighter with TickerQ scheduler in your Program.cs:

Configuration with Persistence (EF Core)

For production scenarios, you should use persistent storage to ensure jobs are not lost during restarts:

for more information refer to the TickerQ EfCorearrow-up-right

Enabling the Dashboard

TickerQ comes with a built-in dashboard for monitoring scheduled jobs:

You can then access the dashboard at {{appurl}}/dashboard.

Code Examples

Basic Scheduling

Scheduling a message with TickerQ execution is identical to other schedulers in Brighter, as the IAmACommandProcessor interface abstracts the underlying implementation.

Cancelling a Scheduled Job

You can cancel a scheduled job using the ID returned during scheduling:

Rescheduling a Scheduled Job

You can reschedule a scheduled job using the ID returned during scheduling:

Best Practices

1. Use Persistence in Production

Always configure TickerQ with a persistent store (like EF Core) for production environments. In-memory scheduling is suitable only for development or non-critical transient tasks.

2. Monitor via Dashboard

Leverage the TickerQ dashboard to inspect job states, failures, and upcoming schedules. This is invaluable for debugging and operations.

Troubleshooting

Jobs Not Firing

  • Check Host: TickerQ runs as a hosted service. Ensure TickerQ service started is called and the host is kept alive.

  • Timezone: Be aware of timezone settings when scheduling absolute times. Brighter typically uses UTC.

Dashboard Not Loading

  • Verify app.UseTickerQDashboard() is called in the pipeline.

  • Check if the configured path (default /tickerq/dashboard) conflicts with other routes.

Summary

TickerQ integration for Brighter offers a modern, high-performance scheduling option.

  • Fast: Source-generator based, low overhead.

  • Visual: Integrated dashboard.

  • Standard: Fully implements Brighter's IMessageScheduler interface.

Use TickerQ when you want a lightweight, modern scheduler without the legacy footprint of older libraries.

Last updated

Was this helpful?