# A Reliable Publish-Subscribe Mechanism for Internet of Things-Enabled Smart Greenhouses
## 3 Research Methodology
### Architecture and Protocol Description  
In this section, we propose an architecture and protocol for the remote monitoring of greenhouse environmental parameters and control systems to optimize plant growth and resource utilization. Our advanced architectural framework enables the remote monitoring of greenhouse environmental variables and precise management of critical systems. This framework, as illustrated in Figure 2, is composed of four distinct levels, which together function as an interconnected system. The first layer consists of strategically positioned sensors inside the greenhouse that are intended to collect essential environmental variables, such as temperature, humidity, the condition of the actuator, and the operational state of all accessible equipment. Following this, the gathered data and subsequent greenhouse events are transmitted to the SGP MQTT protocol through the environmental parameter collection device situated inside the greenhouse environment. As depicted in layer 2 of Figure 2, our proposed solution introduces an innovative approach by emphasizing the standardizing the transmission of messages from the greenhouse to the primary server. This aspect has been disregarded or inadequately addressed in several other articles, leading to the need for more processing [36]. Therefore, this increasesthe complexity of the intelligent system, as explained in Section 2. The subscriber is enrolled to get updates on specific topics, which will be defined, while the publisher distributes content on the indicated themes. Both entities facilitate the transmission of data gathered from diverse sensors to access the Sub-Pub systems of the MQTT broker. Subsequently, the data are transmitted hierarchically to the primary server, as seen in layer 3 of Figure 2.  
Fundamentally, all data or events inside the greenhouse are categorized and delivered to the corresponding topic on the central server using the proposed protocol. By employing this systematic approach, the farmer can consistently and immediately monitor the conditions of the greenhouse in real time. Technology enhances the cultivator's capabilities by equipping them with crucial knowledge, thus enabling them to make well-informed and prompt decisions. Consequently, this technique optimizes plant development and enhances resource utilization inside the greenhouse. To ensure the effectiveness of this architecture, the structured MQTT broker plays a crucial role in managing the data flow and communication between different layers. Improvements and Advantages over Traditional MQTT  
The proposed MQTT broker employs a hierarchical categorization mechanism for messages, which enhances the routing and processing of messages on the broker's end. This system entails the specification of topics and payloads, in which the subscriber receives updates on specific topics, and the publisher disseminates information that way. Our approach implements a uniform communication protocol that decreases the intricacy and processing duration on the server end. The categorization system optimizes the routing of messages to their intended recipients, reducing the quantity of extraneous data and improving the accuracy of the primary server's processing. The implementation of our standardized protocol and structured MQTT broker yields several significant advantages over the traditional MQTT protocol:  
* Standardized Protocol for Resource Optimization: The protocol optimizes resource utilization by eliminating redundant processing stages. * High Responsiveness: The system ensures high responsiveness, especially essential for real-time monitoring, by reducing the processing burden on the server. * Scalability: The protocol facilitates scalability by effectively managing an array of publishers, subscribers, and messages. Figure 2: The proposed standardization structure of the smart greenhouse protocol for the MQTT broker using topic categorization and the publish–subscribe mechanism.