版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Message QueuingConceptsObjectivesAftercompletingthislesson,youshouldbeabletodothefollowing:ConfiguresecurequeueusersforenqueuinganddequeuingmessagesConfigureamessagingclientfordequeuingeventsDescribetheprocessofenqueuinganddequeuingeventsConfiguremessagenotificationManageAdvancedQueuingqueues,queuetables,propagationschedules,andtransformationsbyusingEnterpriseManagerEnqueuingEventsEventscanbeenqueuedintoastagingqueueinthreeways:AcaptureprocessenqueuesDMLandDDLchangesasLCRevents.AuserapplicationenqueuesusermessagesorLCRsaseventsoftypeSYS.AnyData.
Anenqueuedirectiveinstructsanapplyprocesstoenqueuecertaineventsintothestagingqueue.SecureQueueUsersForausertobeabletoenqueueordequeuemessagesfromasecureagentqueue,youmustconfiguretheuserasasecurequeueuser.UseDBMS_STREAMS_ADM.SET_UP_QUEUEtoconfigureasecurequeueuser.BEGINDBMS_STREAMS_ADM.SET_UP_QUEUE(queue_table=>'ix.streams_queue_table',queue_name=>'streams_queue',queue_user=>'ix');END;/SubscriptionsandRecipientListsTheSYS.AnyDataqueueisamulticonsumerqueuethatallowsconsumptionofamessagebymorethanoneconsumer.Alistofconsumersforamessageisidentifiedbyusing:SubscriptionAddasubscriptiontoaqueuebyusingtheDBMS_AQADM.ADD_SUBSCRIBERprocedureRecipientlistSpecifiedintherecipient_listmessagepropertywhenthemessageisenqueuedProceduresforConfiguringAQAgentsDBMS_AQADM.CREATE_AQ_AGENT(agent_nameINVARCHAR2,enable_httpINBOOLEANDEFAULTFALSE,enable_smtpINBOOLEANDEFAULTFALSE,enable_anypINBOOLEANDEFAULTFALSE);DBMS_AQADM.ENABLE_DB_ACCESS(agent_nameINVARCHAR2,db_usernameINVARCHAR2)DBMS_AQADM.ADD_SUBSCRIBER(queue_nameINVARCHAR2,subscriberINsys.aq$_agent,ruleINVARCHAR2DEFAULTNULL,transformationINVARCHAR2DEFAULTNULL);CreatingaSubscriberToconfigureasecurequeueuserasasubscriber,thusenablingthemtodequeuemessagesoreventsfromaqueue,usethe:SYS.AQ$_AGENTtypetospecifytheAQagentDBMS_AQADM.ADD_SUBSCRIBERproceduretospecifythattheagentisasubscribertothequeueDECLAREsubscriberSYS.AQ$_AGENT;BEGINsubscriber:=SYS.AQ$_AGENT('IX',NULL,NULL);SYS.DBMS_AQADM.ADD_SUBSCRIBER(queue_name=>'ix.streams_queue',subscriber=>subscriber);END;/MessagingClientUserAmessagingclient:Consumesuser-enqueuedeventsfromaSYS.AnyDataqueuebasedonrulesIsinvokedbyauserorapplicationIsassociatedwithonlyonedatabaseuserAmessagingclientuser:CreatesthemessagingclientusingproceduresintheDBMS_STREAMS_ADMpackageIsgrantedtheprivilegestodequeuefromthequeueCanbeassociatedwithmanymessagingclientsCreatingaMessagingClientDBMS_STREAMS_ADM.ADD_TABLE_RULES(table_name=>'oe.orders',streams_type=>'dequeue',streams_name=>'ORDERS_DEQ',queue_name=>'ix.streams_queue',source_database=>'',inclusion_rule=>true);Applicationdequeue
usingmessagingclientCreatingMessagingClientRulesDBMS_STREAMS_ADM.ADD_MESSAGE_RULE(message_type=>'ix.order_event_typ',rule_condition=>':msg.delivery_date<SYSDATE',streams_type=>'dequeue',streams_name=>'ORDERS_DEQ',queue_name=>'ix.streams_queue',inclusion_rule=>true);Applicationdequeue
usingmessagingclientUser-CreatedEventsMustbeexplicitlyenqueuedCanbeamessageofanydatatypeoruser-definedtypeMustbewrappedinaSYS.AnyDatatypetobeenqueuedinaSYS.AnyDataqueueCanalsobeaJavaMessageService(JMS)typemessageUser-EnqueuedEventsThemessagepayloadisoftypeSYS.AnyData.YoucanenqueuemessageswithdifferenttypesofpayloadsintoaStreamsstagingqueuebywrappingthemessageintheSYS.AnyDatatype:User-createdLCRsStandarddatatypesUser-definedobjecttypesSYS.AnyData
typeApplicationWrappingMessagePayloadsUsetheCONVERT<data_type>staticfunctionsoftheSYS.AnyDatatype,wheredata_typeisthetypeofobjecttowrap.Alldatatypesaresupportedexcept:CLOB,NCLOB,BLOB,orROWIDUser-definedtypeswithLOBattributes(includingCLOB,
NCLOB,andBLOB)NestedtableSYS.AnyData.ConvertObject(ix.order_event_typ(2424,3350,146,'Elia','Fawcett',4,TO_DATE('18-AUG-02')))StreamsMessageswithObjectTypesEachuser-definedtypethatisusedinamessagemustexistateverydatabasewherethemessagemaybestagedinaqueue.Thetypemusthavethesamename,owner,andformateachdatabase.Typeevolutionandinheritanceisnotsupported.Thetype’sobjectidentifier(OID)doesnothavetobethesameforeachdatabase.StreamsMessagesContainingLCRsAnexplicitlyenqueuedmessagecanbe:AnLCRwrappedintheSYS.AnyDatatypeAuser-definedtypethatcontainsanLCRasanattributeLCRwrappedin
SYS.AnyDatatypeidLCRObjecttypewithLCR
attributewrappedin
SYS.AnyDatatypeDequeuingMessagesinStreamsTheoperationofretrievingmessagesfromaqueueisknownasdequeuing.User-enqueuedeventsinthestagingqueuecanbedequeuedautomatically:Applyhandlesuser-enqueuedLCReventsinthesamemannerascapturedLCRevents.Applyconfiguredwithamessagehandlerdequeuesandprocessesnon-LCRevents.YoucanusetheDBMS_STREAMS_ADM.DEQUEUEorDBMS_AQ.DEQUEUEprocedurestoexplicitlydequeueuser-enqueuedevents.UnwrappingMessagePayloadsUsetheGET<datatype>staticfunctionsoftheSYS.AnyDatatype,where<datatype>isthetypeofobjecttounwrap.UsetheGETTYPEorGETTYPENAMEstaticfunctionsoftheSYS.AnyDatatypetodeterminethetypeofembeddeddata....IF(evt.GetType()=DBMS_TYPE.TYPECODE_VARCHAR2)
THENnum_var:=evt.GetVarchar2(string_var);ELSEIF(evt.GetTypeName()='SYS.LCR$_ROW_RECORD')THENnum_var:=evt.GetObject(rowLCR);...MessageHandlersforUserMessagesUsermessages(non-LCRevents)arealwaysprocessedbyamessagehandler.Themessagehandlermustperformanyneededdependencychecking.Therecanbeonlyasinglemessagehandlerperapplyprocess.Non-LCReventMessagehandlerMessageHandlersAmessagehandlerisauser-definedprocedurethatcanprocessnon-LCRusermessagesinacustomizedwayforyourenvironment.Youcanspecifyamessagehandlerforanapplyprocessbyusingthemessage_handlerparameterintheDBMS_APPLY_ADMpackage:CREATE_APPLYALTER_APPLYTheapplyprocesshandlesthedequeueoperation.Ifdependenciesexistbetweenthesemessagesinyourenvironment,setparallelismto1fortheapplyprocess.MessageHandler:ExampleCREATEORREPLACEPROCEDUREorder_events_mh
(evtSYS.AnyData)ISordorder_event_typ;dummyNUMBER;BEGINIF(evt.getTypeName='OE.ORDER_EVENT_TYP')THENdummy:=evt.getObject(ord);CASEWHENord.shipdays=0THEN<routebilling>;WHENord.shipdays<=3THEN<routepriority>;WHENord.shipdays>3THEN<routenormal>;ENDCASE;INSERTINTOoe.order_logVALUES(ord.order_number,ord.part_number,SYSTIMESTAMP);ENDIF;END;UsingaMessageHandlerCreateanapplyprocessthatisassociatedwiththedestinationqueue.Configurethemessagehandlerfortheapplyprocess.Createatleastonerulefortheapplyprocessrelatingtotheuser-enqueuedevent,andplaceitinthepositiveornegativeruleset.Starttheapplyprocess.ConfiguringMessageNotificationEXECUTE-DBMS_STREAMS_ADM.SET_MESSAGE_NOTIFICATION(-streams_name=>'ORDERS_DEQ',-notification_action=>'john.doe@',-notification_type=>'MAIL',-include_notification=>true,-queue_name=>'IX.STREAMS_QUEUE');MessagingclientNotificationSupportedNotificationTypesForURLnotifications,specifyaURLwithouttheprefixhttp://ForPL/SQLprocedurenotifications,specifyaPL/SQLprocedurename:Fore-mailnotifications,specifyane-mailaddress:notification_type=>'HTTP'notification_action=>':8080'notification_type=>'PROCEDURE'notification_action=>'oe.notify_addr_arrival'
notification_type=>'MAIL'notification_action=>'John.Doe@'
PurgingtheQueueTheDBMS_AQADM.PURGE_QUEUE_TABLEprocedure:RemovesmessagesfrompersistentqueuesIsusefulforbothsingle-consumerandmulticonsumerqueuesCanbecustomizedtopurgeonlymessagesthatmeetspecificconditionsPurgingtheQueueWhenpurgingeventsfromaqueue,youcanspecify:ApurgeconditionWhetheranexclusivelockisobtainedduringthepurgeoperationDECLAREpurge_optDBMS_AQADM.aq$_purge_options_t;BEGINpurge_opt.block:=TRUE;DBMS_AQADM.PURGE_QUEUE_TABLE(queue_table=>'STRMADMIN.STREAMS_QUEUE_TABLE',purge_condition=>'queue=''STREAMS_QUEUE''',purge_options=>purge_opt);END;PurgeConditions:ExamplesPurgealleventsinaqueuetable
Purgeallevent
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年4月广东 深圳市曙光中学面向2026年应届毕业生深圳设点招聘教师8人(编制)考试模拟试题及答案解析
- 2026年浙江绍兴市柯桥区教体系统新教师招聘70人(三)笔试备考试题及答案解析
- 2026四川颂纳万祥集团招聘阿坝县、壤塘县国有持股人力资源公司经理2人考试模拟试题及答案解析
- 2026贵州遵义市余庆县招聘11名城镇公益性岗位人员笔试参考题库及答案解析
- 2026年河南省郑州登封市事业单位联考招聘考试参考题库及答案解析
- 2026年4月广东深圳市曙光中学面向社会选聘教师8人笔试备考试题及答案解析
- 2026年春季江苏南通市崇川区区属国有集团下属子公司招聘4人笔试备考试题及答案解析
- 2026甘肃省疾病预防控制中心考核招聘急需紧缺人才2人考试模拟试题及答案解析
- 2026青岛农业大学海都学院博士人才招聘笔试备考题库及答案解析
- 2026广东清远市连山壮族瑶族自治县永和镇招聘上草村、大富村党建组织员3人考试参考题库及答案解析
- 2026内蒙古呼和浩特市北兴产业投资发展有限责任公司及所属子公司招聘27人笔试参考题库及答案解析
- 四川省绵阳市高中2023级(2026届)高三年级第三次诊断性考试(绵阳三诊)语文+答案
- 交通运输局审核审批制度
- 新教材人教版八年级数学下学期期中测试卷
- 2026年烟草浙江公司笔试试题(含答案)
- 2026年诊断性介入肺脏病学快速现场评价临床实施指南(全文)
- GB/T 9799-2024金属及其他无机覆盖层钢铁上经过处理的锌电镀层
- 诈骗案件授课PPT课件
- 第四节教学模式及策略方法ppt课件
- 基于三菱FX2N系列PLC的全自动洗衣机控制系统方案
- 《不再一样》单元三神追求与人建立爱的关系
评论
0/150
提交评论