Get a worker from a router

I would like to know if there is a way to get the worker where a router is running on.

For more context, for scalability, i pipe a new router for every worker, for every instance, so whatever the instance where the consumer is redirected, he will get access to the producer’s stream.
I do this for each router if the current router have less than 200 customers listening on this router, otherwise it go to the next one and etc…

You can store whatever you want in the router.appData, including its worker.

1 Like

Yes i was thinking about that, finally i stored it in a map.
But maybe i should use appData everytime instead of storing it in Maps.

How you design your app is up to you. No magic response here.

Storing in .appData approach is better in term of performance for read and write time.
And easier to store information about the router.
But both approach work well.