For the complete documentation index, see llms.txt. This page is also available as Markdown.

Hello world, but with scheduled email sending

Goal

We want to add scheduled email sending to an Hello World Application already hosted on Poja. Our goal is to automatically send a daily email to a specified email address using Poja’s Scheduled Tasks feature

Deploy in one click

Before diving into the step-by-step guide, you can simply click the Deploy to Poja button. This will instantly deploy this template to your Poja account

Deploy to Poja

How-to in 2 steps

Step 1: Implement the email sending code

Because Scheduled Tasks are asynchronous, we first have to implement the email sending feature as standard for asynchronous tasks.

Let’s update our configuration’s Worker to enable scheduled tasks:

Next let’s create our Event class and event consumer:

To trigger a deployment, just commit and push the code to the preprod branch of the repository.

Step 2: Make the email sending automatic everyday

Now that we have our email sending code, all we have to do is to update our configuration using the Scheduled Tasks menu:

Poja Scheduled Tasks configuration

  • Name: the name of your scheduled task

  • Class name: the exact class name of your asynchronous event, here EmailUpdateTriggered

  • Description: what does your scheduled task do

  • Scheduled expression: refers to the time or interval of execution of your scheduled task, refer to this documentation for further information, here cron(0 6 * * ? *) means every day at 6:00 AM UTC

  • Event stack source: refers to the Queue and the Workers that will process your asynchronous event If set to 2, the following method must be overridden to return your.package.name.endpoint.event.EventStack.EVENT_STACK_2 inside EmailUpdateTriggered

Save the configuration and wait for the deployment to complete, and voilà!


Last updated

Was this helpful?