@Override public void process(final K key, final V value) { context().forward(key, value); } }
@Override public void process(final K key, final V value) { context.forward(key, valueTransformer.transform(key, value)); }
@Override public void process(final K1 key, final V1 value) { final KeyValue<? extends K2, ? extends V2> pair = transformer.transform(key, value); if (pair != null) context().forward(pair.key, pair.value); }
@Override public void process(final K key, final V value) { context.forward(key, value); sourceNodeForwardSensor().record(); }
/** Forwards the values in the state store downstream. * * {@inheritDoc} */ @Override public void punctuate(long timestamp) { state.all().forEachRemaining( kv -> context.forward(kv.key, kv.value, type + "-sink")); } // Close punctuate.
@Override public void process(final String key, final VisibilityStatement statement) { log.debug("\nINPUT:\n{}\n", statement); // Check to see if the Statement matches the Statement Pattern. final Optional<BindingSet> bs = spMatcher.match(statement); if(bs.isPresent()) { // If it does, wrap the Binding Set with the Statement's visibility expression and write it to the state store. final VisibilityBindingSet visBs = new VisibilityBindingSet(bs.get(), statement.getVisibility()); // Wrap the binding set as a result and forward it to the downstream processor. final ProcessorResult resultValue = resultFactory.make(visBs); log.debug("\nOUTPUT:\n{}", visBs); context.forward(key, resultValue); } }
/** Saves the `lastAvgs` map to the state store. * * {@inheritDoc} */ @Override public void punctuate(long timestamp) { // Print the contents of the state store. state.all().forEachRemaining( kv -> System.out.println(System.currentTimeMillis() + " PUNCTUATE: " + kv.key + ", " + kv.value)); // Foward the new average. state.all().forEachRemaining( kv -> context.forward(kv.key, kv.value, "FAST-sink")); } // Close punctuate.
@Override public void punctuate(long streamTime) { KeyValueIterator<String, StockTransactionSummary> it = summaryStore.all(); long currentTime = System.currentTimeMillis(); while (it.hasNext()) { StockTransactionSummary summary = it.next().value; if (summary.updatedWithinLastMillis(currentTime, 11000)) { this.context.forward(summary.tickerSymbol, summary); } } }
@Override public void process(final Object key, final ProcessorResult result) { // projections can only be unary if (result.getType() != ResultType.UNARY) { throw new RuntimeException("The ProcessorResult to be processed must be Unary."); } // Apply the projection to the binding set. final VisibilityBindingSet bs = result.getUnary().getResult(); final VisibilityBindingSet newVisBs = projection.project(bs); // Forward the result to the downstream processor. log.debug("\nOUTPUT:\n{}", newVisBs); context.forward(key, super.getResultFactory().make(newVisBs)); }
@Override public void process(final Object key, final ProcessorResult value) { // projections can only be unary if (value.getType() != ResultType.UNARY) { throw new RuntimeException("The ProcessorResult to be processed must be Unary."); } // Apply the projection to the binding set and forward the results. final VisibilityBindingSet bs = value.getUnary().getResult(); for(final VisibilityBindingSet newVisBs : multiProjection.project(bs)) { log.debug("\nOUTPUT:\n{}", newVisBs); context.forward(key, super.getResultFactory().make(newVisBs)); } }
@Override public void punctuate(long timestamp) { try (KeyValueIterator<String, Integer> iterator = this.kvStore.all()) { iterator.forEachRemaining(entry -> { context.forward(entry.key, entry.value); this.kvStore.delete(entry.key); }); } context.commit(); }
@Override public void process(final Object key, final ProcessorResult value) { // Aggregations can only be unary. if (value.getType() != ResultType.UNARY) { throw new RuntimeException("The ProcessorResult to be processed must be Unary."); } // Log the binding set that has been input. log.debug("\nINPUT:\nBinding Set: {}", value.getUnary().getResult()); // Update the aggregations values. final VisibilityBindingSet resultBs = evaluator.update(value.getUnary().getResult()); // Log the binding set that will be output. log.debug("\nOUTPUT:\nBinding Set: {}", resultBs); // Forward to the updated aggregation binding set to the downstream processors. context.forward(key, super.getResultFactory().make(resultBs)); }
@Override public void process(String key, EventEnvelope value) { handle(deserializeEvent(value)); context().forward(key, value); context().commit(); }
@Override public void process(String key, Purchase value) { RewardAccumulator accumulator = RewardAccumulator.builder(value).build(); context().forward(key,accumulator); context().commit(); } }
@Override public void process(String key, EventEnvelope value) { handle(deserializeEvent(value)); context().forward(key, value); context().commit(); }
@Override public void process(String key, Purchase purchase) { String last4Digits = purchase.getCreditCardNumber().split("-")[3]; Purchase updated = Purchase.builder(purchase).creditCardNumber(CC_NUMBER_REPLACEMENT+last4Digits).build(); context().forward(key,updated); context().commit(); } }
@Override public void process(String key, EventEnvelope value) { handle(deserializeEvent(value)); context().forward(key, value); context().commit(); }
@Override public void process(final Object key, final ProcessorResult value) { VisibilityBindingSet result = null; switch(value.getType()) { case UNARY: result = value.getUnary().getResult(); break; case BINARY: result = value.getBinary().getResult(); break; } if(result != null) { processorContext.forward(key, result); } }
@Override public void process(String key, Purchase value) { PurchasePattern purchasePattern = PurchasePattern.newBuilder().date(value.getPurchaseDate()) .item(value.getItemPurchased()) .zipCode(value.getZipCode()).build(); context().forward(key, purchasePattern); context().commit(); } }