multiple producers

Hello everyone. I am trying to build a worker which takes in requests via an API and the pushes to a queue of a dedicated worker. According to the documents, a worker can be the producer for many queues. However, I am not able to get it to bind. I cannot see an exact example so have copied the example for multiple KV stores. queues.producers = [ {queue = "xyz-process-queue", binding = "WORKER_QUEUE"}, {queue = "xyz-log-queue", binding = "QUEUE_LOG"}, ] The toml file seems to be happy and deploys, although the cloudflare dashboard does not recognize the QUEUE_LOG as having a producer. In the code, I have: export interface Env { WORKER_QUEUE: Queue; QUEUE_LOG: Queue; } Does anyone have any thoughts on what I might be missing here? If I console.log env.QUEUE_LOG it is null. I am grateful for any thoughts.... DC
4 Replies
kian
kian13mo ago
What's your full Wrangler.toml?
DC
DCOP13mo ago
Hi Kian - thanks for getting back to me. Looks like my guess was wrong. After bashing away at this for most of the afternoon, I tried [[queues.producers]] queue = "xyx-worker-process-queue" binding = "WORKER_QUEUE" [[queues.producers]] queue = "xyz-worker-log-queue" binding = "QUEUE_LOG" ... so adding [[queues.producers]] twice and that burst into life. So, all working now. Not sure why I did not think of this before.... Thanks again...
kian
kian13mo ago
queues.producers = [
{queue = "xyz-process-queue", binding = "WORKER_QUEUE"},
{queue = "xyz-log-queue", binding = "QUEUE_LOG"},
]
queues.producers = [
{queue = "xyz-process-queue", binding = "WORKER_QUEUE"},
{queue = "xyz-log-queue", binding = "QUEUE_LOG"},
]
This isn't wrong, but it is inherited by other tables. If you had a [vars], or anything with [] or [[]] above it, it would be apart of those rather than a top-level key. Otherwise, they are functionally equivalent and represent the same thing.
DC
DCOP13mo ago
Ah OK - I see thanks so much for the clarification. 👍
Want results from more Discord servers?
Add your server