public ITopologyBuilder GetTopologyBuilder()
        {
            TopologyBuilder topologyBuilder = new TopologyBuilder(typeof(TestEventCountHybridTopology).Name + DateTime.Now.ToString("yyyyMMddHHmmss"));

            var eventHubPartitions = int.Parse(ConfigurationManager.AppSettings["EventHubPartitions"]);

            topologyBuilder.SetEventHubSpout(
                "com.microsoft.eventhubs.spout.EventHubSpout", 
                new EventHubSpoutConfig(
                    ConfigurationManager.AppSettings["EventHubSharedAccessKeyName"],
                    ConfigurationManager.AppSettings["EventHubSharedAccessKey"],
                    ConfigurationManager.AppSettings["EventHubNamespace"], 
                    ConfigurationManager.AppSettings["EventHubEntityPath"],
                    eventHubPartitions),
                eventHubPartitions);

            // Set a customized JSON Serializer to serialize a Java object (emitted by Java Spout) into JSON string
            // Here, full name of the Java JSON Serializer class is required
            List<string> javaSerializerInfo = new List<string>() { "microsoft.scp.storm.multilang.CustomizedInteropJSONSerializer" };

            var boltConfig = new StormConfig();
            boltConfig.Set("topology.tick.tuple.freq.secs", "1");

            topologyBuilder.SetBolt(
                typeof(PartialCountBolt).Name,
                PartialCountBolt.Get,
                new Dictionary<string, List<string>>()
                {
                    {Constants.DEFAULT_STREAM_ID, new List<string>(){ "partialCount" } }
                },
                eventHubPartitions,
                true
                ).
                DeclareCustomizedJavaSerializer(javaSerializerInfo).
                shuffleGrouping("com.microsoft.eventhubs.spout.EventHubSpout").
                addConfigurations(boltConfig);

            topologyBuilder.SetBolt(
                typeof(GlobalCountBolt).Name,
                GlobalCountBolt.Get,
                new Dictionary<string, List<string>>()
                {
                    {Constants.DEFAULT_STREAM_ID, new List<string>(){ "timestamp", "totalCount" } }
                },
                1, 
                true).
                globalGrouping(typeof(PartialCountBolt).Name).
                addConfigurations(boltConfig);

            var topologyConfig = new StormConfig();
            topologyConfig.setMaxSpoutPending(8192);
            topologyConfig.setNumWorkers(eventHubPartitions);

            topologyBuilder.SetTopologyConfig(topologyConfig);
            return topologyBuilder;
        }
        public ITopologyBuilder GetTopologyBuilder()
        {
            TopologyBuilder topologyBuilder = new TopologyBuilder(typeof(SimpleHybridTopology).Name + DateTime.Now.ToString("yyyyMMddHHmmss"));

            var eventHubPartitions = int.Parse(ConfigurationManager.AppSettings["EventHubPartitions"]);

            topologyBuilder.SetEventHubSpout(
                "com.microsoft.eventhubs.spout.EventHubSpout",
                new EventHubSpoutConfig(
                    ConfigurationManager.AppSettings["EventHubSharedAccessKeyName"],
                    ConfigurationManager.AppSettings["EventHubSharedAccessKey"],
                    ConfigurationManager.AppSettings["EventHubNamespace"],
                    ConfigurationManager.AppSettings["EventHubEntityPath"],
                    eventHubPartitions),
                eventHubPartitions);

            var javaSerializerInfo = new List <string>()
            {
                "microsoft.scp.storm.multilang.CustomizedInteropJSONSerializer"
            };

            var boltConfig = new StormConfig();

            topologyBuilder.SetBolt(
                typeof(ThresholdBolt).Name,
                ThresholdBolt.Get,
                new Dictionary <string, List <string> >()
            {
            },
                eventHubPartitions,
                true
                ).
            DeclareCustomizedJavaSerializer(javaSerializerInfo).
            shuffleGrouping("com.microsoft.eventhubs.spout.EventHubSpout").
            addConfigurations(boltConfig);

            var topologyConfig = new StormConfig();

            topologyConfig.setMaxSpoutPending(8192);
            topologyConfig.setNumWorkers(eventHubPartitions);

            topologyBuilder.SetTopologyConfig(topologyConfig);

            return(topologyBuilder);
        }
        public ITopologyBuilder GetTopologyBuilder()
        {
            // Start building a new topology
            TopologyBuilder topologyBuilder = new TopologyBuilder(typeof(EventHubReader).Name + DateTime.Now.ToString("yyyyMMddHHmmss"));
            // Get the number of partitions in EventHub
            var eventHubPartitions = int.Parse(ConfigurationManager.AppSettings["EventHubPartitions"]);
            // Add the EvetnHubSpout to the topology. Set parallelism hint to the number of partitions
            topologyBuilder.SetEventHubSpout(
                "com.microsoft.eventhubs.spout.EventHubSpout",
                new EventHubSpoutConfig(
                    ConfigurationManager.AppSettings["EventHubSharedAccessKeyName"],
                    ConfigurationManager.AppSettings["EventHubSharedAccessKey"],
                    ConfigurationManager.AppSettings["EventHubNamespace"],
                    ConfigurationManager.AppSettings["EventHubEntityPath"],
                    eventHubPartitions),
                eventHubPartitions);

            // Set a customized JSON Serializer to serialize a Java object (emitted by Java Spout) into JSON string
            // Here, full name of the Java JSON Serializer class is required
            List<string> javaSerializerInfo = new List<string>() { "microsoft.scp.storm.multilang.CustomizedInteropJSONSerializer" };

            // Create a config for the bolt. It's unused here
            var boltConfig = new StormConfig();

            // Add the logbolt to the topology
            topologyBuilder.SetBolt(
                typeof(LogBolt).Name,
                LogBolt.Get,
                new Dictionary<string, List<string>>(),
                eventHubPartitions,
                true
                ).
                DeclareCustomizedJavaSerializer(javaSerializerInfo).
                shuffleGrouping("com.microsoft.eventhubs.spout.EventHubSpout");
            // Create a configuration for the topology
            var topologyConfig = new StormConfig();
            // Increase max pending for the spout
            topologyConfig.setMaxSpoutPending(8192);
            // Parallelism hint for the number of workers to match the number of EventHub partitions
            topologyConfig.setNumWorkers(eventHubPartitions);
            // Add the config and return the topology builder
            topologyBuilder.SetTopologyConfig(topologyConfig);
            return topologyBuilder;
        }
        /// <summary>
        /// Get a Storm topology builder
        /// </summary>
        /// <returns>A topology builder</returns>
        public ITopologyBuilder GetTopologyBuilder()
        {
            TopologyBuilder topologyBuilder = new TopologyBuilder("EventHubReader" + DateTime.Now.ToString("yyyyMMddHHmmss"));

            // Get the number of partitions in EventHub
            var eventHubPartitions = int.Parse(ConfigurationManager.AppSettings["EventHubPartitions"]);

            // Add the EvetnHubSpout to the topology using the SetEventHubSpout and EventHubSpoutConfig helper methods.
            // NOTE: These methods set the spout to read data in a String encoding.
            topologyBuilder.SetEventHubSpout(
                "EventHubSpout",
                new EventHubSpoutConfig(
                    ConfigurationManager.AppSettings["EventHubSharedAccessKeyName"],
                    ConfigurationManager.AppSettings["EventHubSharedAccessKey"],
                    ConfigurationManager.AppSettings["EventHubNamespace"],
                    ConfigurationManager.AppSettings["EventHubEntityPath"],
                    eventHubPartitions),
                eventHubPartitions);

            // Set a customized JSON Serializer to serialize a Java object (emitted by Java Spout) into JSON string
            // Here, full name of the Java JSON Serializer class is required
            List <string> javaSerializerInfo = new List <string>()
            {
                "microsoft.scp.storm.multilang.CustomizedInteropJSONSerializer"
            };

            // Add the logbolt to the topology
            // Use a serializer to understand data from the Java component
            topologyBuilder.SetBolt(
                typeof(LogBolt).Name,
                LogBolt.Get,
                new Dictionary <string, List <string> >(),
                eventHubPartitions,
                true
                ).
            DeclareCustomizedJavaSerializer(javaSerializerInfo).
            shuffleGrouping("EventHubSpout");

            return(topologyBuilder);
        }
Exemplo n.º 5
0
        public ITopologyBuilder GetTopologyBuilder()
        {
            TopologyBuilder topologyBuilder = new TopologyBuilder("AlertTopology");

            var eventHubPartitions = int.Parse(ConfigurationManager.AppSettings["EventHubPartitions"]);

            topologyBuilder.SetEventHubSpout(
                "EventHubSpout",
                new EventHubSpoutConfig(
                    ConfigurationManager.AppSettings["EventHubSharedAccessKeyName"],
                    ConfigurationManager.AppSettings["EventHubSharedAccessKey"],
                    ConfigurationManager.AppSettings["EventHubNamespace"],
                    ConfigurationManager.AppSettings["EventHubEntityPath"],
                    eventHubPartitions),
                eventHubPartitions);

            // Set a customized JSON Serializer to serialize a Java object (emitted by Java Spout) into JSON string
            // Here, full name of the Java JSON Serializer class is required
            List <string> javaSerializerInfo = new List <string>()
            {
                "microsoft.scp.storm.multilang.CustomizedInteropJSONSerializer"
            };

            var boltConfig = new StormConfig();

            topologyBuilder.SetBolt(
                typeof(ParserBolt).Name,
                ParserBolt.Get,
                new Dictionary <string, List <string> >()
            {
                { Constants.DEFAULT_STREAM_ID, new List <string>()
                  {
                      "temp", "createDate", "deviceId"
                  } }
            },
                eventHubPartitions,
                enableAck: true
                ).
            DeclareCustomizedJavaSerializer(javaSerializerInfo).
            shuffleGrouping("EventHubSpout").
            addConfigurations(boltConfig);

            topologyBuilder.SetBolt(
                typeof(EmitAlertBolt).Name,
                EmitAlertBolt.Get,
                new Dictionary <string, List <string> >()
            {
                { Constants.DEFAULT_STREAM_ID, new List <string>()
                  {
                      "reason", "temp", "createDate", "deviceId"
                  } }
            },
                eventHubPartitions,
                enableAck: true
                ).
            shuffleGrouping(typeof(ParserBolt).Name).
            addConfigurations(boltConfig);

            var topologyConfig = new StormConfig();

            topologyConfig.setMaxSpoutPending(8192);
            topologyConfig.setNumWorkers(eventHubPartitions);

            topologyBuilder.SetTopologyConfig(topologyConfig);
            return(topologyBuilder);
        }
        public ITopologyBuilder GetTopologyBuilder()
        {
            appConfig = new AppConfig();

            TopologyBuilder topologyBuilder = new TopologyBuilder(this.GetType().Name);
            topologyBuilder.SetEventHubSpout(
                "EventHubSpout",
                new EventHubSpoutConfig(
                appConfig.EventHubSharedAccessKeyName,
                appConfig.EventHubSharedAccessKey,
                appConfig.EventHubNamespace,
                appConfig.EventHubEntityPath,
                appConfig.EventHubPartitions),
                appConfig.EventHubPartitions);

            // Set a customized JSON Serializer to serialize a Java object (emitted by Java Spout) into JSON string
            // Here, fullname of the Java JSON Serializer class is required
            List<string> javaSerializerInfo = new List<string>() { "microsoft.scp.storm.multilang.CustomizedInteropJSONSerializer" };

            topologyBuilder.SetBolt(
                    typeof(EventAggregator).Name,
                    EventAggregator.Get,
                    new Dictionary<string, List<string>>()
                    {
                        {Constants.DEFAULT_STREAM_ID, new List<string>(){ "AggregationTimestamp", "PrimaryKey", "SecondaryKey", "AggregatedValue" } }
                    },
                    appConfig.EventHubPartitions,
                    true
                ).
                DeclareCustomizedJavaSerializer(javaSerializerInfo).
                shuffleGrouping("EventHubSpout");

            //You can also setup a Ranker bolt to maintain top N records
            /*
            topologyBuilder.SetBolt(
                    typeof(EventRanker).Name,
                    EventRanker.Get,
                    new Dictionary<string, List<string>>()
                    {
                        {Constants.DEFAULT_STREAM_ID, new List<string>(){ "AggregationTimestamp", "PrimaryKey", "SecondaryKey", "AggregatedValue" } }
                    },
                    appConfig.EventHubPartitions / 2
                ).
                fieldsGrouping(typeof(EventAggregator).Name, new List<int>() { 0, 1, 2 });
            */

            topologyBuilder.SetBolt(
                typeof(EventHBaseWriter).Name,
                EventHBaseWriter.Get,
                new Dictionary<string, List<string>>(),
                appConfig.EventHubPartitions / 4).
                fieldsGrouping(typeof(EventAggregator).Name, new List<int>() { 0, 1, 2 });

            //Assuming a 4 'Large' node cluster we will use half of the worker slots for this topology
            //The default JVM heap size for workers is 768m, we also increase that to 1024m
            //That helps the java spout have additional heap size at disposal.
            var topologyConfig = new StormConfig();
            topologyConfig.setNumWorkers(8);
            topologyConfig.setMaxSpoutPending(1000);
            topologyConfig.setWorkerChildOps("-Xmx1024m");

            topologyBuilder.SetTopologyConfig(topologyConfig);

            return topologyBuilder;
        }
        public ITopologyBuilder GetTopologyBuilder()
        {
            appConfig = new AppConfig();

            TopologyBuilder topologyBuilder = new TopologyBuilder(this.GetType().Name);

            topologyBuilder.SetEventHubSpout(
                "EventHubSpout",
                new EventHubSpoutConfig(
                    appConfig.EventHubSharedAccessKeyName,
                    appConfig.EventHubSharedAccessKey,
                    appConfig.EventHubNamespace,
                    appConfig.EventHubEntityPath,
                    appConfig.EventHubPartitions),
                appConfig.EventHubPartitions);

            // Set a customized JSON Serializer to serialize a Java object (emitted by Java Spout) into JSON string
            // Here, fullname of the Java JSON Serializer class is required
            List <string> javaSerializerInfo = new List <string>()
            {
                "microsoft.scp.storm.multilang.CustomizedInteropJSONSerializer"
            };

            topologyBuilder.SetBolt(
                typeof(EventAggregator).Name,
                EventAggregator.Get,
                new Dictionary <string, List <string> >()
            {
                { Constants.DEFAULT_STREAM_ID, new List <string>()
                  {
                      "AggregationTimestamp", "PrimaryKey", "SecondaryKey", "AggregatedValue"
                  } }
            },
                appConfig.EventHubPartitions,
                true
                ).
            DeclareCustomizedJavaSerializer(javaSerializerInfo).
            shuffleGrouping("EventHubSpout");

            //You can also setup a Ranker bolt to maintain top N records

            /*
             * topologyBuilder.SetBolt(
             *      typeof(EventRanker).Name,
             *      EventRanker.Get,
             *      new Dictionary<string, List<string>>()
             *      {
             *          {Constants.DEFAULT_STREAM_ID, new List<string>(){ "AggregationTimestamp", "PrimaryKey", "SecondaryKey", "AggregatedValue" } }
             *      },
             *      appConfig.EventHubPartitions / 2
             *  ).
             *  fieldsGrouping(typeof(EventAggregator).Name, new List<int>() { 0, 1, 2 });
             */

            topologyBuilder.SetBolt(
                typeof(EventHBaseWriter).Name,
                EventHBaseWriter.Get,
                new Dictionary <string, List <string> >(),
                appConfig.EventHubPartitions / 4).
            fieldsGrouping(typeof(EventAggregator).Name, new List <int>()
            {
                0, 1, 2
            });

            //Assuming a 4 'Large' node cluster we will use half of the worker slots for this topology
            //The default JVM heap size for workers is 768m, we also increase that to 1024m
            //That helps the java spout have additional heap size at disposal.
            var topologyConfig = new StormConfig();

            topologyConfig.setNumWorkers(8);
            topologyConfig.setMaxSpoutPending(1000);
            topologyConfig.setWorkerChildOps("-Xmx1024m");

            topologyBuilder.SetTopologyConfig(topologyConfig);

            return(topologyBuilder);
        }
        public ITopologyBuilder GetTopologyBuilder()
        {
            TopologyBuilder topologyBuilder = new TopologyBuilder(typeof(EventCountHybridTopology).Name + DateTime.Now.ToString("yyyyMMddHHmmss"));

            var eventHubPartitions = int.Parse(ConfigurationManager.AppSettings["EventHubPartitions"]);

            topologyBuilder.SetEventHubSpout(
                "com.microsoft.eventhubs.spout.EventHubSpout",
                new EventHubSpoutConfig(
                    ConfigurationManager.AppSettings["EventHubSharedAccessKeyName"],
                    ConfigurationManager.AppSettings["EventHubSharedAccessKey"],
                    ConfigurationManager.AppSettings["EventHubNamespace"],
                    ConfigurationManager.AppSettings["EventHubEntityPath"],
                    eventHubPartitions),
                eventHubPartitions);

            // Set a customized JSON Serializer to serialize a Java object (emitted by Java Spout) into JSON string
            // Here, full name of the Java JSON Serializer class is required
            List <string> javaSerializerInfo = new List <string>()
            {
                "microsoft.scp.storm.multilang.CustomizedInteropJSONSerializer"
            };

            var boltConfig = new StormConfig();

            boltConfig.Set("topology.tick.tuple.freq.secs", "1");

            topologyBuilder.SetBolt(
                typeof(PartialCountBolt).Name,
                PartialCountBolt.Get,
                new Dictionary <string, List <string> >()
            {
                { Constants.DEFAULT_STREAM_ID, new List <string>()
                  {
                      "partialCount"
                  } }
            },
                eventHubPartitions,
                true
                ).
            DeclareCustomizedJavaSerializer(javaSerializerInfo).
            shuffleGrouping("com.microsoft.eventhubs.spout.EventHubSpout").
            addConfigurations(boltConfig);

            topologyBuilder.SetBolt(
                typeof(GlobalCountBolt).Name,
                GlobalCountBolt.Get,
                new Dictionary <string, List <string> >()
            {
                { Constants.DEFAULT_STREAM_ID, new List <string>()
                  {
                      "timestamp", "totalCount"
                  } }
            },
                1,
                true).
            globalGrouping(typeof(PartialCountBolt).Name).
            addConfigurations(boltConfig);

            var topologyConfig = new StormConfig();

            topologyConfig.setMaxSpoutPending(8192);
            topologyConfig.setNumWorkers(eventHubPartitions);

            topologyBuilder.SetTopologyConfig(topologyConfig);
            return(topologyBuilder);
        }
        public ITopologyBuilder GetTopologyBuilder()
        {
            var topologyBuilder = new TopologyBuilder(typeof(EventHubReaderTopology).Name + DateTime.Now.ToString("yyyyMMddHHmmss"));

            var EventHubNamespace = ConfigurationManager.AppSettings["EventHubNamespace"];
            if (String.IsNullOrWhiteSpace(EventHubNamespace))
            {
                throw new ArgumentException("A required AppSetting cannot be null or empty", "EventHubNamespace");
            }

            var EventHubEntityPath = ConfigurationManager.AppSettings["EventHubEntityPath"];
            if (String.IsNullOrWhiteSpace(EventHubEntityPath))
            {
                throw new ArgumentException("A required AppSetting cannot be null or empty", "EventHubEntityPath");
            }

            var EventHubSharedAccessKeyName = ConfigurationManager.AppSettings["EventHubSharedAccessKeyName"];
            if (String.IsNullOrWhiteSpace(EventHubSharedAccessKeyName))
            {
                throw new ArgumentException("A required AppSetting cannot be null or empty", "EventHubSharedAccessKeyName");
            }

            var EventHubSharedAccessKey = ConfigurationManager.AppSettings["EventHubSharedAccessKey"];
            if (String.IsNullOrWhiteSpace(EventHubSharedAccessKey))
            {
                throw new ArgumentException("A required AppSetting cannot be null or empty", "EventHubSharedAccessKey");
            }

            var EventHubPartitions = ConfigurationManager.AppSettings["EventHubPartitions"];
            if (String.IsNullOrWhiteSpace(EventHubPartitions))
            {
                throw new ArgumentException("A required AppSetting cannot be null or empty", "EventHubPartitions");
            }

            var partitionCount = int.Parse(EventHubPartitions);

            //You can use the new SetEventHubSpout method by providing EventHubSpoutConfig which will automatically create Java code to instantiate this spout
            //TODO: This method will not work if you do not include EventHub jar during publishing or deployment of this topology
            topologyBuilder.SetEventHubSpout(
                "EventHubSpout", //Set task name
                new EventHubSpoutConfig(
                    EventHubSharedAccessKeyName,
                    EventHubSharedAccessKey,
                    EventHubNamespace,
                    EventHubEntityPath,
                    partitionCount),
                    partitionCount
                );

            //For a hybrid topology we need to declare a customize Java serializer that will serialize Java objects which will deseriailized in the bolt into C# objects
            topologyBuilder.SetBolt(
                typeof(LoggerBolt).Name, //Set task name
                LoggerBolt.Get, //Set task constructor delegate
                new Dictionary<string, List<string>>(), //Leave empty if the task has no outputSchema defined i.e. no outgoing tuples
                1, //Set number of tasks
                true //Set enableAck
                ).
                DeclareCustomizedJavaSerializer(new List<string>() { "microsoft.scp.storm.multilang.CustomizedInteropJSONSerializer" } ).
                globalGrouping("EventHubSpout");

            //Set the topology config
            var topologyConfig = new StormConfig();
            topologyConfig.setNumWorkers(4); //Set number of worker processes
            topologyConfig.setMaxSpoutPending(1024); //Set maximum pending tuples from spout
            topologyConfig.setWorkerChildOps("-Xmx1024m"); //Set Java Heap Size

            return topologyBuilder;
        }
        public ITopologyBuilder GetTopologyBuilder()
        {
            TopologyBuilder topologyBuilder = new TopologyBuilder(typeof(AlarmsOnAggregatesTopology).Name + DateTime.Now.ToString("yyyyMMddHHmmss"));

            var eventHubPartitions = int.Parse(ConfigurationManager.AppSettings["EventHubPartitions"]);

            topologyBuilder.SetEventHubSpout(
                "com.microsoft.eventhubs.spout.EventHubSpout",
                new EventHubSpoutConfig(
                    ConfigurationManager.AppSettings["EventHubSharedAccessKeyName"],
                    ConfigurationManager.AppSettings["EventHubSharedAccessKey"],
                    ConfigurationManager.AppSettings["EventHubNamespace"],
                    ConfigurationManager.AppSettings["EventHubEntityPath"],
                    eventHubPartitions),
                eventHubPartitions);

            List <string> javaSerializerInfo = new List <string>()
            {
                "microsoft.scp.storm.multilang.CustomizedInteropJSONSerializer"
            };


            //FLATT MESSAGES
            topologyBuilder.SetBolt(
                typeof(FlattBolt).Name,
                FlattBolt.Get,
                new Dictionary <string, List <string> >()
            {
                { Constants.DEFAULT_STREAM_ID, new List <string>()
                  {
                      "sensor"
                  } }
            },
                eventHubPartitions,
                true
                ).DeclareCustomizedJavaSerializer(javaSerializerInfo)
            .shuffleGrouping("com.microsoft.eventhubs.spout.EventHubSpout");

            //AGGREGATE MESSAGES
            var boltConfig = new StormConfig();

            boltConfig.Set("topology.tick.tuple.freq.secs", "10");

            topologyBuilder.SetBolt(
                typeof(AggregateBolt).Name,
                AggregateBolt.Get,
                new Dictionary <string, List <string> >()
            {
                { Constants.DEFAULT_STREAM_ID, new List <string>()
                  {
                      "aggregated"
                  } }
            },
                parallelismHint: 1,
                enableAck: false
                )
            .globalGrouping(typeof(FlattBolt).Name)
            .addConfigurations(boltConfig);

            //ALARMS MESSAGES
            topologyBuilder.SetBolt(
                typeof(AlarmsBolt).Name,
                AlarmsBolt.Get,
                new Dictionary <string, List <string> >()
            {
            },
                parallelismHint: 4,
                enableAck: false
                ).shuffleGrouping(typeof(AggregateBolt).Name);

            var topologyConfig = new StormConfig();

            topologyConfig.setMaxSpoutPending(8192);
            topologyConfig.setNumWorkers(eventHubPartitions);

            topologyBuilder.SetTopologyConfig(topologyConfig);
            return(topologyBuilder);
        }
Exemplo n.º 11
0
        public ITopologyBuilder GetTopologyBuilder()
        {
            var topologyBuilder = new TopologyBuilder(typeof(EventHubReaderTopology).Name + DateTime.Now.ToString("yyyyMMddHHmmss"));

            var EventHubNamespace = ConfigurationManager.AppSettings["EventHubNamespace"];

            if (String.IsNullOrWhiteSpace(EventHubNamespace))
            {
                throw new ArgumentException("A required AppSetting cannot be null or empty", "EventHubNamespace");
            }

            var EventHubEntityPath = ConfigurationManager.AppSettings["EventHubEntityPath"];

            if (String.IsNullOrWhiteSpace(EventHubEntityPath))
            {
                throw new ArgumentException("A required AppSetting cannot be null or empty", "EventHubEntityPath");
            }

            var EventHubSharedAccessKeyName = ConfigurationManager.AppSettings["EventHubSharedAccessKeyName"];

            if (String.IsNullOrWhiteSpace(EventHubSharedAccessKeyName))
            {
                throw new ArgumentException("A required AppSetting cannot be null or empty", "EventHubSharedAccessKeyName");
            }

            var EventHubSharedAccessKey = ConfigurationManager.AppSettings["EventHubSharedAccessKey"];

            if (String.IsNullOrWhiteSpace(EventHubSharedAccessKey))
            {
                throw new ArgumentException("A required AppSetting cannot be null or empty", "EventHubSharedAccessKey");
            }

            var EventHubPartitions = ConfigurationManager.AppSettings["EventHubPartitions"];

            if (String.IsNullOrWhiteSpace(EventHubPartitions))
            {
                throw new ArgumentException("A required AppSetting cannot be null or empty", "EventHubPartitions");
            }

            var partitionCount = int.Parse(EventHubPartitions);

            //You can use the new SetEventHubSpout method by providing EventHubSpoutConfig which will automatically create Java code to instantiate this spout
            //TODO: This method will not work if you do not include EventHub jar during publishing or deployment of this topology
            topologyBuilder.SetEventHubSpout(
                "EventHubSpout", //Set task name
                new EventHubSpoutConfig(
                    EventHubSharedAccessKeyName,
                    EventHubSharedAccessKey,
                    EventHubNamespace,
                    EventHubEntityPath,
                    partitionCount),
                partitionCount
                );

            //For a hybrid topology we need to declare a customize Java serializer that will serialize Java objects which will deseriailized in the bolt into C# objects
            topologyBuilder.SetBolt(
                typeof(LoggerBolt).Name,                   //Set task name
                LoggerBolt.Get,                            //Set task constructor delegate
                new Dictionary <string, List <string> >(), //Leave empty if the task has no outputSchema defined i.e. no outgoing tuples
                1,                                         //Set number of tasks
                true                                       //Set enableAck
                ).
            DeclareCustomizedJavaSerializer(new List <string>()
            {
                "microsoft.scp.storm.multilang.CustomizedInteropJSONSerializer"
            }).
            globalGrouping("EventHubSpout");

            //Set the topology config
            var topologyConfig = new StormConfig();

            topologyConfig.setNumWorkers(4);               //Set number of worker processes
            topologyConfig.setMaxSpoutPending(1024);       //Set maximum pending tuples from spout
            topologyConfig.setWorkerChildOps("-Xmx1024m"); //Set Java Heap Size

            return(topologyBuilder);
        }