Interstage Application Server アプリケーション作成ガイド (イベントサービス編)
目次 索引 前ページ次ページ

第4章 アプリケーションの開発(各機能)> 4.1 イベントチャネル接続のアプリケーション開発> 4.1.1 ノーティフィケーションサービスのQoS機能の運用

4.1.1.2 Adminプロパティ項目の設定

 Adminプロパティ項目は、動的生成イベントチャネルに設定できます。
 動的生成チャネルのAdminプロパティ項目の設定は、CosNotifyChannelAdmin::EventChannelFactory::create_channel()を使ってイベントチャネルの生成時に、QoSPropertiesを設定します。QoSPropertiesはProperty構造体からなるシーケンス型です。C++プログラムでQoSPropertiesを作成し、イベントチャネルに対してAdminプロパティ項目の設定方法と処理の流れを以下に説明します。

[AdminPropertiesの作成例(C++の場合)]

    CORBA::Long    maxQueueLength  = 200;                                /* 1 */
    CORBA::Long    maxConsumers    = 100;                                /* 2 */
    CORBA::Long    maxSuppliers    = 20;                                 /* 3 */

    CosNotification::Property_var    *pProperty =
            CosNotification::PropertySeq::allocbuf( 3 );                 /* 4 */

    pProperty[0]->name = CORBA::string_dup( CosNotification::MaxQueueLength ); 
    pProperty[0]->value = new CORBA::Any(); 
    *(pProperty[0]->value) <<= maxQueueLength;                           /* 5 */

    pProperty[1]->name = CORBA::string_dup( CosNotification::MaxConsumers ); 
    pProperty[1]->value = new CORBA::Any(); 
    *(pProperty[1]->value) <<= maxConsumers;                             /* 6 */

    pProperty[2]->name = CORBA::string_dup( CosNotification::MaxSuppliers ); 
    pProperty[2]->value = new CORBA::Any(); 
    *(pProperty[2]->value) <<= maxSuppliers;                             /* 7 */

    CosNotification::AdminProperties * pAdmin =
                        new CosNotification::AdminProperties(
                            3, 3, pProperty, CORBA_TRUE );               /* 8 */

    try{
        ... 
        channel=factory->create_channel(*pQoS,*pAdmin,channelID, env );  /* 9 */
        ... 
    } catch( CORBA::Exception &e ) {
        ... 
    }
  1. MaxQueueLengthの値を設定します(long型)。
  2. MaxConsumersの値を設定します(long型)。
  3. MaxSuppliersの値を設定します(long型)。
  4. 上記3項目分のバッファ領域を獲得します。
  5. nameにMaxQueueLength、valueにany型で1の値を設定します。
  6. nameにMaxConsumers、valueにany型で2の値を設定します。
  7. nameにMaxSuppliers、valueにany型で3の値を設定します。
  8. 5〜7までのシーケンス型であるAdminPropertiesを作成します。
  9. イベントチャネルの生成時にAdminプロパティ項目を設定します。

目次 索引 前ページ次ページ

All Rights Reserved, Copyright(C) 富士通株式会社 2005