Consumer/producer management with PipeToRouter

When I pipe a producer from my source router to my destination router, it seems to do the following:

  • create transports between the two routers if the don’t exist
  • create a consumer on the source router and a producer on the destination router.

Assuming this is correct, does this mean if I run the pipeToRouter function multiple times with the arguments, I will end up with duplicate consumers and producers?

Also, if nothing is consuming the producer that is pipped, is it still affecting my overall capacity limits on the worker/router?

Have you tried? The Producer that pipeToRouter() creates in the target Router shares the same producer.id than the original Producer, so if you call it twice it will throw.

Also, if nothing is consuming the producer that is pipped, is it still affecting my overall capacity limits on the worker/router?

If you close the Producer in the target Router, the pipe Consumer in the origin Router will be closed, so there won’t be RTP transmission between those Routers related to the original Producer.