This question is about the Pipeline API in Hazelcast Jet 0.5.1
The pipeline I am trying to create has two infinite sources: one is a ticker (a custom source which sends one event every minute), the other is a Kafka Topic.
It looks like that:
Pipeline pipeline = Pipeline.create();
ComputeStage<Object> tickerSource = pipeline.drawFrom(Sources.fromProcessor("ticker", TickerSource.getSupplier()));
ComputeStage<Object> kafkaSource = pipeline.drawFrom(KafkaSources.kafka(sourceProperties, KAFKA_TOPIC));
When either of those sources emit an event, I want that event to go through the same steps and drain to the same sinks. I want a "UNION", if we translate my problem to SQL terms. Something that would look like this:
All of the examples and documentation I've found about having two nodes go into one would be the equivalent of a SQL "JOIN" operation, not a "UNION".
The only way I've found to bypass my issue is to do something like this, but I feel like this is something the framework should already have despite the fact that I can't seem to find it.
Arrays.asList(tickerSource, kafkaSource).forEach(source ->
{
ComputeStage<Object> result = source.map(MyCustomProcessor::process);
result.drainTo(Sinks.fromProcessor("first-sink", MyFirstSink.getSupplier());
result.drainTo(Sinks.fromProcessor("second-sink", MySecondSink.getSupplier());
});
The result looks like this: