Course lesson 38 · Managing Workflows with Durable Objects

Full Link Click Integration with Alarms

One study unit · Read, recall, then practice · Original video 00:23:25

The persistent counter becomes a working evaluation scheduler integrated with the link-click consumer. Each object stores click context, schedules an alarm only when no alarm is pending, and starts the destination workflow when that alarm fires. The demonstration uses ten seconds to verify the full pipeline and then changes the interval to twenty-four hours so repeated clicks share one scheduled evaluation.

Primary source: course video 38 · Supplied English subtitles · 00:23:25.

Understand the idea

What the course does

  1. Remove the teaching counter and its temporary route, then introduce persisted click context.
  2. Implement collection to save that context and create an alarm only if none exists.
  3. Implement the alarm callback to require click data and create the workflow instance.
  4. Refine the binding type so workflow creation checks its input parameters.
  5. Extend the queue handler to resolve the object from link ID plus destination URL and pass the click context to it.
  6. Deploy and follow one click through redirect, queue, D1, alarm, workflow, and stored screenshot.
  7. Change the delay from the ten-second demonstration to twenty-four hours and extract scheduling calls into a helper.

Watch for

Follow the final workflow correction in lesson 34 when combining these steps.

Recall before revealing

If a destination receives no further clicks after an evaluation, will this scheduler automatically evaluate it again tomorrow?

Reveal the explanation

No. The implementation schedules from incoming clicks when no alarm is pending; it does not show the alarm scheduling its own next run.

Try it

Trace clicks at minute zero, minute five, and after the first alarm has fired. State how many pending alarms and workflow launches exist at each point.

Check your result

Your trace shows one shared pending alarm before the first firing and a new delayed run only after another click arrives.

Practice prompts and answer checks are added teaching material. Answer from memory first, then compare and explain any difference.

Rewatch only what you need

Open this lesson in your original course library and seek to the times below. Videos are not hosted on this site.

Companion primary documentation: What are Durable Objects?. For recorded API names, commands, limits, and prices, check the version you use.

← Previous   Next →