public List<EventSet> runStreamingProcessor(final StreamingProcessor processor, List<EventSet> incomingEvents) throws Exception { Preconditions.checkNotNull(processor, "Processor can't be null!!"); Preconditions .checkNotNull(incomingEvents, "Please provide events to be sent to the processor.consume() method"); Preconditions.checkArgument(!incomingEvents.isEmpty(), "Please provide events to be sent to the processor.consume() method"); ProcessingContext processingContext = ProcessingContext.builder() .build(); ImmutableList.Builder<EventSet> listBuilder = ImmutableList.builder(); EventCollector eventCollector = new EventCollector(processingContext); for (EventSet eventSet : incomingEvents) { process(processor, processingContext, eventCollector, eventSet); listBuilder.add(eventCollector.getEvents()); } return listBuilder.build(); }
properties, globalProperties, "brokers", instanceId, sourceMetadata)) .curatorFramework(curatorFramework) .topologyName(processingContext.getTopologyName()) .topic(ComponentPropertyReader.readString( properties, globalProperties, "topic-name", instanceId, sourceMetadata))
public ComputationPipeline build(ComputationSpec spec) { final NotificationBus notificationBus = new NotificationBus(spec.getProperties()); final ProcessingContext processingContext = new ProcessingContext(); processingContext.setTopologyName(spec.getName()); ComputationPipeline pipeline = ComputationPipeline.builder(); pipeline.notificationBus(notificationBus);
ProcessingContext processingContext = ProcessingContext.builder() .build(); EventCollector eventCollector = new EventCollector(processingContext);
Preconditions.checkArgument(numPulses > 0, "Please provide a proper number of pulses to be dilvered"); ProcessingContext processingContext = ProcessingContext.builder() .build(); ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
/** * A blocking method for running long running tests on an event-driven processor. * * @param processor - an instance of StreamingProcessor which has been initialized already * @param incomingEvents - a list of event sets * @param n - number of iterations of the test * @throws Exception */ public void runStreamingProcessor(final StreamingProcessor processor, final List<EventSet> incomingEvents, int n) throws Exception { Preconditions.checkNotNull(processor, "Processor can't be null!!"); Preconditions .checkNotNull(incomingEvents, "Please provide events to be sent to the processor.consume() method"); Preconditions.checkArgument(!incomingEvents.isEmpty(), "Please provide events to be sent to the processor.consume() method"); startReporter(); ProcessingContext processingContext = ProcessingContext.builder() .build(); EventCollector eventCollector = new EventCollector(processingContext); for (int i = 0; i < n; i++) { for (EventSet eventSet : incomingEvents) { process(processor, processingContext, eventCollector, eventSet); } } stopReporter(); }