ビジネス・イベントのサブスクライブおよび公開時の処理内容

次の例のソース・コードに、BPELプロセス・サービス・コンポーネントのサブスクライブおよび公開するイベントに関するcomposite.xmlソース変更の様子を示します。

<component name="EventBPELProcess">
   <implementation.bpel src="EventBPELProcess.bpel"/>
   <property name="configuration.monitorLocation" type="xs:string"
             many="false">EventBPELProcess.monitor</property>
   <business-events>
     <subscribe xmlns:sub1="http://mycompany.com/events/orders"
                name="sub1:OrderReceivedEvent" consistency="oneAndOnlyOne"
                durable="true" runAsRoles="$publisher"/>
     <publishes xmlns:pub1="http://mycompany.com/events/orders"
                name="pub1:ProductSoldAlert" persistent="true" priority="7"
                timeToLive="36000000"/>/>
   </business-events>
</component>

    <business-events>
      <publishes xmlns:sub1="/oracle/fodemo/storefront/entities/events/edl/OrderEO"
 name="pub1:NewOrderSubmitted" persistent="true" priority="7"
 timeToLive="36000000"/> 
    </business-events>
  </component>

この例では明示的に示されていませんが、イベントにおいてXPathフィルタを定義できます。フィルタは、通常、イベント・サブスクリプションにあります。subscribe要素によって、このサービス・コンポーネントがサブスクライブされる対象のイベントのタイプが制限され、filterセクションによってさらに、コンポーネントが関連する特定のコンテンツにイベントが制限されます。次の例では、初期デポジットが50000を超える場合にのみ、イベントの配信が可能になります。

    <business-events>
        . . .
        . . .
        <filter>
            <xpath xmlns:be="http://oracle.com/fabric/businessEvent"
                 xmlns:ns1="http://xmlns.oracle.com/singleString"
                   <xpath expression= "/be:business-event/be:content/
                   sub1:AccountInfo/Details[@initialDeposit > 50000]" />
        </filter>
      . . .
      . . .
    </business-events>

特別な属性のbpelx:eventNameを使用すると、receive、invoke、onMessageおよびonEvent (BPEL 2.0)などの標準BPELアクティビティが拡張されるため、BPELプロセス・サービス・コンポーネントでEDNイベント・バスからのイベントを受信できます。次の例に、eventName属性のスキーマを示します。

<xs:attribute name="eventName" type="xs:QName">
        <xs:annotation>
            <xs:appinfo>
                <tns:parent>
                    <bpel11:onMessage/>
                    <bpel11:receive/>
                    <bpel11:invoke/>
                </tns:parent>
            </xs:appinfo>
        </xs:annotation>
    </xs:attribute>

次の例に、BPELソース・ファイルでのeventName属性の使用方法を示します。

<receive name="OrderPendingEvent" createInstance="yes"
         bpelx:eventName="ns1:OrderReceivedEvent"/>
<invoke name="Invoke_1" bpelx:eventName="ns1:ProductSoldAlert"/>

bpelx:eventName属性をreceive、invoke、onMessageまたはonEvent (BPEL 2.0)の各アクティビティで使用した場合、partnerLinkoperationportType属性などの標準属性は存在しません。これは、bpelx:eventName属性の存在が、このアクティビティがEDNイベント・バスからのイベントの受信またはEDNイベント・バスへのイベントの公開のみを対象としていることを表しているためです。

BPELプロセス・サービス・コンポーネントのXSDファイルは若干変更され、partnerLinkoperationおよびportType属性は必須ではなくなりました。bpelx:eventName属性、またはpartnerLinkoperationおよびportType属性(どちらか一方)の存在については、Oracle JDeveloperで検証ロジックを実施されます。次の例は、BPELのreceiveアクティビティの変更されたスキーマ定義を示しています。

<complexType name="tReceive">
        <complexContent>
           <extension base="bpws:tExtensibleElements">
                <sequence>
                    <element name="correlations" type="bpws:tCorrelations" minOccurs="0"/>
                    <group ref="bpws:activity"/>
                </sequence>
                <!- BPEL mandatory attributes relaxed to optional for supporting BPEL-EDN ->
                <attribute name="partnerLink" type="NCName" use="optional"/>
                <attribute name="portType" type="QName" use="optional"/>
                <attribute name="operation" type="NCName" use="optional"/>
                <attribute name="variable" type="NCName" use="optional"/>
            </extension>
        </complexContent>
    </complexType>

invokeおよびonMessageアクティビティのスキーマ定義も同様に変更されています。