uCosminexus Stream Data Platform - Application Framework Application Development Guide
This subsection explains the basic processing flow for using an RMI connection custom adaptor to send stream data, based on an implementation example.
public class RMI_SendSample {
public static void main(String[] args) {
try {
// 1. Connect to the SDP server.
SDPConnector con = SDPConnectorFactory.connect();
// 2. Connect to the input stream to be sent.
StreamInput in = con.openStreamInput("GROUP","STREAM1");
// 3. Send tuples.
Object[] data=new Object[]{new Integer(1)};
StreamTuple tuple=new StreamTuple(data);
try {
in.put(tuple);
// 4. Send data transmission completion notification.
in.putEnd();
} catch (SDPClientQueryGroupStateException e) {
System.out.println("Query group stopped");
}
// 5. Disconnect from the input stream.
in.close();
// 6. 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();
StreamInput in = con.openStreamInput("GROUP","STREAM1");in.put(tuple);
in.putEnd();
in.close();
con.close();
All Rights Reserved. Copyright (C) 2011, Hitachi, Ltd.