イベントサービスのアプリケーションをノーティフィケーションサービスのアプリケーションに変更するには、使用するインタフェースを変更する必要があります。
各サービスのインタフェースの対応を、アプリケーションの処理に沿って以下の表に示します。
イベントチャネル管理オブジェクトのオブジェクトリファレンスを獲得
イベントチャネルのオブジェクトリファレンスを獲得
イベントチャネルと接続
イベントチャネルにイベントデータを送信/受信
イベントチャネルと切断
イベントファクトリによるイベントチャネルの生成
なお、ノーティフィケーションサービス固有(QoS機能)のインタフェースは、新規に作り込む必要があります。インタフェースおよび使用方法については、以降の各開発言語のノーティフィケーションサービスインタフェース(開発手順の節内)、および「4.4.1 QoSプロパティ項目の設定」を参照してください。
項番 | イベントサービスのインタフェース | ノーティフィケーションサービスのインタフェース | |
---|---|---|---|
1 | CosEventChannelAdmin_EventChannel_for_suppliers | StructuredEvent | CosNotifyChannelAdmin_EventChannel__get_default_supplier_admin |
any | |||
CosEventChannelAdmin_EventChannel_for_consumers | StructuredEvent | CosNotifyChannelAdmin_EventChannel__get_default_consumer_admin | |
any | |||
2 | CosEventChannelAdmin_SupplierAdmin_obtain_push_consumer | StructuredEvent | CosNotifyChannelAdmin_SupplierAdmin_obtain_notification_push_consumer |
any | |||
CosEventChannelAdmin_ConsumerAdmin_obtain_pull_supplier | StructuredEvent | CosNotifyChannelAdmin_ConsumerAdmin_obtain_notification_pull_supplier | |
any | |||
3 | CosEventChannelAdmin_ProxyPushConsumer_connect_push_supplier | StructuredEvent | CosNotifyChannelAdmin_StructuredProxyPushConsumer_connect_structured_push_supplier |
any | CosNotifyChannelAdmin_ProxyPushConsumer_connect_any_push_supplier | ||
CosEventChannelAdmin_ProxyPullSupplier_connect_pull_consumer | StructuredEvent | CosNotifyChannelAdmin_StructuredProxyPullSupplier_connect_structured_pull_consumer | |
any | CosNotifyChannelAdmin_ProxyPullSupplier_connect_any_pull_consumer | ||
4 | CosEventComm_PushConsumer_push CosEventChannelAdmin_ProxyPushConsumer_push | StructuredEvent | CosNotifyComm_StructuredPushConsumer_push_structured_event CosNotifyChannelAdmin_StructuredProxyPushConsumer_push_structured_event |
any | CosNotifyChannelAdmin_ProxyPushConsumer_push | ||
CosEventComm_PullSupplier_pull CosEventChannelAdmin_ProxyPullSupplier_pull | StructuredEvent | CosNotifyComm_StructuredPullSupplier_pull_structured_event CosNotifyChannelAdmin_StructuredProxyPullSupplier_pull_structured_event | |
any | CosNotifyChannelAdmin_ProxyPullSupplier_pull | ||
CosEventComm_PullSupplier_try_pull CosEventChannelAdmin_ProxyPullSupplier_try_pull | StructuredEvent | CosNotifyComm_StructuredPullSupplier_try_pull_structured_event CosNotifyChannelAdmin_StructuredProxyPullSupplier_try_pull_structured_event | |
any | CosNotifyChannelAdmin_ProxyPullSupplier_try_pull | ||
5 | CosEventComm_PushConsumer_disconnect_push_consumer CosEventChannelAdmin_ProxyPushConsumer_disconnect_push_consumer | StructuredEvent | CosNotifyComm_StructuredPushConsumer_disconnect_structured_push_consumer CosNotifyChannelAdmin_StructuredProxyPushConsumer_disconnect_structured_push_consumer |
any | イベントサービスのインタフェース使用可能 | ||
CosEventComm_PullSupplier_disconnect_pull_supplier CosEventChannelAdmin_ProxyPullSupplier_disconnect_pull_supplier | StructuredEvent | CosNotifyComm_StructuredPullSupplier_disconnect_structured_pull_supplier CosNotifyChannelAdmin_StructuredProxyPullSupplier_disconnect_structured_pull_supplier | |
any | イベントサービスのインタフェース使用可能 | ||
6 | EventFactory_create | StructuredEvent | CosNotifyChannelAdmin_EventChannelFactory_create_channel |
any |
■ノーティフィケーションサービスのイベントチャネルとの接続
イベントサービスのアプリケーションで、ノーティフィケーションサービスのイベントチャネルと接続する場合は、アプリケーションの一部を変更し、翻訳する必要があります。運用形態については、「1.8 イベントチャネルとアプリケーションとの接続互換」を参照してください。
イベントチャネルのオブジェクトリファレンスの獲得処理で、ノーティフィケーションサービスのイベントチャネルのオブジェクトリファレンスを獲得するため、オブジェクトリファレンスのデータ型を変更します。詳細については、本章の各開発言語の「イベントチャネルのオブジェクトリファレンスの獲得」を参照してください。
サンプルプログラムでのアプリケーションの変更例を以下に示します。
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 );
COBOLの場合
イベントチャネルのオブジェクトリファレンスの型を変更します。
01 COPY OBJECT IN CORBA REPLACING CORBA-OBJECT BY EVENTCHOBJ.
<変更後>
01 COPY NOTIFYEVENTCHANNEL IN COSEVENTCOMM REPLACING COSNOTIFYCHANNELADMIN-EVENTCHA BY EVENTCHOBJ;
また、コンシューマアプリケーションで、StructuredEvent型のデータを受信する場合は、any型のメンバとして、StructuredEvent型のメッセージ構造が格納されます。変換方式については、「1.5.4 StructuredEvent型からany型への変換」を参照してください。
なお、C言語、C++言語、およびCOBOLアプリケーションでは、ノーティフィケーションサービスのスタブライブラリを結合する必要があります。