ページの先頭行へ戻る
Interstage Application Server アプリケーション作成ガイド(イベントサービス編)

6.6 コンシューマとサプライヤのオブジェクトリファレンスの獲得

  イベントチャネルに接続する際、自身のオブジェクトを登録します。このオブジェクトの生成方法(コンシューマのオブジェクトの作成例)を以下に示します。


イベントサービスの場合

[Pushモデルのコンシューマのオブジェクト]

CORBA::ORB_ptr                      orb;
CORBA::BOA_ptr                      boa;
CORBA::Repository_ptr               intf_rep;
CORBA::InterfaceDef_ptr             intf;
CORBA::ImplementationDef_ptr        impl;
CORBA::ReferenceData                refid;
CORBA::Object_ptr                   obj;
CosEventComm::PushConsumer          my_object;

obj = orb->resolve_initial_references(
        CORBA_ORB_ObjectId_LightInterfaceRepository, env );
intf_rep = CORBA::Repository::_narrow( obj );
CORBA::release( obj );

obj = LightIntf->lookup_id(
        _INTF_CosEventComm_PushConsumer, env );
intf = CORBA::InterfaceDef::_narrow( obj );
CORBA::release( obj );

obj = boa->create( refid, intf, impl, env );
my_object = CosEventComm::PushConsumer::_narrow( obj );
CORBA::release( obj );

ノーティフィケーションサービスの場合

[Mixedモデルのコンシューマのオブジェクト]

CORBA::ORB_ptr                      orb;
CORBA::BOA_ptr                      boa;
CORBA::Repository_ptr               intf_rep;
CORBA::InterfaceDef_ptr             intf;
CORBA::ImplementationDef_ptr        impl;
CORBA::ReferenceData                refid;
CORBA::Object_ptr                   obj;
CosNotifyComm::PullConsumer         my_object;

obj = orb->resolve_initial_references(
        CORBA_ORB_ObjectId_LightInterfaceRepository, env );
intf_rep = CORBA::Repository::_narrow( obj );
CORBA::release( obj );

obj = LightIntf->lookup_id(
        _INTF_CosEventComm_PullConsumer, env );
intf = CORBA::InterfaceDef::_narrow( obj );
CORBA::release( obj );

obj = boa->create( refid, intf, impl, env );
my_object = CosEventComm::PullConsumer::_narrow( obj );
CORBA::release( obj );

  オブジェクトは、CORBA::BOA::createで作成します。CORBA::BOA::createに指定するパラメタのインタフェースリポジトリIDには自身が実装するインタフェースリポジトリID(イベントサービスの場合は_INTF_CosEventComm_PushConsumer、ノーティフィケーションサービスの場合は_INTF_CosEventComm_PullConsumer)、インプリメンテーション情報には自身のインプリメンテーションリポジトリIDを指定します。
  各アプリケーションが実装するインタフェースを以下に示します。アプリケーションは、インタフェースリポジトリIDを、CORBA::Repository::lookup_idに以下のパラメタを指定して獲得します。


イベントサービスの場合

通信モデル

サプライヤ

コンシューマ

Push

_INTF_CosEventComm_PushSupplier

_INTF_CosEventComm_PushConsumer

Pull

_INTF_CosEventComm_PullSupplier

_INTF_CosEventComm_PullConsumer

Mixed

_INTF_CosEventComm_PushSupplier

_INTF_CosEventComm_PullConsumer


ノーティフィケーションサービスの場合

通信モデル

サプライヤ

コンシューマ

Mixed
(any)

_INTF_CosEventComm_PushSupplier

_INTF_CosEventComm_PullConsumer

Mixed
(StructuredEvent)

_INTF_CosNotifyComm_StructuredPushSupplier

_INTF_CosNotifyComm_StructuredPullConsumer