ストリームデータ処理基盤 uCosminexus Stream Data Platform - Application Framework アプリケーション開発ガイド
ここでは,RMI連携カスタムアダプターでのクエリ結果データの受信処理の基本的な流れについて,実装例を基に説明します。
public class RMI_ReceiveSample {
public static void main(String[] args) {
try {
// 1. SDPサーバに接続
SDPConnector con = SDPConnectorFactory.connect();
// 2. 出力ストリームに接続
StreamOutput o = con.openStreamOutput("GROUP","QUERY1");
// 3. タプルを受信
try {
while(true) {
ArrayList tupleList = o.getAll();
}
} catch (SDPClientEndOfStreamException e) {
System.out.println("データ受信完了");
} catch (SDPClientQueryGroupStateException e) {
System.out.println("クエリグループ停止");
}
// 4. 出力ストリームとの接続を切断
o.close();
// 5. SDPサーバとの接続を切断
con.close();
} catch (SDPClientException e) {
System.err.println(e.getMessage());
}
}
}
それぞれの処理の意味について説明します。番号は実装例中のコメントの番号に対応しています。
SDPConnector con = SDPConnectorFactory.connect();
StreamOutput o = con.openStreamOutput("GROUP","QUERY1");ArrayList tupleList = o.getAll();
o.close();
con.close();
All Rights Reserved. Copyright (C) 2010, 2014, Hitachi, Ltd.