You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by vesense <gi...@git.apache.org> on 2016/07/14 09:28:07 UTC

[GitHub] storm pull request #1565: STORM-1970: external project examples refator

GitHub user vesense opened a pull request:

    https://github.com/apache/storm/pull/1565

    STORM-1970: external project examples refator

    refactor example projects:
    * storm-elasticsearch
    * storm-hbase
    * storm-hdfs	
    * storm-hive	
    * storm-jdbc
    * storm-kafka
    * storm-mongodb
    * storm-mqtt
    * storm-opentsdb
    * storm-redis
    * storm-solr

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/vesense/storm external-examples

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/storm/pull/1565.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1565
    
----
commit 5fcdb4c2d15969cbc9b1df22ba705e837aff4fcb
Author: vesense <be...@163.com>
Date:   2016-07-14T09:13:39Z

    STORM-1970: external project examples refator

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm issue #1565: STORM-1970: external project examples refator

Posted by vesense <gi...@git.apache.org>.
Github user vesense commented on the issue:

    https://github.com/apache/storm/pull/1565
  
    @abhishekagarwal87 Could you take a look?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm issue #1565: STORM-1970: external project examples refator

Posted by HeartSaVioR <gi...@git.apache.org>.
Github user HeartSaVioR commented on the issue:

    https://github.com/apache/storm/pull/1565
  
    @vesense Thanks for the update. +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm issue #1565: STORM-1970: external project examples refator

Posted by HeartSaVioR <gi...@git.apache.org>.
Github user HeartSaVioR commented on the issue:

    https://github.com/apache/storm/pull/1565
  
    @vesense You can refer pom.xml of storm-starter to see the trick. It determines whether we apply 'provided' or 'compile' via property and profile.
    
    https://github.com/apache/storm/blob/master/examples/storm-starter/pom.xml#L35 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm issue #1565: STORM-1970: external project examples refator

Posted by vesense <gi...@git.apache.org>.
Github user vesense commented on the issue:

    https://github.com/apache/storm/pull/1565
  
    @abhishekagarwal87 Upmerged.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request #1565: STORM-1970: external project examples refator

Posted by vesense <gi...@git.apache.org>.
Github user vesense commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1565#discussion_r77186650
  
    --- Diff: examples/storm-mqtt-examples/pom.xml ---
    @@ -24,18 +24,24 @@
     
       <name>storm-mqtt-examples</name>
     
    -  <parent>
    -    <groupId>org.apache.storm</groupId>
    -    <artifactId>storm-mqtt-parent</artifactId>
    -    <version>2.0.0-SNAPSHOT</version>
    -    <relativePath>../pom.xml</relativePath>
    -  </parent>
    +    <parent>
    --- End diff --
    
    Will fix.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request #1565: STORM-1970: external project examples refator

Posted by vesense <gi...@git.apache.org>.
Github user vesense commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1565#discussion_r70777166
  
    --- Diff: examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/InsertWordCount.java ---
    @@ -1,81 +1,81 @@
    -/**
    - * 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.
    - */
    -package org.apache.storm.mongodb.topology;
    -
    -import org.apache.storm.Config;
    -import org.apache.storm.LocalCluster;
    -import org.apache.storm.StormSubmitter;
    -import org.apache.storm.topology.TopologyBuilder;
    -import org.apache.storm.tuple.Fields;
    -import org.apache.storm.mongodb.bolt.MongoInsertBolt;
    -import org.apache.storm.mongodb.common.mapper.MongoMapper;
    -import org.apache.storm.mongodb.common.mapper.SimpleMongoMapper;
    -
    -import java.util.HashMap;
    -import java.util.Map;
    -
    -public class InsertWordCount {
    -    private static final String WORD_SPOUT = "WORD_SPOUT";
    -    private static final String COUNT_BOLT = "COUNT_BOLT";
    -    private static final String INSERT_BOLT = "INSERT_BOLT";
    -
    -    private static final String TEST_MONGODB_URL = "mongodb://127.0.0.1:27017/test";
    -    private static final String TEST_MONGODB_COLLECTION_NAME = "wordcount";
    -    
    -
    -    public static void main(String[] args) throws Exception {
    -        Config config = new Config();
    -
    -        String url = TEST_MONGODB_URL;
    -        String collectionName = TEST_MONGODB_COLLECTION_NAME;
    -
    -        if (args.length >= 2) {
    -            url = args[0];
    -            collectionName = args[1];
    -        }
    -
    -        WordSpout spout = new WordSpout();
    -        WordCounter bolt = new WordCounter();
    -
    -        MongoMapper mapper = new SimpleMongoMapper()
    -                .withFields("word", "count");
    -        
    -        MongoInsertBolt insertBolt = new MongoInsertBolt(url, collectionName, mapper);
    -
    -        // wordSpout ==> countBolt ==> MongoInsertBolt
    -        TopologyBuilder builder = new TopologyBuilder();
    -
    -        builder.setSpout(WORD_SPOUT, spout, 1);
    -        builder.setBolt(COUNT_BOLT, bolt, 1).shuffleGrouping(WORD_SPOUT);
    -        builder.setBolt(INSERT_BOLT, insertBolt, 1).fieldsGrouping(COUNT_BOLT, new Fields("word"));
    -
    -
    -        if (args.length == 2) {
    -            LocalCluster cluster = new LocalCluster();
    -            cluster.submitTopology("test", config, builder.createTopology());
    -            Thread.sleep(30000);
    -            cluster.killTopology("test");
    -            cluster.shutdown();
    -            System.exit(0);
    -        } else if (args.length == 3) {
    -            StormSubmitter.submitTopology(args[2], config, builder.createTopology());
    -        } else{
    -            System.out.println("Usage: InsertWordCount <mongodb url> <mongodb collection> [topology name]");
    -        }
    -    }
    -}
    +/**
    --- End diff --
    
    it's strange. I just move the file to the new folder like other external projects. no code changes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm issue #1565: STORM-1970: external project examples refator

Posted by vesense <gi...@git.apache.org>.
Github user vesense commented on the issue:

    https://github.com/apache/storm/pull/1565
  
    hi @darionyaphet  sorry for the less information.
    this PR address @abhishekagarwal87 's topic from dev@ mailing list.
    
    >Right now the example topologies/classes for some external modules are being put up in the test folder itself. The problem I see is that,
    -> the example code isn't really test code so test folder isn't the right fit.
    -> people, who are looking for example code, may not find the example code.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm issue #1565: STORM-1970: external project examples refator

Posted by vesense <gi...@git.apache.org>.
Github user vesense commented on the issue:

    https://github.com/apache/storm/pull/1565
  
    @HeartSaVioR Could you take a look again?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request #1565: STORM-1970: external project examples refator

Posted by abhishekagarwal87 <gi...@git.apache.org>.
Github user abhishekagarwal87 commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1565#discussion_r71303863
  
    --- Diff: examples/storm-elasticsearch-examples/src/main/java/org/apache/storm/elasticsearch/common/EsConstants.java ---
    @@ -0,0 +1,22 @@
    +/**
    + * 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.
    + */
    +package org.apache.storm.elasticsearch.common;
    +
    +public class EsConstants {
    --- End diff --
    
    This looks like a new class since I don't see a corresponding delete. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request #1565: STORM-1970: external project examples refator

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/storm/pull/1565


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm issue #1565: STORM-1970: external project examples refator

Posted by vesense <gi...@git.apache.org>.
Github user vesense commented on the issue:

    https://github.com/apache/storm/pull/1565
  
    Thanks @HeartSaVioR  I see. Will update.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm issue #1565: STORM-1970: external project examples refator

Posted by abhishekagarwal87 <gi...@git.apache.org>.
Github user abhishekagarwal87 commented on the issue:

    https://github.com/apache/storm/pull/1565
  
    +1 Post the conflicts merge. 
    @HeartSaVioR - can you also take a look?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request #1565: STORM-1970: external project examples refator

Posted by HeartSaVioR <gi...@git.apache.org>.
Github user HeartSaVioR commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1565#discussion_r77088437
  
    --- Diff: examples/storm-mqtt-examples/pom.xml ---
    @@ -24,18 +24,24 @@
     
       <name>storm-mqtt-examples</name>
     
    -  <parent>
    -    <groupId>org.apache.storm</groupId>
    -    <artifactId>storm-mqtt-parent</artifactId>
    -    <version>2.0.0-SNAPSHOT</version>
    -    <relativePath>../pom.xml</relativePath>
    -  </parent>
    +    <parent>
    --- End diff --
    
    nit: broken indentation


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request #1565: STORM-1970: external project examples refator

Posted by vesense <gi...@git.apache.org>.
Github user vesense commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1565#discussion_r71467698
  
    --- Diff: examples/storm-elasticsearch-examples/src/main/java/org/apache/storm/elasticsearch/common/EsConstants.java ---
    @@ -0,0 +1,22 @@
    +/**
    + * 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.
    + */
    +package org.apache.storm.elasticsearch.common;
    +
    +public class EsConstants {
    --- End diff --
    
    This is a copy. both unit tests and example use this class. so dose `EsTestUtil`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm issue #1565: STORM-1970: external project examples refator

Posted by vesense <gi...@git.apache.org>.
Github user vesense commented on the issue:

    https://github.com/apache/storm/pull/1565
  
    @abhishekagarwal87 is this should be continue?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm issue #1565: STORM-1970: external project examples refator

Posted by HeartSaVioR <gi...@git.apache.org>.
Github user HeartSaVioR commented on the issue:

    https://github.com/apache/storm/pull/1565
  
    I think we have to make sure that users can run example topologies with local and also remote.
    (Yes these modules are just examples but 'runnable' examples.)
    
    So it might be better to apply two things:
    
    - profile trick to change scope of 'storm-core' : other modules use 'intellij' profile
    - create fat jar for each project : change scope of external module to 'compile'. Is there a reason to set this to 'provided'?
    
    Other things look good.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm issue #1565: STORM-1970: external project examples refator

Posted by vesense <gi...@git.apache.org>.
Github user vesense commented on the issue:

    https://github.com/apache/storm/pull/1565
  
    I will add new external project examples (such as `storm-druid`, `storm-kinesis`) to the `examples` directory in a following up jira after this PR being merged.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request #1565: STORM-1970: external project examples refator

Posted by abhishekagarwal87 <gi...@git.apache.org>.
Github user abhishekagarwal87 commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1565#discussion_r71077064
  
    --- Diff: examples/storm-mongodb-examples/src/main/java/org/apache/storm/mongodb/topology/InsertWordCount.java ---
    @@ -1,81 +1,81 @@
    -/**
    - * 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.
    - */
    -package org.apache.storm.mongodb.topology;
    -
    -import org.apache.storm.Config;
    -import org.apache.storm.LocalCluster;
    -import org.apache.storm.StormSubmitter;
    -import org.apache.storm.topology.TopologyBuilder;
    -import org.apache.storm.tuple.Fields;
    -import org.apache.storm.mongodb.bolt.MongoInsertBolt;
    -import org.apache.storm.mongodb.common.mapper.MongoMapper;
    -import org.apache.storm.mongodb.common.mapper.SimpleMongoMapper;
    -
    -import java.util.HashMap;
    -import java.util.Map;
    -
    -public class InsertWordCount {
    -    private static final String WORD_SPOUT = "WORD_SPOUT";
    -    private static final String COUNT_BOLT = "COUNT_BOLT";
    -    private static final String INSERT_BOLT = "INSERT_BOLT";
    -
    -    private static final String TEST_MONGODB_URL = "mongodb://127.0.0.1:27017/test";
    -    private static final String TEST_MONGODB_COLLECTION_NAME = "wordcount";
    -    
    -
    -    public static void main(String[] args) throws Exception {
    -        Config config = new Config();
    -
    -        String url = TEST_MONGODB_URL;
    -        String collectionName = TEST_MONGODB_COLLECTION_NAME;
    -
    -        if (args.length >= 2) {
    -            url = args[0];
    -            collectionName = args[1];
    -        }
    -
    -        WordSpout spout = new WordSpout();
    -        WordCounter bolt = new WordCounter();
    -
    -        MongoMapper mapper = new SimpleMongoMapper()
    -                .withFields("word", "count");
    -        
    -        MongoInsertBolt insertBolt = new MongoInsertBolt(url, collectionName, mapper);
    -
    -        // wordSpout ==> countBolt ==> MongoInsertBolt
    -        TopologyBuilder builder = new TopologyBuilder();
    -
    -        builder.setSpout(WORD_SPOUT, spout, 1);
    -        builder.setBolt(COUNT_BOLT, bolt, 1).shuffleGrouping(WORD_SPOUT);
    -        builder.setBolt(INSERT_BOLT, insertBolt, 1).fieldsGrouping(COUNT_BOLT, new Fields("word"));
    -
    -
    -        if (args.length == 2) {
    -            LocalCluster cluster = new LocalCluster();
    -            cluster.submitTopology("test", config, builder.createTopology());
    -            Thread.sleep(30000);
    -            cluster.killTopology("test");
    -            cluster.shutdown();
    -            System.exit(0);
    -        } else if (args.length == 3) {
    -            StormSubmitter.submitTopology(args[2], config, builder.createTopology());
    -        } else{
    -            System.out.println("Usage: InsertWordCount <mongodb url> <mongodb collection> [topology name]");
    -        }
    -    }
    -}
    +/**
    --- End diff --
    
    I see some formatting changes. Can you revert them if possible? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm issue #1565: STORM-1970: external project examples refator

Posted by abhishekagarwal87 <gi...@git.apache.org>.
Github user abhishekagarwal87 commented on the issue:

    https://github.com/apache/storm/pull/1565
  
    @vesense Thanks for your efforts. can you upmerge this PR?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm issue #1565: STORM-1970: external project examples refator

Posted by vesense <gi...@git.apache.org>.
Github user vesense commented on the issue:

    https://github.com/apache/storm/pull/1565
  
    hi @HeartSaVioR 
    Of course, we should make sure that all examples are  'runnable'.
    >profile trick to change scope of 'storm-core' : other modules use 'intellij' profile
    
    Actually, I can't see what you mean..
    
    >create fat jar for each project : change scope of external module to 'compile'
    
    Yes, I will change the scope to `compile` and add `maven-shade-plugin` for building a fat jar.
    Thanks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm issue #1565: STORM-1970: external project examples refator

Posted by darionyaphet <gi...@git.apache.org>.
Github user darionyaphet commented on the issue:

    https://github.com/apache/storm/pull/1565
  
    What is it doing ? Do you add more desc ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm issue #1565: STORM-1970: external project examples refator

Posted by vesense <gi...@git.apache.org>.
Github user vesense commented on the issue:

    https://github.com/apache/storm/pull/1565
  
    Updated. 
    the travis-ci build error is because that `Network is unreachable` for https://clojars.org.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---