You are on page 1of 7

10/6/2016 OracleSOA/Javablog:PollingwiththeDbAdapterinaclusteredenvironment

8 More NextBlog CreateBlog SignIn

OracleSOA/Javablog
Articlescontainingtips,tricksandnicetoknowsrelatedtoOracleSOAandJavadevelopment

vrijdag6april2012 Searchinthisblog

PollingwiththeDbAdapterinaclusteredenvironment Go!

Introduction
+8 Dit aanbevelen op Google
Mostcustomersuseaclusteredproductionenvironment.Thedevelopmentenvironmentisoftennot
clustered.Thereareseveralthingstoconsiderfordeveloperswhenthesoftwaredevelopedwill
eventuallyruninaclusteredenvironment.Itwouldbeashameifthesoftwarehasbeendeveloped,
unittested,systemtested,acceptedbytheusersandthenbreaksontheproductionsystem. Aboutme

MaartenSmeets
IwillfirstdiscusstheDbAdapterandpollinginthispost.Thisisnotacompletedescriptionofallthe
Volgen 70
settingswhichcaninfluencethisbehavior,justsomethingsI'vetriedandproblemsI'veencountered.
Mijnvolledigeprofiel
I'veusedthe(activeactivecluster)setupasdescribedin weergeven
http://javaoraclesoa.blogspot.com/2012/03/oraclesoasuiteclusterpart1.html
http://javaoraclesoa.blogspot.com/2012/03/oraclesoasuiteclusterpart2.html

ThisarticleisabouttheDbAdapter.AnerrorwhichcanoccurwhenusingtheAqAdapterwhen OracleACEAssociate
dequeueinginaclusteredenvironmentisthatamessageisqueuedonceanddequeuedmorethen
once.Thiscanoccurin11.2databases.Lookat
http://www.oracle.com/technetwork/middleware/docs/aiasoarelnotesps51455925.htmlfora
descriptiononhowtofixthis.Belowhasbeencopiedfromthementioneddocument

Bug:13729601
Added:20February2012
Platform:All
Thedequeuerreturnsthesamemessageinmultiplethreadsinhighconcurrencyenvironmentswhen
Disclaimer
Oracledatabase11.2isused.Thismeansthatsomemessagesaredequeuedmorethanonce.For
example,inOracleSOASuite,ifService1suddenlyraisesalargenumberofbusinesseventsthat
Theviewsexpressedonthisblogaremy
aresubscribedtobyService2,duplicateinstancesofService2triggeredbythesameeventmaybe
seeninanintermittentfashion.Thesamebehaviorisnotobservedwitha10.2.0.5databaseorinan ownanddonotnecessarilyreflectthe
11.2databasewithevent10852level16384settodisablethe11.2dequeueoptimizations. viewsofmyemployerorcustomer.

Workaround:Performthefollowingsteps:
Allsamplecodeisprovidedfor
Logintothe11.2database: illustrativepurposesonly.These
CONNECT/ASSYSDBA exampleshavenotbeenthoroughly
testedunderallconditions.Thewriter
SpecifythefollowingSQLcommandinSQL*Plustodisablethe11.2dequeueoptimizations:
therefore,cannotguaranteeorimply
SQL>altersystemsetevent='10852tracenamecontextforever,
level16384'scope=spfile reliability,serviceability,orfunctionof
theseprograms.
Pollingsetup
Allprogramscontainedhereinare
Inanactive/activeclusterconfiguration,adeployedprocesswillhavetwoinstancesofaprocess providedtoyou"ASIS"withoutany
pollingonthesametable.Inthiscaseitisimportanttoconsiderifitwillbeaproblemifmorethen
warrantiesofanykind.Theimplied
oneinstancepicksupthesameentryinthetable.
warrantiesofnoninfringement,
Iusedthefollowingdatabasesetuptosimulateandlogthetest merchantabilityandfitnessfora
http://dl.dropbox.com/u/6693935/blog/cluster_test.sql particularpurposeareexpressly
disclaimed.
Thescriptcontainsthreetables
POLLING_TEST_CLUSTER
thistablewillbeusedbytheDbAdapterforpolling
POLLING_TEST_LOG FollowbyEmail
thistablewilllogstatuschangesinPOLLING_TEST_CLUSTER(POLLING_TEST_CLUSTERhas
abeforeupdatetrigger) Emailaddress... Submit
POLLING_TEST_OUTPUT
aBPELprocesswillreadfromPOLLING_TEST_CLUSTERandputentriesinthistable.thistable

http://javaoraclesoa.blogspot.in/2012/04/pollingwithdbadapterinclustered.html 1/7
10/6/2016 OracleSOA/Javablog:PollingwiththeDbAdapterinaclusteredenvironment
hasauniqueconstraintontheIDcolumn.thesameIDisusedasinPOLLING_TEST_CLUSTER
thusifthesameentryfromthePOLLING_TEST_CLUSTERtableispickeduptwicebyBPEL,itwill
causeauniquekeyconstraintwhenittriestoinserttheentryinPOLLING_TEST_CLUSTER

I'veuseda'pragmaautonomous_transaction'intheloggingprocedure.Thiswillfail(withanORA
06519:activeautonomoustransactiondetectedandrolledback)ifIdon'tendtheprocedurewithan
explicitcommit.

NextconfigureadatasourceandthedatabaseadapterintheWeblogicConsolesoyoucanusethem
inBPEL.Don'tcreateanXAdatasource!Itwillcauseproblemswithautonomoustransactionssuch
asjava.sql.SQLException:Cannotcallrollbackwhenusingdistributedtransactions(XAdatasources
canalsocauseproblemswithdatabaselinkshttp://javaoraclesoa.blogspot.com/2012/02/exception
occuredwhenbindingwas.html)

WhenconfiguringtheDbAdapter,keepinmindthatyouhavetocopythePlan.xmlfile(deployment Subscribeto
planfortheDbAdapter)totheothermanagedserverifyouhavenotconfiguredasharedstoragefor
thisfile(whichissuggestedintheEnterpriseDeployment
Guide,http://docs.oracle.com/cd/E17904_01/core.1111/e12036/extend_soa.htm,paragraph5.21.1).If
Berichten
youdon'tdothis,theconnectionfactorywillnotbeavailableintheothermanagedserver. Reacties

Pollingtest
Followers
Youcandownloadtheprocesseshere
http://dl.dropbox.com/u/6693935/blog/FilePollingTest.zip Followers(9)Next

IcreatedasmallprocesstoinsertarecordinthePOLLING_TEST_CLUSTERtablewithastatus
NEWsoitwoulddirectlybepickedup.IusedSOAPUI(http://www.soapui.org/)todoastresstest
andcallthisprocessalargenumberoftimes.

Iwasabletoproducetheerror(asmallnumberoftimesathighloads)thattwoinstancesofthe Follow
adapter,runningondifferentserversinthecluster,pickedupandprocessedamessageatthesame
time.Ihavealsoseenthishappeningatacustomer.

Inmysetupthissituationwouldcauseauniqueconstraintviolationasshownbelow Populaireberichten

LoopsinBPEL1.1and
<bpelFault><faultType>0</faultType><bindingFaultxmlns="http://schemas.oracle.com/bpel/extension"><part
2.0
name="summary"><summary>Exceptionoccuredwhenbindingwasinvoked.Exceptionoccuredduringinvocationof
IntroductionWhen
JCAbinding:"JCABindingexecuteofReferenceoperation'insert'faileddueto:DBWriteInteractionSpecExecuteFailed
programminginBPEL,an
Exception.insertfailed.Descriptorname:[write_textline_DB.PollingTestOutput].Causedby oftenusedconstructionis
java.sql.BatchUpdateException:ORA00001:uniqueconstraint(TESTUSER.POLLING_TEST_OUTPUT_PK) thefollowingtheinputofaprocess
violated.PleaseseethelogsforthefullDBAdapterloggingoutputpriortothisexception.Thisexceptionisconsidered containsacollectionofele...
notretriable,likelyduetoamodellingmistake.ToclassifyitasretriableinsteadaddpropertynonRetriableErrorCodes
withvalue"1"toyourdeploymentdescriptor(i.e.weblogicra.xml).Toautoretryaretriablefaultsetthese Pollingwiththe
composite.xmlpropertiesforthisinvoke:jca.retry.interval,jca.retry.count,andjca.retry.backoff.Allpropertiesare
DbAdapterinaclustered
environment
integers.".TheinvokedJCAadapterraisedaresourceexception.Pleaseexaminetheaboveerrormessagecarefullyto
determinearesolution.</summary></part><partname="detail"><detail>ORA00001:uniqueconstraint
IntroductionMost
customersusea
(TESTUSER.POLLING_TEST_OUTPUT_PK)violated</detail></part><partname="code"><code>1</code></part>
clusteredproductionenvironment.The
</bindingFault></bpelFault> developmentenvironmentisoftennot
clustered.Thereareseveral...
ThisoccurredevenwiththeNumberOfThreadsvaluesetto1(thisisthedefault)
DbAdapter,connection
factories,connection
poolsanddatasources
Goingfroma
BPMN,BPELorMediator
processinstancetothedatabaseis
notashortroad.Onthisroad,several
abstractionlayersneedtobe...

Blogarchief

2016(14)
2015(25)

BelowIwilldescribetwopossiblesolutionsforthisissueandmyexperiencewithit.Distributed 2014(23)
pollingandusingaReservedValue. 2013(25)
2012(33)
DistributedPolling
december(2)
Thisisalsodescribedmoreextensively november(2)
http://javaoraclesoa.blogspot.in/2012/04/pollingwithdbadapterinclustered.html 2/7
10/6/2016 OracleSOA/Javablog:PollingwiththeDbAdapterinaclusteredenvironment
inhttp://www.oracle.com/technetwork/database/features/availability/maasoaassesment194432.pdf
oktober(2)
ItispossibletosettheDbAdapterpropertytododistributedpolling september(4)
augustus(3)
juli(2)
juni(3)
mei(2)
april(3)
Thingstomindina
clusteredSOASuite
11genviro...
SchedulingEDNBusiness
Eventsusing
DBMS_SCHEDULE...
Pollingwiththe
DbAdapterina
clusteredenvironm...

DistributedPollingmeansthatwhenarecordisread,itislockedbythereadinginstance.Another maart(5)
instancewhichwantstopickuptherecordskipslockedrecords.Thiscanhowevercauseproblems februari(5)
withlockswhichcouldoriginatefromdifferentsourcesthentheprocessesrecordswhichwould
requireprocessing,couldbeskipped.

Also,aBPELprocessisbydefaultinvokedasynchronouslybytheDbAdapter Labels

bpel (30) performance (11)


json(9)rest(9)soa suite 12c(9) wlst
(8)12c(7)maven(7)mds(7) service
bus (7) continuous delivery (6)
datasource(6)jndi(6)11g (5) AQ (5)
ant(5)dbadapter(5) composite (4) jdbc
(4)jms(4)ldap (4) nexus (4) spring (4) xml
(4) fmw 12c (3) jca (3) oracle soa (3) wadl
(3) fileadapter(2)

ThiscausesthelocktobereleasedrightaftertheDbAdapterisdonewithitandtheBPELprocessis
started.ThismakesacaseforusingthelogicaldeleteprovidedintheDbAdapterifyouwanttouse
thismechanismandnotupdatethefieldlaterintheBPELprocess.

UsingdistributedpollingincombinationwithlogicaldeleteishowevernotrecommendedbyOracle
fromthemanual(HelpbuttonintheJDeveloperwizard)Abetteralternativeistoseteither
NumberOfThreadsorMarkReservedValueforlogicaldeleteordeletestrategies.

Itestedthesameprocesswithdistributedpollingenabed.Stillasmallnumberofprocessesfailed
withauniquekeyconstraintthusthismechanismisnot100%safe.Ididgetabitbetterresults
however.

Unreadandreservedvalue

UnreadValue

SettingtheUnreadvaluecausestheselectqueryusedforpollingtocontainawhereclause
matchingthefieldtotheUnreadvalue.DuringmytestIfoundthatsettingtheUnreadvalueinthe
DbAdapterconfigurationwizardcausedmyprocessnottopickuprecordswiththesetvalue.Ihave
howeverseenatcustomersthatthisvaluewasusedsuccesfullytolimittherecordsbeingpickedup.

Thehelpdocumentationsaysthefollowing(whichmademedoubtthepurposeofthisfield)Unread
Value
(Optional)Enteranexplicitvaluetoindicatethattherowdoesnotneedtoberead.Duringpolling,

http://javaoraclesoa.blogspot.in/2012/04/pollingwithdbadapterinclustered.html 3/7
10/6/2016 OracleSOA/Javablog:PollingwiththeDbAdapterinaclusteredenvironment
thisrowisskipped.

Thebelowimageshowedasettingthatdidwork.

Reservedvalue

InthereleasenotesofSOASuite11.1.1.4
(https://supporthtml.oracle.com/epmos/faces/ui/km/SearchDocDisplay.jspx?
_afrLoop=3308018508015000&type=DOCUMENT&id=1290512.1&displayIndex=3&_afrWindowMode=
0&_adf.ctrlstate=y8cqyff7j_134),thefollowingisdocumented

18.1.5.1DistributedPollingUsingMarkReservedValueDisabledbyDefault
Inthisrelease,Oraclerecommendsthatyouusethenewdistributedpollingapproachbasedonskip
locking.WheneditinganOracleDatabaseAdapterservicewhichhasaMarkReservedValueset,that
valuewillberemovedtoenablethenewbestpractice.Tousetheolddistributedpollingapproach
basedonareservedvalue,selectthevaluefromthedropdownmenu.

InthehelpinJDeveloper,thefollowingisdocumentedfordistributedpolling(skiplockingas
mentionedabove)DistributedPolling.Selectthischeckboxifdistributedpollingisrequired.
However,thisimplementationusesaSELECTFORUPDATEcommand.Abetteralternativeistoset
eitherNumberOfThreadsorMarkReservedValueforlogicaldeleteordeletestrategies.

Asyoucanseeintheabovescreenshots,itispossibletosetareservedvalue.

http://javaoraclesoa.blogspot.in/2012/04/pollingwithdbadapterinclustered.html 4/7
10/6/2016 OracleSOA/Javablog:PollingwiththeDbAdapterinaclusteredenvironment

Thisreservedvalue(MarkReservedValuein*_db.jca)causesaninstanceoftheprocesstosetan
identifier.Thisidentifierisskippedbytheotherpollinginstancesinthecluster.

WhenIhowevertriedtousethissetting(ReservedValue)in11.1.1.6(ofcoursesettingtheUnread
valueto''),InoticedtheDbAdapterdidnotpickupanymessages.WhenchangingtheReadValue
andredeploying(afteremptyingthereservedvalue),itdidpickupmessagesagainimmediately.I'm
notsurewhyitdidn'tworkinthistest.Myguessisforthistowork,anadditionalsettingisrequired.
IfI'vefoundthissetting,Iwillupdatethispost.AlsonoticethewizardemptiestheReservedValueif
yougothroughitagain.Forthetimebeing,I'llusetheskiplockingsetting(distributedpolling).

SingletonDbAdapter

Basedonasuggestiondoneinthecommentsofthispost,thereisalsotheoptiontoconfigurethe
DbAdapterasasingletonwithaJCAproperty.

Seethedocumentationformoreinformationonthis
http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/life_cycle.htm#BABDAFBH

Thebehaviorofthispropertyisdescribedinthefollowingpost
http://ayshaabbas.blogspot.nl/2012/11/dbadaptersingletonbehaviourinhigh.html

GeplaatstdoorMaartenSmeetsop18:54

+8 Recommend this on Google

Labels:bpel,cluster,dbadapter,distributedpolling,markreservedvalue,polling,reservedvalue,
singleton

8 reacties

Reageren

Beste opmerkingen

Mr Jibon 1 maand geleden (bewerkt) - Openbaar gedeeld



This is a great article, really appreciate the info. I've been using
www.leaderpoll.com to generate polls and share on social media. It's 100%
free.
Vertalen

1 Beantwoorden

Arjun Singh 2 jaar geleden - Openbaar gedeeld



Thanks
Vertalen
http://javaoraclesoa.blogspot.in/2012/04/pollingwithdbadapterinclustered.html 5/7
10/6/2016 OracleSOA/Javablog:PollingwiththeDbAdapterinaclusteredenvironment
Vertalen

+1 1 Beantwoorden
2

Fengxi Li 2 jaar geleden - Openbaar gedeeld



Thank you for your sharing.
I have a problem when using the DB Adapter polling. I want to update the
status back to the unprocessed value in bpel when some error occurs. In the
adapter I am using the logical delete to update the status to Y.
But I found the update of status in bpel process doesn't work. The status value
remains Y.
I'm using default async of the adapter and no distribute polling. Can you give
some suggestions?
Vertalen

+4 1 Beantwoorden
5

Usman Javaid 3 jaar geleden



Thanks Maarten! Now I am singleton property to true in composite.xml and it
is running ne.

Maarten Smeets 3 jaar geleden



When deploying a process to a cluster, usually you rst deploy the process to
the rst node. The cluster then deploys the process at a later time to the other
nodes of the cluster. The time at which a process at a specic node starts
polling can differ because of this. In your case I think the process at the rst
node
Meer starts polling at 05:13:21 and after 8 minutes; 05:21:21. The process on
weergeven

Usman Javaid 3 jaar geleden


I am having a problem with BPEL process (Database adapter) on clustered
environment (2 nodes). The adapter is supposed to poll a database table for
changes after 8 minutes interval (PollingInterval=480) but it is working in a
different manner. 1) BPEL instance is created and it polls at table (time
05:13:21) 2) BPEL instance is created and it polls at table (time 05:14:54)
Meer weergeven

Maarten Smeets 4 jaar geleden


inbound operations I would suggest using a shared storage and the
For
archive/delete options. As an alternative, I've seen a customer cluster
implementation where there was no shared storage and inbound les were put
on different servers (each running a managed server) in the same directory.
The
Meerdistribution of where (on which server) to put the inbound les, was done
lezen (10 regels)

Sridhar 4 jaar geleden



Thanks for Nice Article. How about the File Polling in Clustered envionrment. Is
there any way apart from deleting/archiving the le for avoiding it to be picked
up by another managed server.

Nieuwerbericht Startpagina Ouderbericht

Abonnerenop:Reactiesplaatsen(Atom)

http://javaoraclesoa.blogspot.in/2012/04/pollingwithdbadapterinclustered.html 6/7
10/6/2016 OracleSOA/Javablog:PollingwiththeDbAdapterinaclusteredenvironment
SjabloonAwesomeInc..MogelijkgemaaktdoorBlogger.

http://javaoraclesoa.blogspot.in/2012/04/pollingwithdbadapterinclustered.html 7/7

You might also like