Ferenc Gerlits created MINIFICPP-2029:
-----------------------------------------

             Summary: Refactor the MQTT processors to better encapsulate 
dependence on the MQTT version
                 Key: MINIFICPP-2029
                 URL: https://issues.apache.org/jira/browse/MINIFICPP-2029
             Project: Apache NiFi MiNiFi C++
          Issue Type: Improvement
            Reporter: Ferenc Gerlits


(from 
https://github.com/apache/nifi-minifi-cpp/pull/1432#discussion_r1031680118)

[In the MQTT processors,] we rely too much on the mqtt_version_ and a lot of 
the function implementations are if-else branches depending on this version.

A cleaner solution would be to collect these differing functionalities, create 
a separate abstract class for these functions with two separate inherited class 
implementations for the two versions. After we have the version in 
{{onSchedule}} we can instantiate the proper one and call the proper 
implementation in each case where it differs (strategy pattern).

If needed the common parts can also be moved to the base class and only the 
differences implemented in the inherited classes (template method pattern).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to