[
https://issues.apache.org/jira/browse/EDGENT-308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15796012#comment-15796012
]
Dale LaBossiere commented on EDGENT-308:
----------------------------------------
Rui, regarding _Currently, our requirement is to return one line in the
current file content every <poll> unit (if users enable the <poll> feature).
Otherwise, the default behavior is return all lines in file without any
interval._
[PlumbingStreams|https://edgent.incubator.apache.org/javadoc/latest/org/apache/edgent/topology/plumbing/PlumbingStreams.html]
has {{blockingThrottle()}} and {{blockingDelay()}} to throttle/delay a stream.
e.g.,
{quote}
TStream<String> pathnames = topology.strings("/etc/passwd");
TStream<String> lines = FileStreams.textFileReader(pathnames);
TStream<String> throttledLines = PlumbingStreams.blockingThrottle(lines, 1,
TimeUnit.SECONDS);
throttledLines.print(); // ends up printing 1 line every second
{quote}
I'm going to close this issue. Please reopen if that doesn't address your
question.
> Is it possible to use poll() with FileStreams together
> ------------------------------------------------------
>
> Key: EDGENT-308
> URL: https://issues.apache.org/jira/browse/EDGENT-308
> Project: Edgent
> Issue Type: New Feature
> Components: Connectors
> Reporter: Rui Shen
>
> My requirement is to load data from a file and polling with a specific
> frequency (say every 1 second).
> I found Topology.poll() can do this, but it requires a Supplier parameter and
> the get method is called periodically. With this way, I have to read the file
> content myself and create a Iterable instance, then a Supplier.
> I want to use FileStreams.textFileReader() to handle the file reading. The
> problem is how to use it with Topology.poll() together? I could not find a
> way to do this.
> Is there any way to do this? Or connectors does not support "polling" at all?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)