use of org.apache.storm.task.TopologyContext in project storm by apache.
the class WindowedBoltExecutorTest method testPrepareLateTUpleStreamWithoutBuilder.
@Test
public void testPrepareLateTUpleStreamWithoutBuilder() throws Exception {
Map<String, Object> conf = new HashMap<>();
conf.put(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS, 100000);
conf.put(Config.TOPOLOGY_BOLTS_WINDOW_LENGTH_DURATION_MS, 20);
conf.put(Config.TOPOLOGY_BOLTS_SLIDING_INTERVAL_DURATION_MS, 10);
conf.put(Config.TOPOLOGY_BOLTS_LATE_TUPLE_STREAM, "$late");
conf.put(Config.TOPOLOGY_BOLTS_TUPLE_TIMESTAMP_MAX_LAG_MS, 5);
conf.put(Config.TOPOLOGY_BOLTS_WATERMARK_EVENT_INTERVAL_MS, 10);
testWindowedBolt = new TestWindowedBolt();
testWindowedBolt.withTimestampField("ts");
executor = new WindowedBoltExecutor(testWindowedBolt);
TopologyContext context = getTopologyContext();
try {
executor.prepare(conf, context, getOutputCollector());
fail();
} catch (IllegalArgumentException e) {
assertThat(e.getMessage(), is("Stream for late tuples must be defined with the builder method withLateTupleStream"));
}
}
use of org.apache.storm.task.TopologyContext in project heron by twitter.
the class IRichSpoutDelegate method open.
@Override
@SuppressWarnings("rawtypes")
public void open(Map conf, com.twitter.heron.api.topology.TopologyContext context, SpoutOutputCollector collector) {
topologyContextImpl = new TopologyContext(context);
spoutOutputCollectorImpl = new SpoutOutputCollectorImpl(collector);
delegate.open(conf, topologyContextImpl, spoutOutputCollectorImpl);
}
use of org.apache.storm.task.TopologyContext in project flink by apache.
the class SpoutWrapper method run.
@Override
public final void run(final SourceContext<OUT> ctx) throws Exception {
final GlobalJobParameters config = super.getRuntimeContext().getExecutionConfig().getGlobalJobParameters();
StormConfig stormConfig = new StormConfig();
if (config != null) {
if (config instanceof StormConfig) {
stormConfig = (StormConfig) config;
} else {
stormConfig.putAll(config.toMap());
}
}
final TopologyContext stormTopologyContext = WrapperSetupHelper.createTopologyContext((StreamingRuntimeContext) super.getRuntimeContext(), this.spout, this.name, this.stormTopology, stormConfig);
SpoutCollector<OUT> collector = new SpoutCollector<OUT>(this.numberOfAttributes, stormTopologyContext.getThisTaskId(), ctx);
this.spout.open(stormConfig, stormTopologyContext, new SpoutOutputCollector(collector));
this.spout.activate();
if (numberOfInvocations == null) {
if (this.spout instanceof FiniteSpout) {
final FiniteSpout finiteSpout = (FiniteSpout) this.spout;
while (this.isRunning && !finiteSpout.reachedEnd()) {
finiteSpout.nextTuple();
}
} else {
while (this.isRunning) {
this.spout.nextTuple();
}
}
} else {
int counter = this.numberOfInvocations;
if (counter >= 0) {
while ((--counter >= 0) && this.isRunning) {
this.spout.nextTuple();
}
} else {
do {
collector.tupleEmitted = false;
this.spout.nextTuple();
} while (collector.tupleEmitted && this.isRunning);
}
}
}
use of org.apache.storm.task.TopologyContext in project open-kilda by telstra.
the class DumpStateAction method handle.
@Override
protected void handle() throws MessageFormatException, UnsupportedActionException, JsonProcessingException {
AbstractDumpState state = getMaster().getBolt().dumpState();
TopologyContext context = getBolt().getContext();
emitResponse(new DumpStateResponseData(context.getThisComponentId(), context.getThisTaskId(), getMessage().getTopology(), state));
}
use of org.apache.storm.task.TopologyContext in project open-kilda by telstra.
the class ListAction method handle.
@Override
protected void handle() throws MessageFormatException, UnsupportedActionException, JsonProcessingException {
TopologyContext context = getBolt().getContext();
emitResponse(new ResponseData(context.getThisComponentId(), context.getThisTaskId(), getMessage().getTopology()));
}
Aggregations