fault handling in oracle soa suite advanced concepts

18
7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 1/18 Fault Handling in Oracle SOA Suite : Advanced Concepts Filed under: BPEL, BPM, Fault HandlingFault Management, Oracle SOA Suite, SOA, Weblogic — Tags: BPELBPM, Fault Bindings, Fault Handling and Management in Oracle SOA Suite gFault Management t!roug! "a#aFault Policies, Mediator$etr%ing Faults in SOA Suite — Arun Paree& ' (:)* am T!is tutorial is meant to co#er e+tensi#el% t!e mec!anism t!at e can ado-t .or Fault Management .or a SOA Suite com-osite/ 0t ill deal it! a .airl% o#erall strateg% .or !andling .aults and dealing it! t!em in #arious a%s/ Be.ore di#ing more into ad#anced conce-ts o. Handling Faults let me -resent a small introduction co#ering t!e basics o. a Ser#ice com-osite/ Basic Arc!itecture o. a Ser#ice 1om-osite in Oracle SOA Suite / Service components 2 BPEL Processes, Business $ule, Human Tas&, Mediator/ T!ese are used to construct a SOA com-osite a--lication/ A ser#ice engine corres-onding to t!e ser#ice com-onent is also a#ailable/ 3/ Binding components 2 Establis! connection beteen a SOA com-osite and e+ternal orld/ 4/ Services -ro#ide an entr% -oint to SOA com-osite a--lication/ */ Binding de.ines t!e -rotocols t!at communicate it! t!e ser#ice li&e SOAP5HTTP, "1A ada-ter etc/ 6/ WSDL ad#ertises ca-abilities o. t!e ser#ice/ (/ References enables a SOA com-osite a--lication to send messages to e+ternal ser#ices

Upload: shrikant

Post on 17-Feb-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 1/18

Fault Handling in Oracle SOA Suite : Advanced Concepts

Filed under: BPEL, BPM, Fault Handling, Fault Management, Oracle SOA Suite, SOA,Weblogic — Tags: BPEL, BPM, Fault Bindings, Fault Handling and Management in Oracle

SOA Suite g, Fault Management t!roug! "a#a, Fault Policies, Mediator , $etr%ing Faults in

SOA Suite — Arun Paree& ' (:)* am

T!is tutorial is meant to co#er e+tensi#el% t!e mec!anism t!at e can ado-t .or FaultManagement .or a SOA Suite com-osite/ 0t ill deal it! a .airl% o#erall strateg% .or !andling

.aults and dealing it! t!em in #arious a%s/

Be.ore di#ing more into ad#anced conce-ts o. Handling Faults let me -resent a small

introduction co#ering t!e basics o. a Ser#ice com-osite/

Basic Arc!itecture o. a Ser#ice 1om-osite in Oracle SOA Suite

/ Service components 2 BPEL Processes, Business $ule, Human Tas&, Mediator/ T!eseare used to construct a SOA com-osite a--lication/ A ser#ice engine corres-onding to t!e

ser#ice com-onent is also a#ailable/

3/ Binding components 2 Establis! connection beteen a SOA com-osite and e+ternalorld/

4/ Services -ro#ide an entr% -oint to SOA com-osite a--lication/

*/ Binding de.ines t!e -rotocols t!at communicate it! t!e ser#ice li&e SOAP5HTTP, "1Aada-ter etc/

6/ WSDL ad#ertises ca-abilities o. t!e ser#ice/

(/ References enables a SOA com-osite a--lication to send messages to e+ternal ser#ices

Page 2: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 2/18

7/ Wires enable connection beteen ser#ice com-onents/

1oming to Fault Handling in a com-osite t!ere are -rimaril% to t%-es o. .aults

/ Business faults 2 Occurs !en a--lication e+ecutes TH$OW acti#it% or an in#o&erecei#es .ault as res-onse/ Fault name is s-eci.ied b% t!e BPEL -rocess ser#ice

com-onent/ T!is .ault is caug!t b% t!e .ault !andler using Fault name and .ault #ariable/

3/ Runtime faults 2 T!ron b% s%stem/ Most o. t!ese .aults are -ro#ided out o. t!e bo+/T!ese .aults are associated it! $unTimeFaultMessage and are included in

!tt-:55sc!emas/oracle/com5b-el5e+tension names-ace/

Oracle SOA Suite gi#es us an o-tion o. con.iguring .ault and .ault actions using -olicies/ T!is

means t!at e can create -olicies in res-onse to a s-eci.ic t%-e o. e+ce-tion/ Policies are de.inedin a .ile t!at b% de.ault is called fault-policies!ml

Policies .or .ault !andling consist o. to main elements:

/ T!e fault condition t!at acti#ates t!e -olic% bloc&—e s-eci.% !at t%-e o. .ault8s9 t!e

 -olic% is rele#ant .or/ We can t!en a--l% e#en more .iner grained -olic% and actions basedon error codes, error messages etc/

3/ T!e action"s# t!at s!ould be -er.ormed !en t!e condition is satis.ied/ An action .or an.ault ma% be to retr% it .or a certain number o. time at a s-eci.ied inter#al, or to mar& it in

reco#er% .or !uman inter#ention, use a custom "a#a code or sim-l% to t!ro t!e .ault bac&/ 0. t!e .ault is ret!ron t!en i. e !a#e s-eci.ied an% e+-licit $catc%& bloc& in our

BPEL -rocess t!at ill be e+ecuted/

0t s!ould also be noted t!at .ault -olicies need to be e+-licitl% associated it! com-osites,com-onents, or re.erences/ T!is is done in a fault-'indings!ml .ile/ Fault bindings lin& t!e

com-osite, s-eci.ic com-onents in t!e com-osite, or s-eci.ic re.erences in t!e com-onents on

t!e one !and to one o. t!e .ault -olicies on t!e ot!er/

Ha#e a loo& at t!e diagram belo to understand a mec!anism to t!ro a .ault .rom a ser#icecom-osite, identi.% t!e .ault t%-e and t!en ta&e necessar% action/

Page 3: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 3/18

T!e .olloing -ost ill tr% and co#er all as-ects o. !at is co#ered in t!e diagram abo#e/

1onsider t!e .olloing .ault-olicies/+ml/ $ead t!e comments in t!e ;ML to understand !ateac! o. t!e condition, action and -ro-ert% is about/

3

4

*

6(

7

<=

)

3

4

*

<faultPolicies xmlns="http://schemas.oracle.com/bpel/faultpolicy"><faultPolicy version="2.0.1" id="omposite!aultPolicy" xmlns:env="http://schemas.xmlsoap.or/soap/envelope/" xmlns:xs="http://###.#$.or/2001/%&'(chema" xmlns="http://schemas.oracle.com/bpel/faultpolicy"><onditions><)** onditions can be fine rained to include ,ctions based on -rror odes.f a remotefault occurs chec #hether it is a ('eadin-rror. f yes thenrethro# it else retry it."**><fault3ame xmlns:bpelx="http://schemas.oracle.com/bpel/extension" name="bpelx:remote!ault"><condition><test>4fault.code/code="('eadin-rror"</test><action ref="ora*rethro#*fault"/>

</condition><condition><action ref="ora*retry"/></condition></fault3ame><fault3ame xmlns:bpelx="http://schemas.oracle.com/bpel/extension" name="bpelx:bindin!ault"><condition><action ref="5ava*fault*handler"/></condition>

Page 4: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 4/18

6

(

7

<

=3

)

3

3

3

3

43

*3

6

3(

3

7

3<

3

=4

)

4

4

3

44

4

*4

6

4(

4

7

4

</fault3ame><fault3ame xmlns:bpelx="http://schemas.oracle.com/bpel/extension" name="bpelx:runtime!ault"><condition><action ref="5ava*fault*handler"/></condition></fault3ame></onditions><,ctions><)** 6his ,ction #ill invoe a ustom 7ava lass to process !aults. ,lsodependin upon the return8alueanother action #ill be invoed #hic isspecified by the ref attribute. 6his demosntrates chainin of ,ctions"**><,ction id="5ava*fault*handler"><5ava,ction class3ame="com.beatech.faultapp.ustom!ault9andler"  default,ction="ora*human*intervention"  property(et="properties"><return8alue value="&anual" ref="ora*human*intervention"/></5ava,ction></,ction><)** 6his ,ction #ill mar the instance as "Pendin for ecovery" in the -&console **>

<,ction id="ora*human*intervention"><humanntervention/></,ction><)**6his is an action #ill bubble up the fault to the atch locs**><,ction id="ora*rethro#*fault"><rethro#!ault/></,ction><)**6his action #ill attempt $ retries #ith intervals of 120 seconds **><,ction id="ora*retry"><retry><retryount>$</retryount><retrynterval>120</retrynterval><retry!ailure,ction ref="5ava*fault*handler"/></retry></,ction><)**6his action #ill cause the instance to terminate**><,ction id="ora*terminate"><abort/></,ction></,ctions><)**Properties can be used to pass values to the 7ava class as a &ap thatcan be used by the lass **><Properties><property(et name="properties"><property name="myProperty1">property8alue1</property><property name="myProperty2">property8alue2</property><property name="myProperty3">property8alue3</property>

</property(et></Properties></faultPolicy></faultPolicies>

Page 5: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 5/18

<

4

=*

)

*

*

3*

4

*

**

6

*

(*

7*

<

*=

6

)

6

6

36

4

6*

6

6

6(

6

76

<

6=

(

)

(

Page 6: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 6/18

(

3

0nside t!e custom (ava fault %andler )e can also use a s)itc% t!at acts on t!e return>alue toc!ain anot!er Action

3

4*

6

(

<5avaaction classname="com.beatech.faultapp.ustom!ault9andler"  defaultaction="ora*rethro#">

<return8alue ref="ora*rethro#" value="ethro#"/>

<returnvalue ref="ora*terminate" value=",bort"/>

<returnvalue ref="ora*retry" value="etry"/>

<returnvalue ref="ora*human*intervention" value="&anual"/></5avaaction>

T!e ne+t ste- ill be to create a fault-'indings!ml .ile to sim-l% bound t!e .ault -olic% .ile tot!e com-osite/

3

4

<faultPolicyindins version="2.0.1" xmlns="http://schemas.oracle.com/bpel/faultpolicy">

<composite faultPolicy="omposite!aultPolicy"/></faultPolicyindins>

Finall% e !a#e to add to -ro-erties in t!e com-osite/+ml to let t!e com-osite &no aboutt!em

?-ro-ert% name@oracle/com-osite/.aultPolic%File.ault-olicies/+ml?5-ro-ert%

?-ro-ert% name@oracle/com-osite/.aultBindingFile.aultbindings/+ml?5-ro-ert%

We can use di..erent names and locations .or t!e .ault -olicies and .ault bindings .iles, b% setting

t!e -ro-erties oraclecompositefault*olic+File  and oraclecompositefaultBindingFile  in t!e

composite!ml to con.igure t!ese custom .iles/

For e+am-le e can re.er to t!ese .iles e#en .rom t!e MCS/

?-ro-ert% name@oracle/com-osite/.aultPolic%Fileoramds:55a--s5-olic%5.ault-olicies/+ml?5-ro-ert%?-ro-ert% name@oracle/com-osite/.aultBindingFileoramds:55a--s5-olic%5.aultbindings/+ml?5-ro-e

Once e !it a .ault in our com-osite t!at !as a custom "a#a Action t!e Da#a class

CustomFaultHandler ill be instantiated/ Here is one e+am-le o. a "a#a 1lass/

T!e custom "a#a class !as to im-lement t!e inter.ace 0Fault$eco#er%"a#a1lass t!at de.ines to

met!ods i/e %andleRetr+Success and %andleFault/ T!e custom "a#a class

CustomFaultHandler !as access to t!e ,FaultRecover+Conte!t containing in.ormation about

t%e composite t%e fault and t%e polic+/

0. t!e .ault is t!ron b% a B*.L -rocess e can c!ec& i. its an instanceof  

B*.LFaultRecover+Conte!t,mpl to get .urt!er .ault details/

3

4*

6

(

7<

pacae com.beatech.faultapp;import com.collaxa.cube.enine.fp.P-'!aultecoveryontextmpl;</pre>

import com.oracle.bpel.client.confi.faultpolicy.P-'!aultecoveryontext;

import 5ava.util.&ap;

import oracle.interation.platform.faultpolicy.!aultecoveryontext;

import oracle.interation.platform.faultpolicy.!aultecovery7avalass;

 

public class ustom!ault9andler implements !aultecovery7avalass

Page 7: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 7/18

=

)

3

4

*

6

(

7

<

=

3)

3

33

3

43

*

36

3

(

37

3

<3

=

4)

4

4

public ustom!ault9andler super;?

 

public void handleetry(uccess!aultecoveryontext i!aultecoveryontext (ystem.out.println"etry (uccess";

handle!aulti!aultecoveryontext;?

 

public (trin handle!ault!aultecoveryontext i!aultecoveryontext //Print !ault &eta ata to onsole(ystem.out.println"@@@@@@@@@@@@@@@@!ault &etadata@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";

(ystem.out.println"!ault policy id: " A i!aultecoveryontext.etPolicyd;

(ystem.out.println"!ault type: " A i!aultecoveryontext.et6ype;

(ystem.out.println"Partnerlin: " A i!aultecoveryontext.eteference3ame;

(ystem.out.println"Port type: " A i!aultecoveryontext.etPort6ype;(ystem.out.println"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";//print all properties defined in the fault*policy file(ystem.out.println"Properties (et for the !ault";&ap props = i!aultecoveryontext.etProperties;

for Bb5ect ey: props.ey(et

(ystem.out.println"Cey : " A ey.to(trin A " 8alue : " A props.etey.to(trin;?//Print !ault etails to onsole if it exists(ystem.out.println"@@@@@@@@@@@@@@@@!ault etails@@@@@@@@@@@@@@@@@@@@@@@@@@@

@@@@@";ifi!aultecoveryontext instanceof P-'!aultecoveryontextmplP-'!aultecoveryontextmpl bpeltx = P-'!aultecoveryontextmpl i!aultecoveryontext;

(ystem.out.println"!ault: " A bpeltx.et!ault;

(ystem.out.println",ctivity: " A bpeltx.et,ctivity3ame;

(ystem.out.println"omposite nstance: " A bpeltx.etompositenstanced;

(ystem.out.println"omposite 3ame: " A bpeltx.etomposite3ame;(ystem.out.println"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";

?//ustom ode to 'o !ault to !ile//7&( or send -mails etc.

return "&anual";??

Page 8: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 8/18

3

4

44

*

46

4

(4

7

4

<4

=

*

)*

*

3

*4

*

*

*6

*

(*

7

 o !ere is !at e can do .rom !ere

/ Log t!e .ault5-art o. .ault in a flat file data'ase or error /ueue in a s-eci.ied enter-rise.ormat/

3/ We can e#en con.igure to send an .mail to t!e su--ort grou- .or remed% and action/

8Gse custom "a#a Email code or use t!e GMS Da#a5eDb AP0s to do so9

4/ $eturn a .lag it! an a--ro-riate post Action T!is .lag determines !at action needs to

 be ta&en ne+t

T!e Da#a class ould reuire t!e SOA and BPEL runtime in class-at! to com-ile and e+ecute/

Page 9: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 9/18

To ma&e sure t!at !en t!e com-osite instances .aults out and t!e .ault-olic%/+ml is able toinstantiate t!is class e !a#e to ma&e it a#ailable in t!e ser#ers class-at!/

T!ere are a cou-le o. a%s to do t!at/ Here is one o. t!e a% to ac!ie#e it/

/ 1om-ile %our "a#a ProDect and e+-ort it as a Dar .ile 8sa% CustomFaultHandling0ar9

3/ Io to 12iddle)are Home34Oracle5SOA64soa4modules4oraclesoa'pel56666 

director% o. %our Oracle SOA Suite installation/

4/ 1o-% t!e CustomFaultHandling0ar in t!e abo#e director%

*/ GnDar t!e oraclesoa'pel0ar and edit t!e MA0FEST/MF to add an entr% o. t!e abo#e

 Dar in t!e classpat%/

/ Pac& t!e Dar again and restart 'ot% t%e 2anaged and Admin Server/

3/ Anot!er a% is to dro- t!e CustomFaultHandling0ar in t!e 12iddle)are

Home34Oracle5SOA64soa4modules4oraclesoae!t56666 and run Ant on t!e

'uild!ml .ile -resent in t!e director%/

Page 10: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 10/18

0nterestingl% e also !a#e an o-tion in t!e EM console to retr% all .aults .or a com-osite b%

setting some #alues in custom MBeans/ T!e% are a#ailable as Ad#anced BPEL -ro-erties in t!e

SOA 0n.ra engine/

T!e MBean t!at allos reco#er% o. faulted instances is Recover+Config 0t !as to o-tions .orretr%ing

/ RecurringSc%eduleConfig : A reco#er% indo ma% be s-eci.ied 8most -robabl% o.. -ea& !ours9 to reco#er all .aulted instances/ Messages being reco#ered can be t!rottled b%

limiting t!e number o. messages -ic&ed u- on eac! run b% s-eci.%ing t!e

ma!2essageRaiseSi7e

3/ StartupSc%eduleConfig : Wit! t!is setting on all .aulted instances are automaticall%

retried !en t!e soa ser#er is booted u- .or restart/

More details on !o to use RecoverConfig Mbean can be .ound !ere

!tt-:55donload/oracle/com5docs5cd5E*67J)5relnotes/5e)445soa/!tmK$L0)63

T!ere is a small lacuna t!oug! !ere/ 0t is not ala%s -ossible to reco#er automaticall%/ Auto-

recover+ is subDect to some conditions/

1onsider t!e scenarios belo/

/ Scenario A: T!e BPEL code uses a .ault-olic% and a .ault is !andled using t!e ora-

%uman-intervention acti#it%, t!en t!e .ault is mar&ed as Recovera'le and t!e instance

state is set to Running/

3/ Scenario B: T!e BPEL code uses a .ault-olic% and a .ault is caug!t and ret!ron using

t!e ora-ret%ro)-fault action, t!en t!e .ault is mar&ed as Recovera'le and t!e instancestate is set to Faulted -ro#ided t!e .ault is a reco#erable one 8li&e G$L as not

a#ailable9/

,n Scenario A, t!e $eco#erable .ault 1AOT be autoreco#ered using t!e Recover+Config

MBean/

,n Scenario B, t!e Recovera'le .ault can be autoreco#ered on ser#er startu- and5or -re

sc!eduled reco#er%/

Page 11: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 11/18

All is not lost !oe#er/ T!e instances can still be reco#ered .rom t!e console t!oug!/ Hoe#er

.or most -ractical -ur-oses it isnt desirable t!at a !uge number o. com-osite instances t!at are

mar&ed .or reco#er% .or a remote .ault 8sa% end -oint not a#ailable9 are retried automaticall%/ 0tis natural t!at e ill %earn to automate t!is -art as ell/

Here is a sam-le code t!at gets all remote .aults t!at are mar&ed as reco#erable .rom t!e 1ustom

"a#a 1lass and retries t!em/

3

4

*6

(

7<

=

)

3

4

*

6

(

7

<

=

3)

3

3

3

3

43

*

3

pacae com.beatech.salapp;

 

import 5ava.util.9ashtable;

import 5ava.util.'ist;

 

import 5avax.namin.ontext;

 

import oracle.soa.manaement.facade.!ault;

import oracle.soa.manaement.facade.!aultecovery,ction6ypeonstants;

import oracle.soa.manaement.facade.'ocator;

import oracle.soa.manaement.facade.'ocator!actory;import oracle.soa.manaement.facade.bpel.P-'(ervice-nine;

import oracle.soa.manaement.util.!ault!ilter;

 

public class !aultecovery

 

private 'ocator locator = null;

private P-'(ervice-nine mP-'(ervice-nine;

 

public !aultecovery locator = this.et'ocator;

try mP-'(ervice-nine =P-'(ervice-ninelocator.et(ervice-nine'ocator.(-DP-';

? catch -xception e e.print(tac6race;??

 

public 9ashtable et7ndiProps

9ashtable 5ndiProps = ne# 9ashtable;5ndiProps.putontext.PB8-DE'F"t$://localhost:G00$/soa*infra";5ndiProps.putontext.36,'DB36-%6D!,6BHF"#ebloic.5ndi.'nitialontex

t!actory";5ndiProps.putontext.(-E6HDP3P,'F "#ebloic";5ndiProps.putontext.(-E6HD--36,'(F "#elcome12$";5ndiProps.put"dedicated.connection"F "true";

return 5ndiProps;?

 

public 'ocator et'ocator

 

Page 12: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 12/18

6

3

(3

7

3<

3

=4

)

4

4

3

4

44

*4

6

4(

4

7

4<

4

=*

)

*

*

3

*4

*

**

6

*(

*

7

*

try 

return 'ocator!actory.create'ocatoret7ndiProps;

? catch -xception e e.print(tac6race;?

return null;?

 

public void recover!aults

try (ystem.out.println"Iet ,ll ecoverable !aults";/@ (et (earch !ilters lie composite 3ameF nstance dsF fault 3ames etc.9ere am settin the setevoverable filter to true to retrieve all ecoverable !aults.,lso am settin filter on fault3ame as i #ant to proramatically retry allremote !aults for resubmission.@/

!ault!ilter filter = ne# !ault!ilter;

filter.set!ault3ame"http://schemas.oracle.com/bpel/extension?remote!ault";filter.setecoverabletrue;

 //Iet faults usin defined filter'ist<!ault> fault'ist = mP-'(ervice-nine.et!aultsfilter;(ystem.out.println"=========================ecoverable !aults==================================================";

for !ault fault : fault'ist (ystem.out.println"=============================================================================================";

(ystem.out.println"omposite 3: " A fault.etomposite3.et(trin3;

(ystem.out.println"omposite nstance : " A fault.etompositenstanced;

(ystem.out.println"omponent 3ame: " A fault.etomponent3ame;

(ystem.out.println"omponent nstance : " A fault.etomponentnstanced;

(ystem.out.println",ctivity 3ame: " A fault.et'abel;

(ystem.out.println"!ault : " A fault.etd;

(ystem.out.println"!ault 3ame: " A fault.et3ame;

(ystem.out.println"ecoverable fla: " A fault.isecoverable;

(ystem.out.println"!ault &essae: " A fault.et&essae;?// ecoverin all ecoverable !aults in a sinle call

//mP-'(ervice-nine.recover!aultsfault'ist.to,rrayne# !aultJfault'ist.siKeLF !aultecovery,ction6ypeonstants.,6B3D-6H;

 

? catch -xception e e.print(tac6race;?

 ?

 

Page 13: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 13/18

<

*

=6

)

6

6

36

4

6

*6

6

6

(6

76

<

6=

(

)

(

(

3(

4

(*

(

6

((

(

7(

<

(=

7

)

7

public static void main(trinJL ars

!aultecovery faultecovery = ne# !aultecovery;faultecovery.recover!aults;??

Page 14: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 14/18

7

37

4

7*

7

67

(

7

77

<

7

=<

)<

<3

<

4

<*

<

6<

(

<7

<

<

<=

$e-lace t!e #alues in t!e -ro-ert% ma- it! t!e ones in %our ser#er/ Remem'er to give t%e

managed server port in t%e *rovider 8RL $un t!e "a#a 1lass and %ou ould see t!at t!ereco#erable .aults are -rinted/

Page 15: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 15/18

>eri.% t!e same .rom t!e console

$un t!e "a#a -rogram again but t!is time uncomment t!e line belo

//mP-'(ervice-nine.recover!aultsfault'ist.to,rrayne#!aultJfault'ist.siKeLF !aultecovery,ction6ypeonstants.,6B3D-6H;

T!is ill result in all .aults mar&ed it! ?strong$eco#er%?5strong icon to be retried/ So i. t!e

remote end-oint is res-onding and acti#e no t!e -rocesses ill com-lete/

T!ere are a !ost o. ot!er t!ings t!at e can do in t!is "a#a 1lass/

Gsing t!e ?strongBPELSer#iceEngine?5strong obDect e can rite messages to t!e BPEL

audit trail, ins-ect t!e current acti#it%, and read and u-date t!e #alues o. BPEL #ariables/

T!e .olloing code sni--et i. inserted in t!e code ill re-lace an% -rocess #ariable it! a ne

#alue be.ore retr%ing/ 8Ma% be used in case o. Binding or Business Faults9

3

4

//Iet faults usin defined filter'ist<!ault> fault'ist = mP-'(ervice-nine.et!aultsfilter;(ystem.out.println"=========================ecoverable !aults ==================================================";

Page 16: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 16/18

*

6

(7

<

=

)

3

4

*

6

(

7

<

=3

)

3

3

33

4

3

*3

6

for !ault fault : fault'ist(ystem.out.println"=========================ead Process 8ariables =========================================";//Iet Process nstance variables from fault ob5ect(trinJL variables = mP-'(ervice-nine.et8ariable3amesfault;(ystem.out.println"Process nstance 8ariables:";

for int i = 0; i < variables.lenth; iAA

(ystem.out.println"8ariable 3ame: " A variablesJiL;

?//Iet nput 8ariable ata from the ,ctivityF &odify it #ith a ne# value andrecover(ystem.out.println"=========================eplace 8ariable and ecover ====================================";(ystem.out.println",ctivity nput 8ariable ata:";(trin value =mP-'(ervice-nine.et8ariablefaultF "activityeMuest&essae";

(ystem.out.println"Present value: " A value;value = value.replace"remote!ault"F "&odified 8alue";

(ystem.out.println"3e# value: " A value;mP-'(ervice-nine.set8ariablefaultF"activityeMuest&essae"Fvalue;

 

// ecover !aults one by onemP-'(ervice-nine.recover!aultfaultF!aultecovery,ction6ypeonstants.,6B3D-6HFnull;?

T!e .olloing "A$S ould be reuired in t!e class-at! .or t!e abo#e "a#a 1ode

Page 17: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 17/18

 

?MWHOMENoracleJcommonNmodulesNoracle/.abriccommonJ//N.abriccommon/Dar 

?MWHOMENDde#elo-erNsoaNmodulesNoracle/soa/mgmtJ//Nsoain.ramgmt/Dar 

?MWHOMENlser#erJ)/4Nser#erNlibNeblogic/Dar 

?MWHOMENDde#elo-erNsoaNmodulesNoracle/soa/.abricJ//Noraclesoaclienta-i/Dar 

?MWHOMENoracleJcommonNebser#icesNsclientJe+tended/Dar 

T!e -ost discussed t!e di..erent a--roac!es and strategies .or !andling .aults in a com-osite in

SOA Suite/ Let me conclude t!is article b% describing a .e best -ractices around FaultHandling/

Oracle SOA Suite Fault Handling Best *ractices

/ 1reate fault 8catc! bloc&9 .or eac! -artner lin&/ For eac! -artner lin&, !a#e a catc! bloc&

.or all -ossible errors/ 0dea is not to let errors go to catc%All bloc&/

3/ Catc%All s!ould be &e-t .or all errors t!at cannot be t!oug!t o. during design time/

4/ 1lassi.% errors into #arious t%-es 2 runtime, remote, binding, #alidation, Business errors

etc/

*/ oti.ication s!ould be setu- in -roduction, so t%at errors are sent to concerned teams

'+ .-2ail 1onsole need not be #isited .or .inding out status o. e+ecution/

6/ Gse Catc% Bloc9  .or non-artner lin& error/

(/ .ver+ retr+ defined in fault polic+ causes a commit of t%e transaction/ Ce!%dration

ill be reac!ed and t!reads released/

7/ Automated reco#er% can be created b% creating a .ault table, -ersisting t!e ueue and

!a#ing an agent to resubmit t!e Dob 8For e+am-le riting a Timer agent to in#o&e t!e"a#a code e rote to reco#er instances9 / 1an be ac!ie#ed t!roug! scri-ts/ 8se onl+

*8BL,SH.D A*, of .SB or 8.8. "A etc# .or resubmission/ Anot!er e+am-le

ould be to use WLS; to c!ange t!e Recover+Config MBean to con.igure reco#er%

indo to retr% all .aulted instances/</ Handle $ollbac& .ault b% -ro#iding $<o Action& in .ault -olic%/

=/ $emember 2 $ecei#e, OnMessage, On Alarm, Wait, 1!ec&Point 8Acti#it% .or .orcing

"a#a t!read to store its current state to Ce!%dration store9 ill cause storing o. currentstate to de!%dration store and t!reads ill be released/

)/ Ala%s use 2DS to store fault policies and 'indings to increase t%eir reuse  .ormulti-le com-osites and -roDects/

Page 18: Fault Handling in Oracle SOA Suite Advanced Concepts

7/23/2019 Fault Handling in Oracle SOA Suite Advanced Concepts

http://slidepdf.com/reader/full/fault-handling-in-oracle-soa-suite-advanced-concepts 18/18