Discussion:
Skip the remainder of a Feed Iterator?
(too old to reply)
bpevans
2021-04-09 01:07:46 UTC
Permalink
I have sequential feed connectors (ldif file connector, iterator) in an assembly line.

Once I find an entry in the file I'd like to exit that feed iterator completely and proceed directly into the next feed iterator.

What user function is appropriate to call for this behaviour, from within the getNextSuccessful hook.
Eddie Hartman
2021-04-10 22:31:18 UTC
Permalink
Post by bpevans
I have sequential feed connectors (ldif file connector, iterator) in an assembly line.
Once I find an entry in the file I'd like to exit that feed iterator completely and proceed directly into the next feed iterator.
What user function is appropriate to call for this behaviour, from within the getNextSuccessful hook.
I would suggest coding the Override GetNext Hook and handling it yourself. For example, this will only return the first 5 entries before signalling EOD:
---
// Lazy man
if (typeof _cnt == "undefined") {
_cnt = 0;
}

readEntry = thisConnector.connector.getNextEntry();

if (cnt++ > 5 || readEntry == null) {
result.setStatus(0); // signal End Of Data
} else {
work.merge(readEntry);
result.setStatus(1);
}
---
Hope this helps!

/e
Eddie Hartman
2021-04-10 22:34:38 UTC
Permalink
Or instead of the Connector interface method getNextEntry(), you can call the AssemblyLineComponent .getnext() function instead.

...
readEntry = thisConnector.getnext();
// https://www.stephen-swann.co.uk/javadoc/tdi7.2/com/ibm/di/server/AssemblyLineComponent.html#getnext()
...

That way you get Hooks, Input Map and Auto Reconnect/Connection Error functionality.

/e
Post by Eddie Hartman
Post by bpevans
I have sequential feed connectors (ldif file connector, iterator) in an assembly line.
Once I find an entry in the file I'd like to exit that feed iterator completely and proceed directly into the next feed iterator.
What user function is appropriate to call for this behaviour, from within the getNextSuccessful hook.
---
// Lazy man
if (typeof _cnt == "undefined") {
_cnt = 0;
}
readEntry = thisConnector.connector.getNextEntry();
if (cnt++ > 5 || readEntry == null) {
result.setStatus(0); // signal End Of Data
} else {
work.merge(readEntry);
result.setStatus(1);
}
---
Hope this helps!
/e
Loading...