uCosminexus Stream Data Platform - Application Framework Application Development Guide
This subsection explains the basic processing flow for using an RMI connection custom adaptor to receive query result data, based on an implementation example.
public class RMI_ReceiveSample {
public static void main(String[] args) {
try {
// 1. Connect to the SDP server.
SDPConnector con = SDPConnectorFactory.connect();
// 2. Connect to the output stream.
StreamOutput o = con.openStreamOutput("GROUP","QUERY1");
// 3. Receive tuples.
try {
while(true) {
ArrayList tupleList = o.getAll();
}
} catch (SDPClientEndOfStreamException e) {
System.out.println("Data reception completed");
} catch (SDPClientQueryGroupStateException e) {
System.out.println("Query group stopped");
}
// 4. Disconnect from the output stream.
o.close();
// 5. Disconnect from the SDP server.
con.close();
} catch (SDPClientException e) {
System.err.println(e.getMessage());
}
}
}
Explanation of the implementation details
The meaning of each process is explained below. The numbers correspond to the comment numbers in the implementation example.
SDPConnector con = SDPConnectorFactory.connect();
StreamOutput o = con.openStreamOutput("GROUP","QUERY1");ArrayList tupleList = o.getAll();
o.close();
con.close();
All Rights Reserved. Copyright (C) 2011, Hitachi, Ltd.