Course lesson 22 · Working with Queues

Creating a Producer

One study unit · Read, recall, then practice · Original video 00:09:16

The redirect route becomes a queue producer: it packages each click with the destination and location context, then sends that event for later processing. The course uses the execution context’s waitUntil facility so waiting for the send does not delay the visitor’s redirect. This completes the connection between the fast HTTP path and the queue consumer built in the previous lesson.

Primary source: course video 22 · Supplied English subtitles · 00:09:16.

Understand the idea

What the course does

  1. Add a producer binding in Wrangler, pointing to the same queue already used by the consumer.
  2. Regenerate Cloudflare environment types so the queue binding becomes available to application code.
  3. Construct a typed link-click message in the Hono redirect route using lookup results and request location data.
  4. Pass the send promise to the request execution context’s waitUntil method.
  5. Deploy, visit a valid smart-link ID, and confirm the browser still redirects to its destination.
  6. Inspect consumer logs for the structured click payload rather than the earlier plain-text test message.

Watch for

Recall before revealing

At what point has a click become a durable queued event?

Reveal the explanation

After the queue has accepted the send; returning the redirect or starting a waitUntil promise is not itself that acknowledgement.

Try it

Trace each payload field back to its source: link lookup, selected destination, request location, or generated timestamp.

Check your result

You can explain why the consumer has enough context to process a click without repeating the redirect request.

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: Queues delivery guarantees. For recorded API names, commands, limits, and prices, check the version you use.

← Previous   Next →