ストリームデータ処理基盤 uCosminexus Stream Data Platform - Application Framework アプリケーション開発ガイド
ここでは,RMI連携カスタムアダプターでストリームデータを送信する処理の基本的な流れについて,実装例を基に説明します。
public class RMI_SendSample {
public static void main(String[] args) {
try {
// 1. SDPサーバに接続
SDPConnector con = SDPConnectorFactory.connect();
// 2. 送信対象の入力ストリームに接続
StreamInput in = con.openStreamInput("GROUP","STREAM1");
// 3. タプルを送信
Object[] data=new Object[]{new Integer(1)};
StreamTuple tuple=new StreamTuple(data);
try {
in.put(tuple);
// 4. データ送信完了を通知
in.putEnd();
} catch (SDPClientQueryGroupStateException e) {
System.out.println("クエリグループ停止");
}
// 5. 入力ストリームとの接続を切断
in.close();
// 6. SDPサーバとの接続を切断
con.close();
} catch (SDPClientException e) {
System.err.println(e.getMessage());
}
}
}
それぞれの処理の意味について説明します。番号は実装例中のコメントの番号に対応しています。
SDPConnector con = SDPConnectorFactory.connect();
StreamInput in = con.openStreamInput("GROUP","STREAM1");in.put(tuple);
in.putEnd();
in.close();
con.close();
All Rights Reserved. Copyright (C) 2010, 2014, Hitachi, Ltd.