Skip to content

[question] How to maintain a global connection? #423

@sxh-lsc

Description

@sxh-lsc

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions