I’m using the ZIO-HTTP framework, and I found that the ZIO-AMQP Connection must be in scope to be effective. Suppose I want a unique global connection after the program starts, and then use this connection to create and destroy some channels in some scope. What should I do?
Currently, I’m using ZLayer.scoped to get a ZLayer[Any, Throwable, Connection], but this will create a new connection every time I provide this layer.
I may still be a bit confused about the use of scope and layer, so is there any suggestion for the scenario I presented?