use of io.siddhi.core.stream.input.source.AttributeMapping in project siddhi by wso2.
the class TestTrpSourceMapper method mapAndProcess.
@Override
protected void mapAndProcess(Object eventObject, InputEventHandler inputEventHandler) throws MappingFailedException, InterruptedException {
if (eventObject != null) {
if (eventObject instanceof Event) {
Event output = new Event(streamDefinition.getAttributeList().size());
for (AttributeMapping attributeMapping : attributeMappingList) {
output.getData()[attributeMapping.getPosition()] = ((Event) eventObject).getData(Integer.parseInt(attributeMapping.getMapping()));
}
inputEventHandler.sendEvent(output);
} else {
throw new MappingFailedException(Collections.singletonList(new ErroneousEvent(eventObject, "Event object must be either Event[], Event or Object[] " + "but found " + eventObject.getClass().getCanonicalName())));
}
}
}
Aggregations