This subsection explains the basic processing flow for using an in-process connection custom adaptor to send stream data, based on an implementation example.
Implementation example
public class Inpro_SendSample implements StreamInprocessUP {
// Implement StreamInprocessUP.
public void execute(SDPConnector con) {
// 1. Connect to the input stream to be sent.
StreamInput in = con.openStreamOutput("GROUP","STREAM1");
// 2. Send tuples.
Object[] data=new Object[]{new Integer(1)};
StreamTuple tuple=new StreamTuple(data);
in.put(tuple);
// 3. Send data transmission completion notification.
in.putEnd();
// 4. Disconnect from the input stream.
in.close();
// 5. Disconnect from the SDP server.
con.close();
}
}
Explanation of the implementation details
The meaning of each process is explained below. The numbers correspond to the comment numbers in the implementation example.
StreamInput in = con.openStreamInput("GROUP","STREAM1");
in.put(tuple);
in.putEnd();
in.close();
con.close();