I have to create a new connection?
or I can create a connection and pass the channel to multiple threads/async functions to consume?
you create a connection for 1 instance of your app and create a channel for each thread (not async as creating channels is chatty)
what about something like JS which is single threaded? that means I'm stuck with one channel for the whole lifetime?
also, what about connecting to the same channel? can I have multiple consumers on the queue X of channel Y? by connecting to the same channel and queue in multiple threads?
never used it with js, so sorry i cant comment on it
you can have multiple consumers on the same channel, but sharing channels across threads isn't recommended due to some race conditions and stuff
also regarding this, you can have multiple channels in an array as a pool and select one from the pool to consume. this would improve performance in theory same as postgres pools does
Обсуждают сегодня