The queue worker code for Jobs At Conf demo. This is a consumer queue worker that gets triggered when an image gets uploaded to R2.
If you don't have a queue, create a new one with the following command:
npx wrangler queues create <MY-QUEUE-NAME>
Replace <MY-QUEUE-NAME>
with the name of your queue.
In your wrangler.toml
file, update the name of your queue under [[queues.consumer]]
.
To use this queue for event notification, use the below command:
$ npx wrangler r2 bucket notification create <BUCKET_NAME> --event-type <EVENT_TYPE> --queue <QUEUE_NAME>
Replace the values as follows:
<BUCKET_NAME>
: Name of the R2 bucket used to store the images<EVENT_TYPE>
:object-create
<QUEUE_NAME>
: Name of the newly created queue in the previous steps
Before deploying, update the URL of the application in src/index.ts
.
Execute the following comand to deploy the worker.
$ cd ./apps/worker
$ npx wrangler deploy