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

第4章 アプリケーションの開発(各機能)> 4.2 イベント通信のアプリケーション開発

4.2.4 ノーティフィケーションサービスへのアプリケーション変更

 イベントサービスのアプリケーションをノーティフィケーションサービスのアプリケーションに変更するには、使用するインタフェースを変更する必要があります。各サービスのインタフェースの対応を以下の表にアプリケーションの処理に沿って示します。

  1. イベントチャネル管理オブジェクトのオブジェクトリファレンスを獲得
  2. イベントチャネルのオブジェクトリファレンスを獲得
  3. イベントチャネルと接続
  4. イベントチャネルにイベントデータを送信/受信
  5. イベントチャネルと切断
  6. イベントファクトリによるイベントチャネルの生成

 なお、ノーティフィケーションサービス固有(QoS機能)のインタフェースは、新規に作り込む必要があります。インタフェースおよび使用方法については、以降の各開発言語のノーティフィケーションサービスインタフェース(開発手順の節内)、および“QoSプロパティ項目の設定”を参照してください。

項番

イベントサービスのインタフェース

ノーティフィケーションサービスのインタフェース

any型

StructuredEvent型

any型

1

CosEventChannelAdmin_
 EventChannel_for_suppliers

CosNotifyChannelAdmin_EventChannel__get_default_
 supplier_admin

CosEventChannelAdmin_
 EventChannel_for_consumers

CosNotifyChannelAdmin_EventChannel__get_default_
 consumer_admin

2

CosEventChannelAdmin_
 SupplierAdmin_obtain_push_
 consumer

CosNotifyChannelAdmin_SupplierAdmin_obtain_
 notification_push_consumer

CosEventChannelAdmin_
 ConsumerAdmin_obtain_pull_
 supplier

CosNotifyChannelAdmin_ConsumerAdmin_obtain_
 notification_pull_supplier

3

CosEventChannelAdmin_
 ProxyPushConsumer_connect_
 push_supplier

CosNotifyChannelAdmin_
 StructuredProxyPushConsumer_
 connect_structured_
 push_supplier

CosNotifyChannelAdmin_
 ProxyPushConsumer_
 connect_any_
 push_supplier

CosEventChannelAdmin_
 ProxyPullSupplier_connect_
 pull_consumer

CosNotifyChannelAdmin_
 StructuredProxyPullSupplier_
 connect_structured_
 pull_consumer

CosNotifyChannelAdmin_
 ProxyPullSupplier_
 connect_any_
 pull_consumer

4

CosEventComm_PushConsumer_push

CosEventChannelAdmin_
 ProxyPushConsumer_push

CosNotifyComm_
 StructuredPushConsumer_
 push_structured_event

CosNotifyChannelAdmin_
 StructuredProxyPushConsumer_
 push_structured_event

CosNotifyChannelAdmin_
 ProxyPushConsumer_push

CosEventComm_PullSupplier_pull

CosEventChannelAdmin_
 ProxyPullSupplier_pull

CosNotifyComm_
 StructuredPullSupplier_
 pull_structured_event

CosNotifyChannelAdmin_
 StructuredProxyPullSupplier_
 pull_structured_event

CosNotifyChannelAdmin_
 ProxyPullSupplier_pull

CosEventComm_PullSupplier_try_
 pull

CosEventChannelAdmin_
 ProxyPullSupplier_try_pull

CosNotifyComm_
 StructuredPullSupplier_
 try_pull_structured_event

CosNotifyChannelAdmin_
 StructuredProxyPullSupplier_
 try_pull_structured_event

CosNotifyChannelAdmin_
 ProxyPullSupplier_try_
 pull

5

CosEventComm_PushConsumer_
 disconnect_push_consumer

CosEventChannelAdmin_
 ProxyPushConsumer_disconnect_
 push_consumer

CosNotifyComm_
 StructuredPushConsumer_
 disconnect_structured_
 push_consumer

CosNotifyChannelAdmin_
 StructuredProxyPushConsumer_
 disconnect_structured_
 push_consumer

イベントサービスのイン
タフェース使用可能

CosEventComm_PullSupplier_
 disconnect_pull_supplier

CosEventChannelAdmin_
 ProxyPullSupplier_disconnect_
 pull_supplier

CosNotifyComm_
 StructuredPullSupplier_
 disconnect_structured_
 pull_supplier

CosNotifyChannelAdmin_
 StructuredProxyPullSupplier_
 disconnect_structured_
 pull_supplier

イベントサービスのイン
タフェース使用可能

6

EventFactory_create

CosNotifyChannelAdmin_EventChannelFactory_create_channel

ノーティフィケーションサービスのイベントチャネルとの接続

 イベントサービスのアプリケーションで、ノーティフィケーションサービスのイベントチャネルと接続する場合には、アプリケーションの一部を変更し、翻訳する必要があります(運用形態については、“イベントチャネルとアプリケーションとの接続互換”を参照してください)。

 イベントチャネルのオブジェクトリファレンスの獲得処理で、ノーティフィケーションサービスのイベントチャネルのオブジェクトリファレンスを獲得するため、オブジェクトリファレンスのデータ型を変更します。
詳細については、本章の各開発言語の“イベントチャネルのオブジェクトリファレンスの獲得”を参照してください。
 以下にサンプルプログラムでのアプリケーションの変更例を示します。

◆C言語の場合

 インクルードファイルの指定、およびイベントチャネルのオブジェクトリファレンスの型を変更します。

[インクルードファイルの指定]
  #include    "EventService.h"
   ↓
  #include    "NotificationService.h"
[イベントチャネルのオブジェクトリファレンスの型の変更]
  CosEventChannelAdmin_EventChannel      channel;
   ↓
  CosNotifyChannelAdmin_EventChannel     channel;

◆C++言語の場合

 インクルードファイルの指定、およびイベントチャネルのオブジェクトリファレンスの型を変更します。

[インクルードファイルの指定]
  #include    "EventService_cplus.h"
   ↓
  #include    "NotificationService_cplus.h"
[イベントチャネルのオブジェクトリファレンスの型の変更]
  CosEventChannelAdmin::EventChannel_ptr   channel;
   ↓
  CosNotifyChannelAdmin::EventChannel_ptr  channel;

  channel = CosEventChannelAdmin::EventChannel::_narrow( obj );
   ↓
  channel = CosNotifyChannelAdmin::EventChannel::_narrow( obj );

◆Java言語の場合

 イベントチャネルのオブジェクトリファレンスの型を変更します。

[イベントチャネルのオブジェクトリファレンスの型の変更]
  EventChannel        channel;
   ↓
  org.omg.CosNotifyChannelAdmin.EventChannel  channel;

  channel = EventChannelHelper.narrow( nameobj );
   ↓
  channel = org.omg.CosNotifyChannelAdmin.EventChannelHelper.narrow( nameobj );

 また、コンシューマアプリケーションで、StructuredEvent型のデータを受信する場合は、any型のメンバとして、StructuredEvent型のメッセージ構造が格納されます。変換方式については、“StructuredEvent型からany型への変換”を参照してください。
 なお、C言語およびC++言語のアプリケーションでは、ノーティフィケーションサービスのスタブライブラリを結合する必要があります。


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

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