Created
September 16, 2015 18:08
-
-
Save charlesbullsd/3d15e9066e128e69d9ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Link two topology components together via direct grouping to/from each other. | |
| // EXAMPLE: | |
| // TopologyBuilder builder = new TopologyBuilder() | |
| // builder.setSpout("s0", new Spout()); | |
| // builder.setBolt("b1", new SomethingBolt()).shuffleGrouping("s0"); | |
| // builder.setbolt("b2", new WhoaAmazingBolt()); <-- There is no shuffle here...on purpose. | |
| // StormTopology topo = builder.build(); | |
| // directLinkBolts(topo, "b1", Utils.DEFAULT_STREAM_ID, "b2", Utils.DEFAULT_STREAM_ID) | |
| // submit(topo); | |
| public StormTopology directLinkBolts(StormTopology topo, String b0, String s0, String b1, String s1) { | |
| topo.get_bolts().get(b0).get_common().get_inputs().put(new GlobalStreamId(b1, s1), Grouping.direct(new NullStruct())); | |
| topo.get_bolts().get(b1).get_common().get_inputs().put(new GlobalStreamId(b0, s0), Grouping.direct(new NullStruct())); | |
| return topo; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment