edgent-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rui Shen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (EDGENT-308) Is it possible to use poll() with FileStreams together
Date Thu, 10 Nov 2016 08:27:58 GMT

    [ https://issues.apache.org/jira/browse/EDGENT-308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15653421#comment-15653421
] 

Rui Shen commented on EDGENT-308:
---------------------------------

Hi Dale,

I sent the following email to dev@apache.edgent.org but got "delivery failure report". Anything
wrong, any other channels that I can raise my questions? 

=======================================================================================
Hi Edgent team,
 
Now I am trying to run a SELECT statement without parameters (e.g "select id,name,age from
person") using JdbcStreams. But I found there is no straightforward way to do this. Looks
like the APIs of JdbcStreams is designed for only prepared statement with parameters .
 
However, I found a workaround to make this - always create a TStream with one tuple but in
the ParameterSetter, does nothing. Although this works, it looks uncomfortable. Are you going
to support this in the future release? 
 
    Topology t = this.newTopology("testSelect_WithParameters");
    JdbcStreams db=new JdbcStreams(ds,(ds)=>{ds.getConnection()});
    TStream<String> stream=t.collection(Arrays.asList(new String[]{"dummy"})); // to
execute the sql, always needs to create a TStream containing one tuple.
    ParameterSetter<String> paramSetter=(s,stmt)->{};  //do nothing here
    ResultsHandler<Object[], JsonObject> rh = (tuple, rs, exc, consumer) -> {};
    db.executeStatement(stream, "select id,name,age from person", paramSetter,rh);

> 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)

Mime
View raw message