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

第5章 アプリケーションの開発(C言語)

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

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

イベントサービスの場合

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

  CORBA_ORB                   orb;
  CORBA_BOA                   boa; 
  CORBA_Repository            intf_rep; 
  CORBA_InterfaceDef          intf; 
  CORBA_ImplementationDef     impl; 
  CORBA_ReferenceData         refid; 
  CosEventComm_PushConsumer   my_object; 
  
  intf_rep = CORBA_ORB_resolve_initial_references(
         orb, CORBA_ORB_ObjectId_LightInterfaceRepository, &env ); 
  
  intf =  CORBA_Repository_lookup_id(
         _INTF_CosEventComm_PushConsumer, &env ); 
  
  refid._length = refid._maximum = 0; 
  refid._value  = NULL; 
  my_object = CORBA_BOA_create( boa, &refid, intf, impl, &env );

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

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

  CORBA_ORB                   orb;
  CORBA_BOA                   boa; 
  CORBA_Repository            intf_rep; 
  CORBA_InterfaceDef          intf; 
  CORBA_ImplementationDef     impl; 
  CORBA_ReferenceData         refid; 
  CosNotifyComm_PullConsumer   my_object; 
  
  intf_rep = CORBA_ORB_resolve_initial_references(
         orb, CORBA_ORB_ObjectId_LightInterfaceRepository, &env ); 
  
  intf =  CORBA_Repository_lookup_id(
         _INTF_CosEventComm_PullConsumer, &env ); 
  
  refid._length = refid._maximum = 0; 
  refid._value  = NULL; 
  my_object = CORBA_BOA_create( boa, &refid, intf, impl, &env );

 オブジェクトはCORBA_BOA_createで作成します。CORBA_BOA_createに指定するパラメタのインタフェース情報には自身が実装するインタフェースリポジトリ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


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

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