Running Scheduled Jobs
Learn how to create and manage background jobs using Inngest in your Indie Kit application
Running Scheduled Jobs ⏰
Let's learn how to create and manage background jobs using Inngest! 🚀
Creating Background Jobs 🛠️
-
Create a new function in
src/lib/inngest/functions/hello-world.ts
: -
Register your function in
src/lib/inngest/functions/index.ts
:
Sending Events 📤
Trigger your background jobs by sending events:
Monitoring Jobs 📊
-
Local Development:
- Visit Inngest dashboard at
http://localhost:8288
- Monitor job executions
- Debug events and functions
- Visit Inngest dashboard at
-
Production:
- Use Inngest Cloud dashboard
- Set up alerts
- View execution history
Advanced Features 🎯
Events Guide
Learn about event structure, types, and best practices for sending events in Inngest.
Background Jobs
Create reliable background jobs with retries, error handling, and monitoring.
Fan Out Jobs
Process multiple items in parallel with fan-out pattern.
Multiple Triggers
Trigger functions from multiple events or conditions.
Rate Limiting
Control job execution rates and prevent overload.
Sleep Steps
Add delays and schedule future actions in your jobs.
Best Practices 💡
-
Function Organization
- One function per file
- Clear, descriptive names
- Register all functions in
index.ts
-
Event Design
- Use consistent naming
- Include necessary data
- Version events if needed
-
Error Handling
- Implement retries
- Log errors properly
- Set up monitoring
-
Testing
- Test locally first
- Use development environment
- Monitor execution times
Example Use Cases 🌟
- Send welcome emails
- Process uploads
- Generate reports
- Clean up old data
- Schedule notifications
- Sync external services
Now your Indie Kit application is ready to handle background jobs efficiently! 🎉