- assigned_to: nobody --> dfbacon
The interface definition of a filter supports more than one data source, which means two feeds can be accepted and derived to a stream.
However, although I can create a filter and input two feeds as IDataSource[], it seems it always uses only the first feed to derive the stream.
I checked the code of Stream.class, and find code
public Stream(String name, IDataSource[] dataSource, Unit unit, EventType type) {
// FIXME: seems to only work with one Feed input, but interface allows multiple
this.streamMode = StreamMode.DERIVED_FROM_FEED;
this.timeConverter = dataSource[0].getTimeConverter();
if (!Filter.checkConsistency(dataSource)) {
Logging.errorln("Creation of stream with inconsistent time converters");
}
this.dataSources = dataSource;
this.operator = new Operator("Base");
this.operands = StreamOperand.EMPTY;
this.canonicalName = "Base(";
for (IDataSource source: dataSource) {
long id = source.getCanonicalId();
this.canonicalName += (id + ",");
}
this.canonicalName += name + ")";
this.eventType = type;
commonInit(name, dataSource, unit);
}
protected void derivedFromFeedRun() {
// FIXME: constructors seem to allow multiple Feeds from which to derive
IFeeder source = (IFeeder) dataSources[0];
while (true) {
TypedEvent e = source.getEvent(cursors[0]);
if (e != null) {
cursors[0]++;
addEvent(e);
lastSeenEvent = e;
modify();
} else if (source.isClosed()) {
if (cursors[0] >= source.numberOfEvents()) {
break;
} else {
Logging.errorln("missing event " + cursors[0] + " from feed");
break;
}
} else {
modifyCheck();
MiscUtils.milliSleep(100);
}
}
}
It only uses the first feed to derive a stream.
Can we derive a stream from two feeds?
Or are there any alternatives that can support the similar features in current TuningFork release?
Thanks!