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

5.8 グローバルトランザクション

[C言語によるMixedモデルのグローバルトランザクションのサプライヤ]

CORBA_Boolean func() {
    ...
    supplier = CosNotifyChannelAdmin_EventChannel_get_default_supplier_admin (
                     object, &env );                              /* 1 */
    proxy_push = CosNotifyChannelAdmin_SupplierAdmin_obtain_notification_push_consumer(
                     supplier,ctype,&proxy_id, &env);             /* 2 */
    CosNotifyChannelAdmin_StructuredProxyPushConsumer_connect_structured_push_supplier(
                     proxy_push, CORBA_OBJECT_NIL, &env);         /* 3 */
    CosTransactions_Current_begin(Current, &env );                /* 4 */
    CosNotifyChannelAdmin_StructuredProxyPushConsumer_push_structured_event(
                     proxy_push, data, &env );                    /* 5 */
    CosTransactions_Current_commit( Current, CORBA_TRUE, &env );  /* 6 */
    CosNotifyChannelAdmin_StructuredProxyPushConsumer_disconnect_structured_push_consumer(
                     proxy_push, &env );                          /* 7 */
    ... 
}

  1. イベントチャネル管理オブジェクトのオブジェクトリファレンスを獲得します。

  2. イベントチャネルのオブジェクトリファレンスを獲得します。

  3. イベントチャネルと接続します。

  4. グローバルトランザクションを開始します。

  5. イベントチャネルにイベントデータを送信します。

  6. グローバルトランザクションを完了します。

  7. イベントチャネルと切断します。


  接続するイベントチャネルのオブジェクトリファレンスを不揮発媒体に保存している場合、1, 2, 3, 7の処理は不要となります。


[C言語によるMixedモデルのグローバルトランザクションのコンシューマ]

CORBA_Boolean func() {
    ... 
    consumer = CosNotifyChannelAdmin_EventChannel_get_default_consumer_admin(
                         object, &env );                               /* 1 */
    proxy_pull = CosNotifyChannelAdmin_ConsumerAdmin_obtain_notification_pull_supplier(
                         consumer,ctype,&proxyID,&env );               /* 2 */
    CosNotifyChannelAdmin_StructuredProxyPullSupplier_connect_structured_pull_consumer(
                         proxy_pull, CORBA_OBJECT_NIL,&proxyID,&env);  /* 3 */
    CosTransactions_Current_begin(Current, &env );                     /* 4 */
    data = CosNotifyChannelAdmin_StructuredProxyPullSupplier_pull_structured_event (
                         proxy_pull, &env );                           /* 5 */
    CosTransactions_Current_commit( Current, CORBA_TRUE, &env );       /* 6 */
    CosNotifyChannelAdmin_StructuredProxyPullSupplier_disconnect_structured_pull_supplier (
                         proxy_pull, &env );                           /* 7 */
    ... 
}

  1. イベントチャネル管理オブジェクトのオブジェクトリファレンスを獲得します。

  2. イベントチャネルのオブジェクトリファレンスを獲得します。

  3. イベントチャネルと接続します。

  4. グローバルトランザクションを開始します。

  5. イベントチャネルにイベントデータを受信します。

  6. グローバルトランザクションを完了します。

  7. イベントチャネルと切断します。


  接続するイベントチャネルのオブジェクトリファレンスを不揮発媒体に保存している場合、1, 2, 3, 7の処理は不要となります。