cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [1/3] git commit: updated refs/heads/master to 54d44eb
Date Wed, 11 Mar 2015 16:11:37 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 05d2b0a70 -> 54d44eb84


make topic configurable, provide default serializers

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/dd77fdf6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/dd77fdf6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/dd77fdf6

Branch: refs/heads/master
Commit: dd77fdf6c60ee769c334b58522fb94105ec9ef9b
Parents: 04b30e0
Author: Pierre-Yves Ritschard <pyr@spootnik.org>
Authored: Wed Mar 11 08:55:05 2015 +0100
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Wed Mar 11 21:40:49 2015 +0530

----------------------------------------------------------------------
 .../cloudstack/mom/kafka/KafkaEventBus.java     | 21 +++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd77fdf6/plugins/event-bus/kafka/src/org/apache/cloudstack/mom/kafka/KafkaEventBus.java
----------------------------------------------------------------------
diff --git a/plugins/event-bus/kafka/src/org/apache/cloudstack/mom/kafka/KafkaEventBus.java
b/plugins/event-bus/kafka/src/org/apache/cloudstack/mom/kafka/KafkaEventBus.java
index d959a5e..20a0e4c 100644
--- a/plugins/event-bus/kafka/src/org/apache/cloudstack/mom/kafka/KafkaEventBus.java
+++ b/plugins/event-bus/kafka/src/org/apache/cloudstack/mom/kafka/KafkaEventBus.java
@@ -47,7 +47,10 @@ import com.cloud.utils.PropertiesUtil;
 @Local(value = EventBus.class)
 public class KafkaEventBus extends ManagerBase implements EventBus {
 
-    private final String _topic = "cloudstack";
+    public static final String DEFAULT_TOPIC = "cloudstack";
+    public static final String DEFAULT_SERIALIZER = "org.apache.kafka.common.serialization.StringSerializer";
+
+    private String _topic = null;
     private Producer<String,String> _producer;
     private static final Logger s_logger = Logger.getLogger(KafkaEventBus.class);
 
@@ -58,7 +61,23 @@ public class KafkaEventBus extends ManagerBase implements EventBus {
 
         try {
             final FileInputStream is = new FileInputStream(PropertiesUtil.findConfigFile("kafka.producer.properties"));
+
             props.load(is);
+
+            _topic = (String)props.remove("topic");
+            if (_topic == null) {
+                _topic = DEFAULT_TOPIC;
+            }
+
+            if (!props.containsKey("key.serializer")) {
+                props.put("key.serializer", DEFAULT_SERIALIZER);
+            }
+
+            if (!props.containsKey("value.serializer")) {
+                props.put("value.serializer", DEFAULT_SERIALIZER);
+            }
+
+
             is.close();
         } catch (Exception e) {
             throw new ConfigurationException("Could not read kafka properties");


Mime
View raw message