cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [16/20] git commit: updated refs/heads/4.3 to 67df5b9
Date Tue, 25 Nov 2014 19:05:12 GMT
CLOUDSTACK-6365: support virtual host and ssl in rabbitMQ event bus

with this fix, virtual host on the AMQP server can be specified. Also
SSL can be used for connection between management server and AMQP
servers.

(cherry picked from commit bc17f177760b3b61f1df7ed9728738ffe64896d5)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/62ae7685
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/62ae7685
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/62ae7685

Branch: refs/heads/4.3
Commit: 62ae768540c451c098fb2dd90d718add7d822c4c
Parents: 473cd6f
Author: Murali Reddy <muralimmreddy@gmail.com>
Authored: Wed Apr 9 17:32:16 2014 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Tue Nov 25 23:21:23 2014 +0530

----------------------------------------------------------------------
 .../mom/rabbitmq/RabbitMQEventBus.java          | 29 +++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/62ae7685/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java
----------------------------------------------------------------------
diff --git a/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java
b/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java
index 478c8d7..30b4475 100644
--- a/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java
+++ b/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java
@@ -48,6 +48,18 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus {
     private static String username;
     private static String password;
 
+    public static void setVirtualHost(String virtualHost) {
+        RabbitMQEventBus.virtualHost = virtualHost;
+    }
+
+    private static String virtualHost;
+
+    public static void setUseSsl(String useSsl) {
+        RabbitMQEventBus.useSsl = useSsl;
+    }
+
+    private static String useSsl;
+
     // AMQP exchange name where all CloudStack events will be published
     private static String amqpExchangeName;
 
@@ -92,6 +104,12 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus
{
                 throw new ConfigurationException("Unable to get the port details of AMQP
server");
             }
 
+            if (useSsl != null && !useSsl.isEmpty()) {
+                if (!useSsl.equalsIgnoreCase("true") && !useSsl.equalsIgnoreCase("false"))
{
+                    throw new ConfigurationException("Invalid configuration parameter for
'ssl'.");
+                }
+            }
+
             if (retryInterval == null) {
                 retryInterval = 10000;// default to 10s to try out reconnect
             }
@@ -341,9 +359,18 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus
{
             ConnectionFactory factory = new ConnectionFactory();
             factory.setUsername(username);
             factory.setPassword(password);
-            factory.setVirtualHost("/");
             factory.setHost(amqpHost);
             factory.setPort(port);
+
+            if (virtualHost != null && !virtualHost.isEmpty()) {
+                factory.setVirtualHost(virtualHost);
+            } else {
+                factory.setVirtualHost("/");
+            }
+
+            if (useSsl != null && !useSsl.isEmpty() && useSsl.equalsIgnoreCase("true"))
{
+                factory.useSslProtocol();
+            }
             Connection connection = factory.newConnection();
             connection.addShutdownListener(disconnectHandler);
             _connection = connection;


Mime
View raw message