MQTTSuite
Loading...
Searching...
No Matches
mqtt::mqttstore::SocketContextFactory Class Reference

#include <SocketContextFactory.h>

Inheritance diagram for mqtt::mqttstore::SocketContextFactory:
Collaboration diagram for mqtt::mqttstore::SocketContextFactory:

Private Member Functions

core::socket::stream::SocketContext * create (core::socket::stream::SocketConnection *socketConnection) final

Detailed Description

Definition at line 19 of file SocketContextFactory.h.

Member Function Documentation

◆ create()

core::socket::stream::SocketContext * mqtt::mqttstore::SocketContextFactory::create ( core::socket::stream::SocketConnection * socketConnection)
finalprivate

Definition at line 53 of file SocketContextFactory.cpp.

53 {
54 const net::config::ConfigInstance* configInstance = socketConnection->getConfigInstance();
55
56 const lib::ConfigSession* configSession = configInstance->getSubCommand<lib::ConfigSession>();
57 const lib::ConfigSubscribe* configSubscribe = configInstance->getSubCommand<lib::ConfigSubscribe>();
58 const lib::ConfigDatabase* configDatabase = configInstance->getSubCommand<lib::ConfigDatabase>();
59 const lib::ConfigStorage* configStorage = configDatabase->getSubCommand<lib::ConfigStorage>();
60 const StorageOptions storageOptions = getStorageOptions(configStorage);
61 lib::StoragePlan storagePlan;
62 try {
63 storagePlan = lib::StoragePlan::fromFile(storageOptions.projectionFile);
64 } catch (const std::exception& exception) {
65 VLOG(0) << socketConnection->getConnectionName() << " MQTTStore startup failed: " << exception.what();
66 throw;
67 }
68
69 return new iot::mqtt::SocketContext(socketConnection,
70 new mqtt::mqttstore::lib::Mqtt(socketConnection->getConnectionName(),
71 configSession->getClientId(),
72 configSession->getQoS(),
73 configSession->getKeepAlive(),
74 !configSession->getRetainSession(),
75 configSession->getWillTopic(),
76 configSession->getWillMessage(),
77 configSession->getWillQoS(),
78 configSession->getWillRetain(),
79 configSession->getUsername(),
80 configSession->getPassword(),
81 configSubscribe->getTopic(),
82 {.database = configDatabase->getDatabase(),
83 .username = configDatabase->getUsername(),
84 .password = configDatabase->getPassword(),
85 .host = configDatabase->getHost(),
86 .port = configDatabase->getPort(),
87 .socket = configDatabase->getSocket(),
88 .flags = configDatabase->getFlags()},
89 storageOptions.rawTable,
90 storageOptions.autoCreateRawTable,
91 std::move(storagePlan),
92 configSession->getSessionStore()));
93 }
static StoragePlan fromFile(const std::string &fileName)
StorageOptions getStorageOptions(const mqtt::mqttstore::lib::ConfigStorage *configStorage)

References mqtt::mqttstore::lib::StoragePlan::fromFile(), anonymous_namespace{SocketContextFactory.cpp}::getStorageOptions(), and anonymous_namespace{SocketContextFactory.cpp}::StorageOptions::projectionFile.

Here is the call graph for this function:

The documentation for this class was generated from the following files: