nats-io / nats.swift

Swift client for NATS, the cloud native messaging system.
Apache License 2.0
22 stars 4 forks source link

Implement Swift Service Lifecycle #82

Open thoven87 opened 1 month ago

thoven87 commented 1 month ago

Proposed change

I think it would be great to implement Swift Service Life Cycle

Use case

Managing the lifecycle of the NATS client with a service such as Hummingbird would be as simple as follows:

let natsClientService = NatsClientOptions().url(URL(string: "nats://localhost:4222")!).build()

let app = Application(....)

app.addService(natsClientService)

Users would not have to worry about managing shutdown and such.

Contribution

No response