Creating Workitem and Selecting WorkItem Queue Dynamically

Is there a way to create a workitem and select workitem queue dynamically in nodered? I am planning to use the value from the payload, something like this msg.payload.workitemqueue

there is no way to create a workitem queue from nodered ( well, there is, but you should never do that )

I strongly feel, there is no good argument for having the option to dynamically select the queue, in “pop workitem”. The whole point of queues is to separate code/logic for each queue, so popping different queues from the same code, is massively conflicting with the intention of the system.
IF you need different routes the most common way is to read a value from the payload and use a switch node to fork out depending on that.

Anyway, if this is what you truly need, you can install the openiap npm package on a function node, then signin using the inherited environment variables and then call popworkitem. This will be slow and put a massive overhead on openflow.
So a much better solution is to create a package in nodejs/python and run it inside an agent ( example here ) this will allow you to keep an existing connection and pop multiple queues as dynamic as you need/want.

1 Like

Switch node solved it. Thank you Allan. and thank you for being so responsive as always

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.