With the architectural concepts in place, let's return to the use case. To keep things focused on the integration, we will keep the topology simple. The following diagram depicts the topology:
The FIX Spout
emits tuples containing simple FIX messages. Then the filter checks the type of the message, filtering for stock orders that contain pricing information. Then, those filtered tuples flow to the DruidState
object, which is the bridge to Druid.
The code for this simple topology is as follows:
public class FinancialAnalyticsTopology { public static StormTopology buildTopology() { TridentTopology topology = new TridentTopology(); FixEventSpout spout = new FixEventSpout(); Stream inputStream = topology.newStream("message", spout); inputStream.each(new Fields("message"), new MessageTypeFilter()) .partitionPersist(new DruidStateFactory(), new Fields("message"), new DruidStateUpdater()); return topology.build(); } }