storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ptgo...@apache.org
Subject [44/50] [abbrv] storm git commit: storm-jms: fix examples to use storm 1.x packages
Date Thu, 06 Oct 2016 15:08:39 GMT
storm-jms: fix examples to use storm 1.x packages


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/5ede1ee7
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/5ede1ee7
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/5ede1ee7

Branch: refs/heads/master
Commit: 5ede1ee7c00293e25372fddace43dce724a6657c
Parents: 4a2f50c
Author: P. Taylor Goetz <ptgoetz@gmail.com>
Authored: Wed Oct 5 14:06:12 2016 -0400
Committer: P. Taylor Goetz <ptgoetz@gmail.com>
Committed: Wed Oct 5 14:06:12 2016 -0400

----------------------------------------------------------------------
 external/storm-jms/examples/README.markdown     |  21 --
 .../storm/jms/example/ExampleJmsTopology.java   | 196 +++++++++----------
 .../apache/storm/jms/example/GenericBolt.java   |  16 +-
 .../storm/jms/example/JsonTupleProducer.java    |   6 +-
 4 files changed, 109 insertions(+), 130 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/5ede1ee7/external/storm-jms/examples/README.markdown
----------------------------------------------------------------------
diff --git a/external/storm-jms/examples/README.markdown b/external/storm-jms/examples/README.markdown
index 72aa45b..7a4d8f0 100644
--- a/external/storm-jms/examples/README.markdown
+++ b/external/storm-jms/examples/README.markdown
@@ -9,25 +9,4 @@ The default build will create a jar file that can be deployed to to a Storm
clus
 
 `storm-jms-examples-0.1-SNAPSHOT-jar-with-dependencies.jar`
 
-## License
 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
-
-## Contributors
-
-* P. Taylor Goetz ([@ptgoetz](http://twitter.com/ptgoetz))

http://git-wip-us.apache.org/repos/asf/storm/blob/5ede1ee7/external/storm-jms/examples/src/main/java/org/apache/storm/jms/example/ExampleJmsTopology.java
----------------------------------------------------------------------
diff --git a/external/storm-jms/examples/src/main/java/org/apache/storm/jms/example/ExampleJmsTopology.java
b/external/storm-jms/examples/src/main/java/org/apache/storm/jms/example/ExampleJmsTopology.java
index 7db35a8..3324aac 100644
--- a/external/storm-jms/examples/src/main/java/org/apache/storm/jms/example/ExampleJmsTopology.java
+++ b/external/storm-jms/examples/src/main/java/org/apache/storm/jms/example/ExampleJmsTopology.java
@@ -22,110 +22,110 @@ import javax.jms.Message;
 import javax.jms.Session;
 import javax.jms.TextMessage;
 
-import backtype.storm.Config;
-import backtype.storm.LocalCluster;
-import backtype.storm.StormSubmitter;
+import org.apache.storm.Config;
+import org.apache.storm.LocalCluster;
+import org.apache.storm.StormSubmitter;
 import org.apache.storm.jms.JmsMessageProducer;
 import org.apache.storm.jms.JmsProvider;
 import org.apache.storm.jms.JmsTupleProducer;
 import org.apache.storm.jms.bolt.JmsBolt;
 import org.apache.storm.jms.spout.JmsSpout;
-import backtype.storm.topology.TopologyBuilder;
-import backtype.storm.tuple.Fields;
-import backtype.storm.tuple.Tuple;
-import backtype.storm.utils.Utils;
+import org.apache.storm.topology.TopologyBuilder;
+import org.apache.storm.tuple.Fields;
+import org.apache.storm.tuple.ITuple;
+import org.apache.storm.utils.Utils;
 
 public class ExampleJmsTopology {
-	public static final String JMS_QUEUE_SPOUT = "JMS_QUEUE_SPOUT";
-	public static final String INTERMEDIATE_BOLT = "INTERMEDIATE_BOLT";
-	public static final String FINAL_BOLT = "FINAL_BOLT";
-	public static final String JMS_TOPIC_BOLT = "JMS_TOPIC_BOLT";
-	public static final String JMS_TOPIC_SPOUT = "JMS_TOPIC_SPOUT";
-	public static final String ANOTHER_BOLT = "ANOTHER_BOLT";
-
-	@SuppressWarnings("serial")
-	public static void main(String[] args) throws Exception {
-
-		// JMS Queue Provider
-		JmsProvider jmsQueueProvider = new SpringJmsProvider(
-				"jms-activemq.xml", "jmsConnectionFactory",
-				"notificationQueue");
-		
-		// JMS Topic provider
-		JmsProvider jmsTopicProvider = new SpringJmsProvider(
-				"jms-activemq.xml", "jmsConnectionFactory",
-				"notificationTopic");
-
-		// JMS Producer
-		JmsTupleProducer producer = new JsonTupleProducer();
-
-		// JMS Queue Spout
-		JmsSpout queueSpout = new JmsSpout();
-		queueSpout.setJmsProvider(jmsQueueProvider);
-		queueSpout.setJmsTupleProducer(producer);
-		queueSpout.setJmsAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE);
-		queueSpout.setDistributed(true); // allow multiple instances
-
-		TopologyBuilder builder = new TopologyBuilder();
-		
-		// spout with 5 parallel instances
-		builder.setSpout(JMS_QUEUE_SPOUT, queueSpout, 5);
-
-		// intermediate bolt, subscribes to jms spout, anchors on tuples, and auto-acks
-		builder.setBolt(INTERMEDIATE_BOLT,
-				new GenericBolt("INTERMEDIATE_BOLT", true, true, new Fields("json")), 3).shuffleGrouping(
-				JMS_QUEUE_SPOUT);
-
-		// bolt that subscribes to the intermediate bolt, and auto-acks
-		// messages.
-		builder.setBolt(FINAL_BOLT, new GenericBolt("FINAL_BOLT", true, true), 3).shuffleGrouping(
-				INTERMEDIATE_BOLT);
-		
-		// bolt that subscribes to the intermediate bolt, and publishes to a JMS Topic		
-		JmsBolt jmsBolt = new JmsBolt();
-		jmsBolt.setJmsProvider(jmsTopicProvider);
-		
-		// anonymous message producer just calls toString() on the tuple to create a jms message
-		jmsBolt.setJmsMessageProducer(new JmsMessageProducer() {
-			@Override
-			public Message toMessage(Session session, Tuple input) throws JMSException{
-				System.out.println("Sending JMS Message:" + input.toString());
-				TextMessage tm = session.createTextMessage(input.toString());
-				return tm;
-			}
-		});
-		
-		builder.setBolt(JMS_TOPIC_BOLT, jmsBolt).shuffleGrouping(INTERMEDIATE_BOLT);
-		
-		// JMS Topic spout
-		JmsSpout topicSpout = new JmsSpout();
-		topicSpout.setJmsProvider(jmsTopicProvider);
-		topicSpout.setJmsTupleProducer(producer);
-		topicSpout.setJmsAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE);
-		topicSpout.setDistributed(false);
-		
-		builder.setSpout(JMS_TOPIC_SPOUT, topicSpout);
-		
-		builder.setBolt(ANOTHER_BOLT, new GenericBolt("ANOTHER_BOLT", true, true), 1).shuffleGrouping(
-				JMS_TOPIC_SPOUT);
-
-		Config conf = new Config();
-
-		if (args.length > 0) {
-			conf.setNumWorkers(3);
-
-			StormSubmitter.submitTopology(args[0], conf,
-					builder.createTopology());
-		} else {
-
-			conf.setDebug(true);
-
-			LocalCluster cluster = new LocalCluster();
-			cluster.submitTopology("storm-jms-example", conf, builder.createTopology());
-			Utils.sleep(60000);
-			cluster.killTopology("storm-jms-example");
-			cluster.shutdown();
-		}
-	}
+    public static final String JMS_QUEUE_SPOUT = "JMS_QUEUE_SPOUT";
+    public static final String INTERMEDIATE_BOLT = "INTERMEDIATE_BOLT";
+    public static final String FINAL_BOLT = "FINAL_BOLT";
+    public static final String JMS_TOPIC_BOLT = "JMS_TOPIC_BOLT";
+    public static final String JMS_TOPIC_SPOUT = "JMS_TOPIC_SPOUT";
+    public static final String ANOTHER_BOLT = "ANOTHER_BOLT";
+
+    @SuppressWarnings("serial")
+    public static void main(String[] args) throws Exception {
+
+        // JMS Queue Provider
+        JmsProvider jmsQueueProvider = new SpringJmsProvider(
+                "jms-activemq.xml", "jmsConnectionFactory",
+                "notificationQueue");
+
+        // JMS Topic provider
+        JmsProvider jmsTopicProvider = new SpringJmsProvider(
+                "jms-activemq.xml", "jmsConnectionFactory",
+                "notificationTopic");
+
+        // JMS Producer
+        JmsTupleProducer producer = new JsonTupleProducer();
+
+        // JMS Queue Spout
+        JmsSpout queueSpout = new JmsSpout();
+        queueSpout.setJmsProvider(jmsQueueProvider);
+        queueSpout.setJmsTupleProducer(producer);
+        queueSpout.setJmsAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE);
+        queueSpout.setDistributed(true); // allow multiple instances
+
+        TopologyBuilder builder = new TopologyBuilder();
+
+        // spout with 5 parallel instances
+        builder.setSpout(JMS_QUEUE_SPOUT, queueSpout, 5);
+
+        // intermediate bolt, subscribes to jms spout, anchors on tuples, and auto-acks
+        builder.setBolt(INTERMEDIATE_BOLT,
+                new GenericBolt("INTERMEDIATE_BOLT", true, true, new Fields("json")), 3).shuffleGrouping(
+                JMS_QUEUE_SPOUT);
+
+        // bolt that subscribes to the intermediate bolt, and auto-acks
+        // messages.
+        builder.setBolt(FINAL_BOLT, new GenericBolt("FINAL_BOLT", true, true), 3).shuffleGrouping(
+                INTERMEDIATE_BOLT);
+
+        // bolt that subscribes to the intermediate bolt, and publishes to a JMS Topic
+        JmsBolt jmsBolt = new JmsBolt();
+        jmsBolt.setJmsProvider(jmsTopicProvider);
+
+        // anonymous message producer just calls toString() on the tuple to create a jms
message
+        jmsBolt.setJmsMessageProducer(new JmsMessageProducer() {
+            @Override
+            public Message toMessage(Session session, ITuple input) throws JMSException {
+                System.out.println("Sending JMS Message:" + input.toString());
+                TextMessage tm = session.createTextMessage(input.toString());
+                return tm;
+            }
+        });
+
+        builder.setBolt(JMS_TOPIC_BOLT, jmsBolt).shuffleGrouping(INTERMEDIATE_BOLT);
+
+        // JMS Topic spout
+        JmsSpout topicSpout = new JmsSpout();
+        topicSpout.setJmsProvider(jmsTopicProvider);
+        topicSpout.setJmsTupleProducer(producer);
+        topicSpout.setJmsAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE);
+        topicSpout.setDistributed(false);
+
+        builder.setSpout(JMS_TOPIC_SPOUT, topicSpout);
+
+        builder.setBolt(ANOTHER_BOLT, new GenericBolt("ANOTHER_BOLT", true, true), 1).shuffleGrouping(
+                JMS_TOPIC_SPOUT);
+
+        Config conf = new Config();
+
+        if (args.length > 0) {
+            conf.setNumWorkers(3);
+
+            StormSubmitter.submitTopology(args[0], conf,
+                    builder.createTopology());
+        } else {
+
+            conf.setDebug(true);
+
+            LocalCluster cluster = new LocalCluster();
+            cluster.submitTopology("storm-jms-example", conf, builder.createTopology());
+            Utils.sleep(60000);
+            cluster.killTopology("storm-jms-example");
+            cluster.shutdown();
+        }
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/storm/blob/5ede1ee7/external/storm-jms/examples/src/main/java/org/apache/storm/jms/example/GenericBolt.java
----------------------------------------------------------------------
diff --git a/external/storm-jms/examples/src/main/java/org/apache/storm/jms/example/GenericBolt.java
b/external/storm-jms/examples/src/main/java/org/apache/storm/jms/example/GenericBolt.java
index f2f7799..90c8b2d 100644
--- a/external/storm-jms/examples/src/main/java/org/apache/storm/jms/example/GenericBolt.java
+++ b/external/storm-jms/examples/src/main/java/org/apache/storm/jms/example/GenericBolt.java
@@ -19,21 +19,21 @@ package org.apache.storm.jms.example;
 
 import java.util.Map;
 
-import backtype.storm.topology.base.BaseRichBolt;
+import org.apache.storm.topology.base.BaseRichBolt;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import backtype.storm.task.OutputCollector;
-import backtype.storm.task.TopologyContext;
-import backtype.storm.topology.OutputFieldsDeclarer;
-import backtype.storm.tuple.Fields;
-import backtype.storm.tuple.Tuple;
+import org.apache.storm.task.OutputCollector;
+import org.apache.storm.task.TopologyContext;
+import org.apache.storm.topology.OutputFieldsDeclarer;
+import org.apache.storm.tuple.Fields;
+import org.apache.storm.tuple.Tuple;
 /**
- * A generic <code>backtype.storm.topology.IRichBolt</code> implementation
+ * A generic <code>org.apache.storm.topology.IRichBolt</code> implementation
  * for testing/debugging the Storm JMS Spout and example topologies.
  * <p/>
  * For debugging purposes, set the log level of the 
- * <code>backtype.storm.contrib.jms</code> package to DEBUG for debugging
+ * <code>org.apache.storm.contrib.jms</code> package to DEBUG for debugging
  * output.
  * @author tgoetz
  *

http://git-wip-us.apache.org/repos/asf/storm/blob/5ede1ee7/external/storm-jms/examples/src/main/java/org/apache/storm/jms/example/JsonTupleProducer.java
----------------------------------------------------------------------
diff --git a/external/storm-jms/examples/src/main/java/org/apache/storm/jms/example/JsonTupleProducer.java
b/external/storm-jms/examples/src/main/java/org/apache/storm/jms/example/JsonTupleProducer.java
index cb11f3d..9ee175e 100644
--- a/external/storm-jms/examples/src/main/java/org/apache/storm/jms/example/JsonTupleProducer.java
+++ b/external/storm-jms/examples/src/main/java/org/apache/storm/jms/example/JsonTupleProducer.java
@@ -22,9 +22,9 @@ import javax.jms.Message;
 import javax.jms.TextMessage;
 
 import org.apache.storm.jms.JmsTupleProducer;
-import backtype.storm.topology.OutputFieldsDeclarer;
-import backtype.storm.tuple.Fields;
-import backtype.storm.tuple.Values;
+import org.apache.storm.topology.OutputFieldsDeclarer;
+import org.apache.storm.tuple.Fields;
+import org.apache.storm.tuple.Values;
 
 /**
  * A simple <code>JmsTupleProducer</code> that expects to receive


Mime
View raw message