use of com.hortonworks.streamline.streams.StreamlineEvent in project streamline by hortonworks.
the class StreamlineEventImplTest method testPut.
@Test(expected = UnsupportedOperationException.class)
public void testPut() throws Exception {
Map<String, Object> map = new HashMap<>();
map.put("foo", "bar");
StreamlineEvent event = StreamlineEventImpl.builder().fieldsAndValues(map).build();
event.put("key", "val");
}
use of com.hortonworks.streamline.streams.StreamlineEvent in project streamline by hortonworks.
the class StreamlineEventImplTest method testClear.
@Test(expected = UnsupportedOperationException.class)
public void testClear() throws Exception {
Map<String, Object> map = new HashMap<>();
map.put("foo", "bar");
StreamlineEvent event = StreamlineEventImpl.builder().fieldsAndValues(map).build();
event.clear();
}
use of com.hortonworks.streamline.streams.StreamlineEvent in project streamline by hortonworks.
the class WindowRulesBolt method execute.
/**
* Process the tuple window and optionally emit new tuples based on the tuples in the input window.
*
* @param inputWindow
*/
@Override
public void execute(TupleWindow inputWindow) {
++windowId;
LOG.debug("Window activated, window id {}, number of tuples in window {}", windowId, inputWindow.get().size());
Map<String, Tuple> eventIdToTupleMap = new HashMap<>();
try {
StreamlineEvent event;
for (Tuple input : inputWindow.get()) {
if ((event = getStreamlineEventFromTuple(input)) != null) {
LOG.debug("++++++++ Executing tuple [{}] which contains StreamlineEvent [{}]", input, event);
eventIdToTupleMap.put(event.getId(), input);
processAndEmit(event, eventIdToTupleMap);
}
}
// force evaluation of the last group by
processAndEmit(GROUP_BY_TRIGGER_EVENT, eventIdToTupleMap);
// current group is processed and result emitted
eventIdToTupleMap.clear();
} catch (Exception e) {
collector.reportError(e);
LOG.error("", e);
}
}
use of com.hortonworks.streamline.streams.StreamlineEvent in project streamline by hortonworks.
the class WindowRulesBolt method getDataSourceIds.
private List<String> getDataSourceIds(Collection<Tuple> tuples) {
Set<String> res = new HashSet<>();
StreamlineEvent event;
for (Tuple tuple : tuples) {
if ((event = getStreamlineEventFromTuple(tuple)) != null) {
res.add(event.getDataSourceId());
}
}
return new ArrayList<>(res);
}
use of com.hortonworks.streamline.streams.StreamlineEvent in project streamline by hortonworks.
the class WindowRulesBolt method getEventIds.
private List<String> getEventIds(Collection<Tuple> tuples) {
Set<String> res = new HashSet<>();
StreamlineEvent event;
for (Tuple tuple : tuples) {
if ((event = getStreamlineEventFromTuple(tuple)) != null) {
res.add(event.getId());
}
}
return new ArrayList<>(res);
}
Aggregations