イベントチャネルに接続する際、自身のオブジェクトを登録します。このオブジェクトの生成方法(コンシューマのオブジェクトの作成例)を以下に示します。
イベントサービスの場合
[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 | _INTF_CosEventComm_PushSupplier | _INTF_CosEventComm_PullConsumer |
Mixed | _INTF_CosNotifyComm_StructuredPushSupplier | _INTF_CosNotifyComm_StructuredPullConsumer |