ビジネス・イベントのサブスクライブおよび公開時の処理内容
次の例のソース・コードに、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)の各アクティビティで使用した場合、partnerLink
、operation
、portType
属性などの標準属性は存在しません。これは、bpelx:eventName
属性の存在が、このアクティビティがEDNイベント・バスからのイベントの受信またはEDNイベント・バスへのイベントの公開のみを対象としていることを表しているためです。
BPELプロセス・サービス・コンポーネントのXSDファイルは若干変更され、partnerLink
、operation
およびportType
属性は必須ではなくなりました。bpelx:eventName
属性、またはpartnerLink
、operation
および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アクティビティのスキーマ定義も同様に変更されています。