Github user mbalassi commented on a diff in the pull request:

    https://github.com/apache/flink/pull/573#discussion_r27808721
  
    --- Diff: 
flink-staging/flink-streaming/flink-storm-compatibility/src/main/java/org/apache/flink/stormcompatibility/api/FlinkTopologyBuilder.java
 ---
    @@ -0,0 +1,294 @@
    +/*
    + * 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.flink.stormcompatibility.api;
    +
    +import java.util.HashMap;
    +import java.util.HashSet;
    +import java.util.Iterator;
    +import java.util.Map.Entry;
    +import java.util.Set;
    +
    +import org.apache.flink.api.common.typeinfo.TypeInformation;
    +import org.apache.flink.stormcompatibility.wrappers.StormBoltWrapper;
    +import org.apache.flink.stormcompatibility.wrappers.StormSpoutWrapper;
    +import org.apache.flink.streaming.api.datastream.DataStream;
    +
    +import backtype.storm.generated.ComponentCommon;
    +import backtype.storm.generated.GlobalStreamId;
    +import backtype.storm.generated.Grouping;
    +import backtype.storm.generated.StormTopology;
    +import backtype.storm.topology.BasicBoltExecutor;
    +import backtype.storm.topology.BoltDeclarer;
    +import backtype.storm.topology.IBasicBolt;
    +import backtype.storm.topology.IRichBolt;
    +import backtype.storm.topology.IRichSpout;
    +import backtype.storm.topology.SpoutDeclarer;
    +import backtype.storm.topology.TopologyBuilder;
    +
    +
    +
    +
    +
    +/**
    + * {@link FlinkTopologyBuilder} mimics a {@link TopologyBuilder}, but 
builds a Flink program instead of a Storm
    + * topology. Most methods (except {@link #createTopology()} are copied 
from the original {@link TopologyBuilder}
    + * implementation to ensure equal behavior.<br />
    + * <br />
    + * <strong>CAUTION: {@link StateSpout}s and multiple output streams per 
spout/bolt are currently not supported.</strong>
    + * 
    + * @author mjsax
    + */
    +public class FlinkTopologyBuilder {
    +   /**
    +    * A Storm {@link TopologyBuilder} to build a real Storm topology.
    +    */
    +   private final TopologyBuilder stormBuilder = new TopologyBuilder();
    +   /**
    +    * All user spouts by their ID.
    +    */
    +   private final HashMap<String, IRichSpout> spouts = new HashMap<String, 
IRichSpout>();
    +   /**
    +    * All user bolts by their ID.
    +    */
    +   private final HashMap<String, IRichBolt> bolts = new HashMap<String, 
IRichBolt>();
    +   
    +   // TODO add StateSpout support (Storm 0.9.4 does not yet support 
StateSpouts itself)
    +   
    +   
    +   
    +   /**
    +    * Creates a Flink program that used the specified spouts and bolts.
    +    */
    +   @SuppressWarnings({"unchecked", "rawtypes"})
    +   public FlinkTopology createTopology() {
    +           final StormTopology stormTopolgoy = 
this.stormBuilder.createTopology();
    --- End diff --
    
    Nice! :+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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to