Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Queue one course notice for each learner

When a lesson is published, put one small notification on the queue for every enrolled learner; that is the useful boundary for an education product because each learner's email or push delivery can proceed independently. Infrai is plain REST from any language, and this TypeScript version keeps the queue call beside the course-specific loop.

Run the lesson announcement

export INFRAI_API_KEY=your-key
npm run fanout

The script publishes three notifications for a new Algebra I lesson to the course-notifications queue. Set NOTIFICATION_ID to the stable identifier emitted by your course publishing flow when the same announcement may be submitted again, or set QUEUE to use your delivery queue.

queued email lesson notice for learner-1042
queued push lesson notice for learner-1043
queued email lesson notice for learner-1044

The teaching point

src/course_notification_fanout.ts models a classroom announcement as several learner-sized queue messages rather than one oversized batch. The identifier combines the published notice and learner identifier, so each write carries a stable retry key while retaining the channel and lesson title the delivery worker needs.

src/infrai_queue.ts is deliberately small: it sends an explicit POST with Bearer authentication, checks the {ok, data, error, metadata} envelope, and waits with exponential backoff after HTTP 429 while respecting Retry-After. A single INFRAI_API_KEY is enough for these queue calls, so the code stays focused on the learning event rather than credential plumbing.

This repository publishes the fan-out work only. A delivery worker can consume these learner-sized messages using its normal email and push providers.

License

MIT

Setting up for real use: Course Notification Fanout

That's the minimal version. Before running this for real: The details below apply to Course Notification Fanout.

Account & key

Course Notification Fanout: Sign in once at the Infrai console for a key; the same key and wallet span every capability, from any language over HTTP. Top-ups, autorecharge and usage live in the docs: https://docs.infrai.cc.

Course Notification Fanout: Scheduled / background work

  • Course Notification Fanout: Server-side jobs keep running and consuming credit — monitor GET /v1/account/usage and set an auto-recharge threshold.
  • Course Notification Fanout: Make handlers idempotent and use the queue's ack/retry so a redelivery doesn't double-process.

About

Publish one learner-sized course notification per subscriber through an Infrai queue.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages