public interface NetricsRecSrc extends NetricsBaseRecSrc
This interface defines how sets of single table records are passed in the API. When a constructor or method needs a set of simple records it expects an object that implements this interface. By creating a class that implements this interface the user can feed records from any source directly into the API. The API can then stream these records into the engine. For example an implementation of NetricsRecSrc that takes in a JDBC ResultSet and feeds out the records from the result set in the getNext method would allow records to be streamed from any JDBC enabled DBMS into a TIBCO Patterns Table. If a server side cursor was used any number of records could be streamed without incurring a large memory overhead in the Java application. E.g.:
class JDBCRecSrc implements NetricsRecSrc {
...
public JDBCRecSrc(ResultSet rs) { ... }
...
}
...
NetricsConMgr ncm = new NetricsConMgr() ;
NetricsServerInterface nsi = ncm.newConnection() ;
Connection con = ConnectionFactory.getNewConnection() ;
con.setAutoCommit(false) ;
Statement st = con.createStatement() ;
st.setFetchSize(50) ;
ResultSet rs = st.executeQuery("SELECT * FROM dbmstable") ;
JDBCRecSrc jdbcrecs = new JDBCRecSrc(rs) ;
NetricsTableStats tblstat = nsi.recadd("patternstable",jdbcrecs,true);
rs.close() ;
st.close() ;
...
If the JDBC driver supports server side cursors this will add all
of the records in dbmstable to the table patternstable
on the TIBCO Patterns Engine, holding no more than 50
records at a time on the client. Of course there may be practical
reasons, such as error recovery, why streaming a large table in a
single command may be undesireable, but this shows the power of
taking advantage of the NetricsTableRecSrc interface.
The Java interface comes with two predefined implementations of the NetricsRecSrc interface: NetricsArrayRecSrc is a simple array of records, NetricsCSVRecSrc reads records from a standard format CSV file.
NetricsArrayRecSrc,
NetricsCSVRecSrc,
NetricsBaseRecSrc| Modifier and Type | Method and Description |
|---|---|
NetricsRecord |
getNext()
Returns the next record.
|
hasNext, resetNetricsRecord getNext() throws NetricsRecSrcException
getNext in interface NetricsBaseRecSrcNetricsRecSrcException - if an error occurs, or if there
are no more records.