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

|
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 ) {
...
}
- MaxQueueLengthの値を設定します(long型)。
- MaxConsumersの値を設定します(long型)。
- MaxSuppliersの値を設定します(long型)。
- 上記3項目分のバッファ領域を獲得します。
- nameにMaxQueueLength、valueにany型で1の値を設定します。
- nameにMaxConsumers、valueにany型で2の値を設定します。
- nameにMaxSuppliers、valueにany型で3の値を設定します。
- 5〜7までのシーケンス型であるAdminPropertiesを作成します。
- イベントチャネルの生成時にAdminプロパティ項目を設定します。
All Rights Reserved, Copyright(C) 富士通株式会社 2005