feat: Removes sensor client in favor of more generic topic listener and publisher

This commit is contained in:
2024-11-12 16:42:14 -05:00
parent b6db9b5322
commit 8067331ff8
7 changed files with 141 additions and 224 deletions

View File

@@ -6,15 +6,16 @@ import MQTTConnectionManagerLive
import MQTTNIO
import NIO
import PsychrometricClientLive
import SensorsClientLive
import SensorsService
import ServiceLifecycle
import TopicDependencies
@main
struct Application {
/// The main entry point of the application.
static func main() async throws {
let eventloopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
let eventloopGroup = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount)
var logger = Logger(label: "dewpoint-controller")
logger.logLevel = .trace
@@ -35,7 +36,9 @@ struct Application {
try await withDependencies {
$0.psychrometricClient = .liveValue
$0.sensorsClient = .live(client: mqtt)
// $0.sensorsClient = .live(client: mqtt)
$0.topicListener = .live(client: mqtt)
$0.topicPublisher = .live(client: mqtt)
$0.mqttConnectionManager = .live(client: mqtt, logger: logger)
} operation: {
let mqttConnection = MQTTConnectionService(cleanSession: false, logger: logger)