ストリームデータ処理基盤 uCosminexus Stream Data Platform - Application Framework システム構築・運用ガイド
棒グラフ,円グラフ,散布図または表で,ストリームデータの集計・分析結果の最新のデータをダッシュボードに表示する場合,クエリ定義ファイルでのrstreamの最新の計算結果だけを表示できるようにします。
ここでは,最新のデータを表示する場合の出力アダプター定義の記述例を示したあとに,記述例の内容を説明します。
<adp:OutputAdaptorDefinition name="OutputAdaptor1" charCode="MS932" lineFeed="CR_LF"> <!-- 受信用CB定義 --> <cb:ReceiveCBDefinition class="jp.co.Hitachi.soft.sdp.adaptor.callback.sendreceive.ReceiveCBImpl" name="receiver"> <cb:streamInfo name="QUERY" querygroup="Inprocess_QueryGroupTest"/> </cb:ReceiveCBDefinition> <!-- データ編集用CB定義 --> <cb:DataEditCBDefinition class="jp.co.Hitachi.soft.sdp.adaptor.callback.dataedit.mapping.OutputMappingCBImpl" name="editor1"> <!-- マッピング定義 --> <map:MappingDefinition ioType="OUTPUT"> <map:source> <map:streams> <map:stream name="QUERY" querygroup="Inprocess_QueryGroupTest"> <map:column name="sendip" type="STRING"/> <map:column name="subtime" type="LONG"/> </map:stream> </map:streams> </map:source> <map:target/> <map:intermediate> <map:mappings source="QUERY" querygroup="Inprocess_QueryGroupTest" target="RECORD1"> <map:map source="sendip" target="SEND_IP"/> <map:map source="subtime" target="SUBTIME"/> </map:mappings> </map:intermediate> </map:MappingDefinition> </cb:DataEditCBDefinition> <!-- データ編集用CB定義 --> <cb:DataEditCBDefinition class="jp.co.Hitachi.soft.sdp.adaptor.callback.dataedit.mapping.InputMappingCBImpl" name="editor2"> <!-- マッピング定義 --> <map:MappingDefinition ioType="OUTPUT"> <map:source/> <map:target> <map:records> <map:record name="RECORD2" > <map:field name="SEND_IP" type="STRING"/> <map:field name="SUBTIME" type="LONG"/> <map:field name="GET_TUPLE_TIME" type="TIMESTAMP"/> </map:record> </map:records> </map:target> <map:intermediate> <map:mappings source="RECORD1" target="RECORD2"> <map:map source="SEND_IP" target="SEND_IP"/> <map:map source="SUBTIME" target="SUBTIME"/> <map:map function="getTupleTime" target="GET_TUPLE_TIME"/> </map:mappings> </map:intermediate> </map:MappingDefinition> </cb:DataEditCBDefinition> <cb:OutputCBDefinition class="jp.co.Hitachi.soft.sdp.adaptor.callback.io.dashboard.DashboardOutputCBImpl" name="outputer"> <!-- ダッシュボード出力コネクタ定義 --> <docon:DashboardOutputConnectorDefinition Record="RECORD2"> <docon:RecordHoldTime DateReference="LAST_UPDATE" RecordTime="0" DateFieldPosition="3" /> <docon:DataProcessingDefinition Name="HistoryRecorder"> <docon:HistoryRecorder/> </docon:DataProcessingDefinition> </docon:DashboardOutputConnectorDefinition> </cb:OutputCBDefinition> </adp:OutputAdaptorDefinition>
この記述例では,ストリームデータの集計・分析結果のデータを出力アダプター「OutputAdaptor1」でダッシュボードへ出力します。
出力アダプター「OutputAdaptor1」では,次の表に示す処理を実施します。なお,括弧内は,アダプター構成定義ファイル内での定義名です。
コールバックの種類 | コールバックでの処理 |
---|---|
受信用コールバック(受信用CB定義) | タプル受信(出力ストリーム定義) |
編集用コールバック(編集用CB定義) | レコードとストリーム間のマッピング(マッピング定義) |
レコード間のマッピング(マッピング定義) | |
フォーマット変換(フォーマット変換定義) | |
送信用コールバック(送信用CB定義) | ダッシュボードへの出力(ダッシュボード出力コネクター定義) |
出力アダプター「OutputAdaptor1」の各定義での定義内容を次に示します。
register stream STREAM(sendip VARCHAR(15),receiveip VARCHAR(15),sendport INT,receiveport INT,uri VARCHAR(255),subtime BIGINT,times TIMESTAMP(9)); register query QUERY rstream( select STREAM.sendip as sendip, max(STREAM.subtime) as subtime from STREAM[RANGE 1 MINUTE] group by STREAM.sendip);
All Rights Reserved. Copyright (C) 2010, 2014, Hitachi, Ltd.