IOT-3158 reverify 65/26765/2
authorOndrej Tomcik <ondrej.tomcik@kistler.com>
Tue, 13 Feb 2018 08:34:09 +0000 (09:34 +0100)
committerPeter Rafaj <peter.rafaj@kistler.com>
Mon, 13 Aug 2018 14:58:55 +0000 (16:58 +0200)
Change-Id: I030da7132be1d2a13d999b21b4cb0a51108f23e2
Signed-off-by: Peter Rafaj <peter.rafaj@kistler.com>
cloud/interface/Dockerfile
cloud/interface/src/main/java/org/iotivity/cloud/ciserver/CloudInterfaceServer.java

index 5f06b91..1a1984c 100644 (file)
@@ -14,7 +14,5 @@ ENV RESOURCE_DIRECTORY_ADDRESS iotivity-resourcedirectory
 ENV RESOURCE_DIRECTORY_PORT 5684
 ENV ACCOUNT_SERVER_ADDRESS iotivity-accountserver
 ENV ACCOUNT_SERVER_PORT 5685
-ENV MESSAGE_QUEUE_ADDRESS iotivity-messagequeue
-ENV MESSAGE_QUEUE_PORT 5686
 
 ENTRYPOINT ["java", "-jar", "CloudInterface.jar"]
\ No newline at end of file
index 0297ca4..fa09fa8 100644 (file)
@@ -60,6 +60,7 @@ public class CloudInterfaceServer {
     private static int          resourceDirectoryPort;
     private static String       accountServerAddress;
     private static int          accountServerPort;
+    private static boolean      messageQueueEnabled;
     private static String       messageQueueAddress;
     private static int          messageQueuePort;
 
@@ -84,9 +85,12 @@ public class CloudInterfaceServer {
         ConnectorPool.requestConnection("account",
                 new InetSocketAddress(accountServerAddress, accountServerPort),
                 tlsMode, keepAlive);
-        ConnectorPool.requestConnection("mq",
-                new InetSocketAddress(messageQueueAddress, messageQueuePort),
-                tlsMode, keepAlive);
+
+        if(messageQueueEnabled) {
+            ConnectorPool.requestConnection("mq",
+                    new InetSocketAddress(messageQueueAddress, messageQueuePort),
+                    tlsMode, keepAlive);
+        }
 
         DeviceServerSystem deviceServer = new DeviceServerSystem();
 
@@ -193,8 +197,6 @@ public class CloudInterfaceServer {
             resourceDirectoryPort = Integer.parseInt(System.getenv("RESOURCE_DIRECTORY_PORT"));
             accountServerAddress = System.getenv("ACCOUNT_SERVER_ADDRESS");
             accountServerPort = Integer.parseInt(System.getenv("ACCOUNT_SERVER_PORT"));
-            messageQueueAddress = System.getenv("MESSAGE_QUEUE_ADDRESS");
-            messageQueuePort = Integer.parseInt(System.getenv("MESSAGE_QUEUE_PORT"));
             hcProxyMode = Integer.parseInt(System.getenv("HC_PROXY_MODE")) == 1;
             hcProxyPort = Constants.DEFAULT_HC_PROXY_PORT;
             websocketMode = Integer.parseInt(System.getenv("WEBSOCKET_MODE")) == 1;
@@ -204,6 +206,14 @@ public class CloudInterfaceServer {
             String keepAliveEnv = System.getenv("DEVICE_KEEPALIVE_MINUTES");
             if (keepAliveEnv != null && !keepAliveEnv.isEmpty())
                 deviceKeepAliveMinutes = new int[] { Integer.parseInt(keepAliveEnv) };
+
+            String messageQueueEnv = System.getenv("MESSAGE_QUEUE_ADDRESS");
+            if(messageQueueEnv != null)
+            {
+                messageQueueAddress = System.getenv("MESSAGE_QUEUE_ADDRESS");
+                messageQueuePort = Integer.parseInt(System.getenv("MESSAGE_QUEUE_PORT"));
+                messageQueueEnabled = true;
+            }
             return true;
         }
         return false;