This project functions as a Consumer within the MurmurMaps architecture. Its primary responsibility is to asynchronously handle long-running background tasks—such as cluster creation, node updates and bulk node status updates by consuming messages from Cloudflare Queues.
This consumer solves several critical problems:
-
Cloudflare Pages / Workers execution limits: long‑running operations are no longer constrained by request‑response timeouts.
-
Unreliable or slow client connections: tasks continue running even if the client disconnects or has poor network conditions.
-
Improved user experience: the client only needs to display background job progress, rather than blocking on synchronous operations.
In practice, the client triggers a job (such as creating clusters or updating nodes), enqueues a message, and then periodically polls job status. The actual work is performed entirely by this MurmurMaps Consumer, ensuring reliability, scalability and fault tolerance.
Main Project repository: https://github.com/MurmurationsNetwork/MurmurMaps.
- Node.js (20+)
- pnpm
projects/
├── MurmurMaps/
└── MurmurMapsConsumer/The Consumer reuses MurmurMaps’ local D1 database by linking the .wrangler directory.
Run the following command in MurmurMaps Consumer:
pnpm run db:linkThis executes:
ln -s ../MurmurMaps/.wrangler .wranglerThis ensures both projects share the same local D1 database during development.
pnpm installpnpm devBy default, the Worker will be available at:
http://localhost:8787For local testing, jobs can be triggered by sending a request to the Consumer.
GET http://localhost:8787{
"job_uuid": "35eb82cf-4955-42b2-8bc9-cb743a73976d",
"type": "create-nodes",
"target_id": "1ea18216-aae8-4a47-a0b1-3aba0a9e7820",
"target_type": "clusters"
}The payload corresponds to a row in the jobs table and simulates a queue message being processed by the Consumer.
Please complete the MurmurMaps project setup and deployment before configuring and deploying the MurmurMaps Consumer (this project).
Click "Create application" on the Cloudflare "Workers & Pages" page, and the queue will be automatically bound to this Worker.
Once the consumer (this project) and producer (MurmurMaps) are deployed, the queue status will become Active in the Cloudflare dashboard.
{ "queues": { "consumers": [ { "queue": "murmur-maps-queue" } ] } }