Github user harshach commented on a diff in the pull request: https://github.com/apache/storm/pull/1583#discussion_r71718749 --- Diff: external/storm-druid/README.md --- @@ -0,0 +1,125 @@ +# Storm Druid Bolt and TridentState + +This module provides core Storm and Trident bolt implementations for writing data to [Druid] (http://druid.io/) data store. +This implementation uses Druid's [Tranquility library] (https://github.com/druid-io/tranquility) to send messages to druid. + +Some of the implementation details are borrowed from existing [Tranquility Storm Bolt] (https://github.com/druid-io/tranquility/blob/master/docs/storm.md). +This new Bolt added to support latest storm release and maintain the bolt in the storm repo. + +### Core Bolt +Below example describes the usage of core bolt which is `org.apache.storm.druid.bolt.DruidBeamBolt` +This Bolt expects to receive tuples in which the zeroth element is your event type. + + +```java + + DruidBeamBolt<Map<String, Object>> druidBolt = new DruidBeamBolt<Map<String, Object>>(new SampleDruidBeamFactoryImpl()); + topologyBuilder.setBolt("druid-bolt", druidBolt).shuffleGrouping("event-gen"); + +``` + + +### Trident State + +```java + + final Stream stream = tridentTopology.newStream("batch-event-gen", new SimpleBatchSpout(10)); + + stream.peek(new Consumer() { + @Override + public void accept(TridentTuple input) { + LOG.info("########### Received tuple: [{}]", input); + } + }).partitionPersist(new DruidBeamStateFactory(new SampleDruidBeamFactoryImpl()), new Fields("events"), new DruidBeamStateUpdater()); + +``` + +### Sample Beam Factory Implementation +Druid bolt must be supplied with a BeamFactory. You can implement one of these using the [DruidBeams builder's] (https://github.com/druid-io/tranquility/blob/master/core/src/main/scala/com/metamx/tranquility/druid/DruidBeams.scala) "buildBeam()" method. +See the [Configuration documentation] (https://github.com/druid-io/tranquility/blob/master/docs/configuration.md) for details. +For more details refer [Tranquility library] (https://github.com/druid-io/tranquility) docs. + +```java + +public class SampleDruidBeamFactoryImpl implements DruidBeamFactory<Map<String, Object>> { + + @Override + public Beam<Map<String, Object>> makeBeam(Map<?, ?> conf, IMetricsContext metrics) { + + + final String indexService = "druid/overlord"; // Your overlord's druid.service --- End diff -- can you add some comments around these two.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---