THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
Table of Contents |
---|
...
Append
Class AppendOutputStrategy
...
OutputStrategies.append(
EpProperties.timestampProperty(
"key or runtime?"
)
)
...
custom
Class CustomOutputStrategy
...
declareModel() {
...
OutputStrategies.custom(true))
...
}
public void onEvent(Event event, SpOutputCollector spOutputCollector) {
HashMap lastEvents.put(
event.getSourceInfo().getSelectorPrefix(),
event
);
if (lastEvents.size() == 2) {
spOutputCollector.collect(
buildOutEvent(
event.getSourceInfo().getSelectorPrefix()
)
);
}
}
...
customTransformation
Class CustomTransformOutputStrategy
...
declareModel() {
...
OutputStrategies.customTransformation()
...
}
public void onEvent(Event event, SpOutputCollector spOutputCollector) {
Event resultEvent = SomeClass.addLabel(
event,
labelName,
value,
this.statements,
log
);
event.collect(resultEvent);
}
...
Fixed
Class FixedOutputStrategy
...
OutputStrategies.fixed(
EpProperties.timestampProperty(TIMESTAMP_FIELD),
EpProperties.longEp(
Labels.withId(START_TIME_FIELD),
START_TIME_FIELD,
SO.DATE_TIME),
EpProperties.longEp(
Labels.withId(END_TIME_FIELD),
END_TIME_FIELD,
SO.DATE_TIME),
EpProperties.longEp(
Labels.withId(DURATION_FIELD),
DURATION_FIELD,
SO.NUMBER),
EpProperties.longEp(
Labels.withId(EVENT_COUNT_FIELD),
EVENT_COUNT_FIELD,
SO.NUMBER),
EpProperties.doubleEp(
Labels.withId(THROUGHPUT_FIELD),
THROUGHPUT_FIELD,
SO.NUMBER)
)
)
...
Keep
KeepOutputStrategy
Description
...
declareModel() {
...
OutputStrategies.keep()
...
}
public void onEvent(Event event, SpOutputCollector spOutputCollector) {
Boolean satisfiesFilter = false;
...
satisfiesFilter = (Math.abs(value - threshold) < 0.000001);
...
if (satisfiesFilter) {
spOutputCollector.collect(event);
}
}
...
List
Class ListOutputStrategy
Description
...
declareModel() {
...
OutputStrategies.userDefined())
...
}
public void onEvent(Event event, SpOutputCollector outputCollector)
// create new event with input event's source info and schema info.
Event outEvent = new Event(
new HashMap<>(),
event.getSourceInfo(),
event.getSchemaInfo()
);
try {
final Map<String, Object> eventData = event.getRaw();
Object result = function.execute(ProxyObject.fromMap(eventData));
Map<String, Object> resultEvent = ((Value) result).as(java.util.Map.class);
if (resultEvent != null) {
resultEvent.forEach(outEvent::addField);
outputCollector.collect(outEvent);
}
...
Transform
Class TransformOutputStrategy
...