I’m not sure I understand exactly, but

I’m not sure I understand exactly, but can you call your function unconditionally from your queue() handler to do this?
11 Replies
proxy
proxy3mo ago
I need to create 2 queues: 1 for calling an API that is rate limited and other for general file conversion. I want 1 queue to be slow and the other as fast as possible. This means that the queue consumer are different functions and in a team enviroment we would appreciate being able to associate a consumer function with a queue
Sid
SidOP3mo ago
I’m assuming you want to have one queue() handler for both these queues? Every message has a queue ID in there, maybe you can look at it to call your separate functions?
proxy
proxy3mo ago
1 handler per queue
Sid
SidOP3mo ago
Hm, I feel like I’m missing something, can you then not call your separate functions from your separate queue() handlers? Maybe some dummy code would help
proxy
proxy3mo ago
There is no mention in the docs about multiple handlers, only 1 global handler where I can distinguish the queue based on the MessageBatch Even if I declared more than 1 handler, it is not transparent which one would be or if both would execute. Associating a handler with a specific queue or a list of queues would make this a lot easier to understand If you compare with AWS SQS, you can see on their docs that you can specific a queue for a consumer using the QueueUrl using their SDK, not HTTP pulling.
Sid
SidOP3mo ago
Ah so I meant that if you have two queues, then you can have two Workers, each with a queue() handler. Worker A could be the fast queue and Worker B the slow one If you’re using HTTP Pull, then the queue ID would be in the URL so I guess that matches SQS?
proxy
proxy3mo ago
I'm not using HTTP pull, I'm using hono.js with wrangler, there is no documentation on how to assoaciate a queue with a queue handler
Sid
SidOP3mo ago
Cloudflare Workers - Hono
Web framework built on Web Standards for Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, Node.js, and others. Fast, but not only fast.
Sid
SidOP3mo ago
Hono is just an HTTP framework, it really has nothing to do with other kinds of handlers, but you can attach them this way ^
proxy
proxy3mo ago
As mentioned before, I'm watch to associate a handlers with a single queue. Cloudflare documentation lacks any example on how to have 1 handler per queue, this is not a HonoJs issue.

Did you find this page helpful?