Invocables represent a self-contained job within your system.

Coravel leverages them to make your code much easier to write, compose and maintain.

Here's an example of scheduling an invocable:


Creating An Invocable

Creating an invocable uses the shared interface Coravel.Invocable.IInvocable.

Using .NET Core's dependency injection services, your invocables will have all their dependencies injected whenever they are executed.


You may use the Coravel Cli to generate a new invocable.


  1. Implement the interface Coravel.Invocable.IInvocable in your class.

  2. In your invocable's constructor, inject any types that are available from your application's service provider.

  3. Make sure that your invocable itself is available in the service container (usually done in your Startup.cs file).


That's it!


#1 Generating A Daily Report And Emailing To Users

In this example, SendDailyReportsEmailJob is an invocable that was created by us. It handles getting data (via some repository that was injected via DI), generating an e-mail, etc.

Coravel Invocable Sample

A sample implementation of the SendDailyReportsEmailJob class might look something like this (which is using Coravel's Mailer to send email):

Coravel Invocable Sample

#2 Trigger Long Running Calculations In Background

You might have a use-case where an HTML button on an admin screen fires off an expensive process which then stores the result in a database. You don't want your users waiting for it to finish, since it takes a while.

Assuming you created an invocable DoExpensiveCalculationAndStoreInDB, you could run it like this:

Coravel Invocable Sample