In my spout I read data from a postgres table and emit each row test_data
field as a tuple to bolt. My table contains only 19 rows,so the spout
should emit only 19 tuples to bolt. But in storm UI it shows 180 tuples
emitted from spouts. How this is happened?

public void nextTuple() {
        Connection c = null;
           Statement stmt = null;
           try {
                 Class.forName("org.postgresql.Driver");
                 c =
DriverManager.getConnection("jdbc:postgresql://localhost:5432/my_db",
"postgres", "password");
                 c.setAutoCommit(false);
                 System.out.println("Opened database successfully");

                 stmt = c.createStatement();
                 ResultSet rs = stmt.executeQuery("SELECT test_data FROM
my_schema.load_test_table where process_status='waiting' ;");
                 while ( rs.next() ) {
                    String  geodata = rs.getString("test_data");

                    _collector.emit(new Values(geodata));

                 }
                 rs.close();
                 stmt.close();
                 c.close();
           } catch ( Exception e ) {
             System.err.println( e.getClass().getName()+": "+
e.getMessage() );
             System.exit(0);
           }
           System.out.println("Operation done successfully");
}



-- 
by

*R.RAMPRASAD*

Reply via email to