PipeToRouter implementation question

Hi!

I had a sort of specific question about the implementation of pipeToRouter - I hope this is the right place to ask. Basically, I was wondering why both routers don’t store a reference to the pipe transport? If my understanding is correct, the pipe transport is bi-directional, right? So, if I pipe a producer from router A to router B and then later want to pipe a different producer from router B to router A, if router B was storing a reference to the pipe transport could I re-use it?

I’m basically curious if this is just a design decision or some type of limitation that I’m not understanding.

Thank you for any help

You just do router.pipeToRouter(....) and if a previous pipe was done then it will be reused.

Sorry - I specifically mean when piping from router A to router B and then router B to router A. In the second case, won’t you not have a transport in router B’s pipe transport map?

No, in that case the previous pipe is not reused. Note however that pipeToRouter() is just a helper. You can do your own implementation.

2 Likes

Sounds good. I just wasn’t sure if there was a technical limitation in doing that or if it was a design decision (in terms of pipeToRouter current implementation). Sounds like not a technical limitation so depending on my architecture if it makes sense I can write a version of pipeToRouter that re-uses the pipes.

Thanks so much for the help!