ストリームデータ処理基盤 uCosminexus Stream Data Platform - Application Framework システム構築・運用ガイド

[目次][索引][前へ][次へ]

12.4.1 出力アダプター定義(最新のデータの表示)

棒グラフ,円グラフ,散布図または表で,ストリームデータの集計・分析結果の最新のデータをダッシュボードに表示する場合,クエリ定義ファイルでのrstreamの最新の計算結果だけを表示できるようにします。

ここでは,最新のデータを表示する場合の出力アダプター定義の記述例を示したあとに,記述例の内容を説明します。

<この項の構成>
(1) 記述例
(2) 記述例の内容

(1) 記述例

 
<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>

(2) 記述例の内容

この記述例では,ストリームデータの集計・分析結果のデータを出力アダプター「OutputAdaptor1」でダッシュボードへ出力します。

出力アダプター「OutputAdaptor1」では,次の表に示す処理を実施します。なお,括弧内は,アダプター構成定義ファイル内での定義名です。

コールバックの種類 コールバックでの処理
受信用コールバック(受信用CB定義) タプル受信(出力ストリーム定義)
編集用コールバック(編集用CB定義) レコードとストリーム間のマッピング(マッピング定義)
レコード間のマッピング(マッピング定義)
フォーマット変換(フォーマット変換定義)
送信用コールバック(送信用CB定義) ダッシュボードへの出力(ダッシュボード出力コネクター定義)

出力アダプター「OutputAdaptor1」の各定義での定義内容を次に示します。