August 2017
Beginner to intermediate
284 pages
6h 51m
English
This step is done when building the topology with TopologyBuilder in the main method of a topology. ComponentConfigurationDeclarer has a method called addConfiguration(String config, String value) that allows adding of custom configuration--that is, metadata. In our case, we add the type information using this method:
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("spout", new SampleSpout(), 1); builder.setBolt("bolt1", new ExampleBolt1(), 1).shuffleGrouping("spout");
builder.setBolt("bolt3", new SampleBolt2(), 1).shuffleGrouping("bolt2").addConfiguration("type", "GPU");
The preceding code shows that we have typed our bolt2 component with type as GPU.
Read now
Unlock full access