ijokarumawak commented on a change in pull request #3246: NIFI-5929 Support for 
IBM MQ multi-instance queue managers
URL: https://github.com/apache/nifi/pull/3246#discussion_r272422513
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProvider.java
 ##########
 @@ -211,25 +211,28 @@ public void disable() {
      * @see #setProperty(String propertyName, Object propertyValue)
      */
     void setConnectionFactoryProperties(ConfigurationContext context) {
-        String brokerValue = 
context.getProperty(BROKER_URI).evaluateAttributeExpressions().getValue();
-        String connectionFactoryValue = 
context.getProperty(CONNECTION_FACTORY_IMPL).evaluateAttributeExpressions().getValue();
-        if (connectionFactoryValue.startsWith("org.apache.activemq")) {
-            this.setProperty("brokerURL", brokerValue);
-        } else if (connectionFactoryValue.startsWith("com.tibco.tibjms")) {
-            this.setProperty("serverUrl", brokerValue);
-        } else if (connectionFactoryValue.startsWith("com.ibm.mq.jms")) {
-            // Try to parse broker URI as colon separated host/port pair
-            String[] hostPort = brokerValue.split(":");
-            if (hostPort.length == 2) {
-                // If broker URI indeed was colon separated host/port pair
-                this.setProperty("hostName", hostPort[0]);
-                this.setProperty("port", hostPort[1]);
+        if (context.getProperty(BROKER_URI).isSet()) {
+            String brokerValue = 
context.getProperty(BROKER_URI).evaluateAttributeExpressions().getValue();
+            String connectionFactoryValue = 
context.getProperty(CONNECTION_FACTORY_IMPL).evaluateAttributeExpressions().getValue();
+            if (connectionFactoryValue.startsWith("org.apache.activemq")) {
+                this.setProperty("brokerURL", brokerValue);
+            } else if (connectionFactoryValue.startsWith("com.tibco.tibjms")) {
+                this.setProperty("serverUrl", brokerValue);
             } else {
-                // Assuming broker is in hostname(port) format
-                this.setProperty("connectionNameList", brokerValue);
+                // Try to parse broker URI as colon separated host/port pair
+                String[] hostPort = brokerValue.split(":");
+                if (hostPort.length == 2) {
+                    // If broker URI indeed was colon separated host/port pair
+                    this.setProperty("hostName", hostPort[0]);
+                    this.setProperty("port", hostPort[1]);
+                } else if 
(connectionFactoryValue.startsWith("com.ibm.mq.jms")) {
+                    // Assuming broker is in hostname(port) format
+                    this.setProperty("connectionNameList", brokerValue);
 
 Review comment:
   Thanks for bringing back the `else` part. Can we move this  ` else if 
(connectionFactoryValue.startsWith("com.ibm.mq.jms"))` block right after the 
`com.tibco.tibjms` block? So that all bender specific cases are handled before 
this final `else` block. It would make the code more readable.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to