1: package body WF_EVENT as
2: /* $Header: WFEVENTB.pls 120.22.12020000.3 2013/04/25 06:29:14 skandepu ship $ */
3: --------------------------------------------------------------------------
4: /*
5: ** PRIVATE global variables
4: /*
5: ** PRIVATE global variables
6: */
7:
8: g_packName varchar2(30) :='wf.plsql.wf_event.';
9:
10: /*
11: ** Cache Variables
12: ** pv_last_agent_name - the value of agent name
66: /*
67: ** setMessage (PRIVATE) - Generate the Message for this event
68: ** if necessary
69: */
70: PROCEDURE setMessage(p_event in out nocopy wf_event_t)
71: is
72: msg clob;
73: func varchar2(240);
74: cmd varchar2(1000);
81: plsql_error EXCEPTION;
82: PRAGMA EXCEPTION_INIT(plsql_error, -06550);
83:
84: -- bes caching implementation
85: l_event_obj wf_event_obj;
86: begin
87: /*
88: ** mjc We are now going to call this from the dispatcher
89: ** if the subscription rule data is MESSAGE
87: /*
88: ** mjc We are now going to call this from the dispatcher
89: ** if the subscription rule data is MESSAGE
90: */
91: --if (wf_event.test(ename) = 'MESSAGE') then
92:
93: l_event_obj := wf_bes_cache.GetEventByName(ename);
94:
95: if (l_event_obj is null) then
92:
93: l_event_obj := wf_bes_cache.GetEventByName(ename);
94:
95: if (l_event_obj is null) then
96: wf_core.context('Wf_Event', 'setMessage', ename, ekey);
97: wf_core.raise('WFE_EVENT_NOTEXIST');
98: end if;
99:
100: func := l_event_obj.GENERATE_FUNCTION;
102: if (func is not null) then
103:
104: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
105: wf_log_pkg.string2(wf_log_pkg.level_statement,
106: 'wf.plsql.wf_event.SetMessage.genfunc_callout',
107: 'Start executing generate function - '||func, true);
108: end if;
109:
110: WF_BES_DYN_FUNCS.Generate(func,
118: of the parameter list as well. To make sure we are compatible
119: with 2.6.0, we catch any error if there are too many parameters
120: and try again with the old API signature (eventname, eventkey)
121: **/
122: -- func came from WF_EVENTS.GENERATE_FUNCTION
123: -- BINDVAR_SCAN_IGNORE
124: cmd := 'begin :v1 := '||func||'(:v2, :v3, :v4); end;';
125: begin
126: execute immediate cmd using in out msg, in ename, in ekey, in eplist;
133: end if;
134:
135: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
136: wf_log_pkg.string2(wf_log_pkg.level_statement,
137: 'wf.plsql.wf_event.SetMessage.genfunc_callout',
138: 'End executing generate function - '||func, false);
139: end if;
140:
141: else
152: when others then
153: if (Wf_Core.Error_Name = 'WFE_EVENT_NOTEXIST') then
154: raise;
155: else
156: wf_core.context('Wf_Event', 'setMessage', ename, ekey, func);
157: WF_CORE.Token('ENAME', p_event.event_name);
158: wf_core.token('FUNCTION_NAME', func);
159: WF_CORE.Token('SQLCODE', to_char(sqlcode));
160: WF_CORE.Token('SQLERRM', sqlerrm);
164: -----------------------------------------------------------------------
165: /*
166: ** setErrorInfo -
167: */
168: PROCEDURE setErrorInfo(p_event in out nocopy wf_event_t,
169: p_type in varchar2)
170: is
171: err_name varchar2(30);
172: err_msg varchar2(2000);
174: begin
175:
176: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
177: wf_log_pkg.string(wf_log_pkg.level_procedure,
178: 'wf.plsql.WF_EVENT.setErrorInfo.begin',
179: 'Setting Error Info');
180: end if;
181:
182: -- First look for a standard WF_CORE exception.
194: p_event.addParameterToList('ERROR_NAME', err_name);
195: p_event.addParameterToList('ERROR_TYPE', p_type);
196: exception
197: when others then
198: wf_core.context('Wf_Event', 'setErrorInfo', p_event.getEventName());
199: raise;
200: end;
201: -----------------------------------------------------------------------
202: /*
201: -----------------------------------------------------------------------
202: /*
203: ** saveErrorToQueue (PRIVATE) - Save the event to the WF_ERROR queue.
204: */
205: PROCEDURE saveErrorToQueue(p_event in out nocopy wf_event_t)
206: is
207: erragt wf_agent_t;
208: cmd varchar2(1000);
209: begin
209: begin
210:
211: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
212: wf_log_pkg.string(wf_log_pkg.level_procedure,
213: 'wf.plsql.WF_EVENT.saveErrorToQueue.Begin',
214: 'saving event to WF_ERROR on '|| wf_event.local_system_name);
215: end if;
216:
217: erragt := wf_agent_t('WF_ERROR', wf_event.local_system_name);
210:
211: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
212: wf_log_pkg.string(wf_log_pkg.level_procedure,
213: 'wf.plsql.WF_EVENT.saveErrorToQueue.Begin',
214: 'saving event to WF_ERROR on '|| wf_event.local_system_name);
215: end if;
216:
217: erragt := wf_agent_t('WF_ERROR', wf_event.local_system_name);
218:
213: 'wf.plsql.WF_EVENT.saveErrorToQueue.Begin',
214: 'saving event to WF_ERROR on '|| wf_event.local_system_name);
215: end if;
216:
217: erragt := wf_agent_t('WF_ERROR', wf_event.local_system_name);
218:
219: --
220: -- mjc - lets just call the API directly
221: --
225: --execute immediate cmd using in p_event,
226: -- in erragt;
227: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
228: wf_log_pkg.string(wf_log_pkg.level_procedure,
229: 'wf.plsql.WF_EVENT.saveErrorToQueue.End',
230: 'error info saved');
231: end if;
232: exception
233: when others then
230: 'error info saved');
231: end if;
232: exception
233: when others then
234: wf_core.context('Wf_Event', 'saveErrorToQueue', p_event.getEventName());
235: wf_core.token('FUNCTION_NAME', 'WF_ERROR_QH.enqueue()');
236: --wf_core.raise('WF_EXT_FUNCTION');
237: raise;
238: end;
240: -----------------------------------------------------------------------
241: /*
242: ** saveErrorToJavaQueue (PRIVATE) - Save the event to the WF_JAVA_ERROR queue.
243: */
244: PROCEDURE saveErrorToJavaQueue(p_event in out nocopy wf_event_t)
245: is
246: erragt wf_agent_t;
247: cmd varchar2(1000);
248: begin
248: begin
249:
250: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
251: wf_log_pkg.string(wf_log_pkg.level_procedure,
252: 'wf.plsql.WF_EVENT.saveErrorToJavaQueue.Begin',
253: 'saving event to WF_JAVA_ERROR on '|| wf_event.local_system_name);
254: end if;
255:
256: erragt := wf_agent_t('WF_JAVA_ERROR', wf_event.local_system_name);
249:
250: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
251: wf_log_pkg.string(wf_log_pkg.level_procedure,
252: 'wf.plsql.WF_EVENT.saveErrorToJavaQueue.Begin',
253: 'saving event to WF_JAVA_ERROR on '|| wf_event.local_system_name);
254: end if;
255:
256: erragt := wf_agent_t('WF_JAVA_ERROR', wf_event.local_system_name);
257:
252: 'wf.plsql.WF_EVENT.saveErrorToJavaQueue.Begin',
253: 'saving event to WF_JAVA_ERROR on '|| wf_event.local_system_name);
254: end if;
255:
256: erragt := wf_agent_t('WF_JAVA_ERROR', wf_event.local_system_name);
257:
258: --
259: -- mjc - lets just call the API directly
260: --
257:
258: --
259: -- mjc - lets just call the API directly
260: --
261: WF_EVENT_OJMSTEXT_QH.enqueue(p_event, erragt);
262:
263: --cmd := 'begin WF_ERROR_QH.enqueue(:v1, :v2); end;';
264: --execute immediate cmd using in p_event,
265: -- in erragt;
264: --execute immediate cmd using in p_event,
265: -- in erragt;
266: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
267: wf_log_pkg.string(wf_log_pkg.level_procedure,
268: 'wf.plsql.WF_EVENT.saveErrorToJavaQueue.End',
269: 'error info saved');
270: end if;
271: exception
272: when others then
269: 'error info saved');
270: end if;
271: exception
272: when others then
273: wf_core.context('Wf_Event', 'saveErrorToQueue', p_event.getEventName());
274: wf_core.token('FUNCTION_NAME', 'WF_EVENT_OJMSTEXT_QH.enqueue()');
275: --wf_core.raise('WF_EXT_FUNCTION');
276: raise;
277: end;
270: end if;
271: exception
272: when others then
273: wf_core.context('Wf_Event', 'saveErrorToQueue', p_event.getEventName());
274: wf_core.token('FUNCTION_NAME', 'WF_EVENT_OJMSTEXT_QH.enqueue()');
275: --wf_core.raise('WF_EXT_FUNCTION');
276: raise;
277: end;
278: --------------------------------------------------------------------------
291: p_phase in pls_integer)
292: return boolean
293: is
294: -- bes caching implementation
295: l_event_obj wf_event_obj;
296: l_subs_list wf_event_subs_tab;
297: l_java_defer boolean;
298: l_java_gen boolean;
299: l_phase number;
292: return boolean
293: is
294: -- bes caching implementation
295: l_event_obj wf_event_obj;
296: l_subs_list wf_event_subs_tab;
297: l_java_defer boolean;
298: l_java_gen boolean;
299: l_phase number;
300: l_rule_func varchar2(240);
301: l_rule_data varchar2(8);
302: begin
303: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
304: wf_log_pkg.string(wf_log_pkg.level_procedure,
305: 'wf.plsql.WF_EVENT.isDeferToJava.begin',
306: 'Checking for Java subscription/generate');
307: end if;
308:
309: if (p_rule_func is not null AND
310: UPPER(substr(p_rule_func, 0, length(java_sub))) = UPPER(java_sub)) then
311: -- this is a Java subscription. Return true
312: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
313: wf_log_pkg.string(wf_log_pkg.level_statement,
314: 'wf.plsql.WF_EVENT.isDeferToJava.Subscription',
315: 'found a Java subscription');
316: end if;
317: return true;
318: end if;
338: p_rule_data = 'MESSAGE' and p_source_type = 'LOCAL') then
339: -- this is a Java generate function.
340: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
341: wf_log_pkg.string(wf_log_pkg.level_statement,
342: 'wf.plsql.WF_EVENT.isDeferToJava.Subscription',
343: 'found a Java generate function');
344: end if;
345: return true;
346: else
374:
375: if(l_java_defer) then
376: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
377: wf_log_pkg.string(wf_log_pkg.level_statement,
378: 'wf.plsql.WF_EVENT.isDeferToJava.Subscription',
379: 'found subsequent Java sub or java generate');
380: end if;
381: return true;
382: else
381: return true;
382: else
383: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
384: wf_log_pkg.string(wf_log_pkg.level_statement,
385: 'wf.plsql.WF_EVENT.isDeferToJava.Subscription',
386: 'No Java sub found or Java Generate Found');
387: end if;
388: return false;
389: end if;
390: end if;
391:
392: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
393: wf_log_pkg.string(wf_log_pkg.level_procedure,
394: 'wf.plsql.WF_EVENT.isDeferToJava.end',
395: 'Checked for Java subscription/generate');
396: end if;
397:
398: return false;
397:
398: return false;
399: exception
400: when others then
401: wf_core.context('Wf_Event', 'isDeferToJava', p_event_name);
402: raise;
403: end isDeferToJava;
404:
405: --------------------------------------------------------------------------
415:
416: begin
417: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
418: wf_log_pkg.string(wf_log_pkg.level_procedure,
419: 'wf.plsql.WF_EVENT.isSaveToJavaError.begin',
420: 'Checking Java Error subscription for ' || p_event_name);
421: end if;
422:
423: if (p_rule_func is not null AND
424: UPPER(substr(p_rule_func, 0, length(java_sub))) = UPPER(java_sub)) then
425: -- this is a Java subscription. Return true
426: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
427: wf_log_pkg.string(wf_log_pkg.level_statement,
428: 'wf.plsql.WF_EVENT.isSaveToJavaError.Subscription',
429: 'found a Java subscription');
430: end if;
431: return true;
432: end if;
435: /*
436: ** GetSkippedSub - utility function to get the subscription has skip onerror
437: ** type
438: */
439: function GetSkippedSub(p_event in wf_event_t)
440: return RAW is
441: l_skip_sub_str VARCHAR2(300);
442: begin
443: l_skip_sub_str := p_event.GETVALUEFORPARAMETER('SKIP_ERROR_SUB');
457: p_sub_guid in raw,
458: p_source_agent_guid in raw,
459: p_phase in number,
460: p_priority in number,
461: p_event in out nocopy wf_event_t,
462: p_on_error in varchar2)
463: return varchar2
464: is
465: res varchar2(20);
489: if (wf_core.database_current_edition <> wf_core.database_default_edition) and
490: (p_event.send_date is null or p_event.send_date <= sysdate) then
491: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
492: wf_log_pkg.string(wf_log_pkg.level_statement,
493: 'wf.plsql.WF_EVENT.dispatch_internal',
494: 'Database not in RUN edition - discarding event');
495: end if;
496: return 'SUCCESS';
497: end if;
495: end if;
496: return 'SUCCESS';
497: end if;
498: -- Verify if the subscription is eligible for execution.
499: if ((wf_event.local_system_status = 'ENABLED' OR
500: wf_event.local_system_status = p_source_type)
501: OR
502: (wf_event.local_system_status <> 'DISABLED' AND
503: p_source_type = 'ERROR'))
496: return 'SUCCESS';
497: end if;
498: -- Verify if the subscription is eligible for execution.
499: if ((wf_event.local_system_status = 'ENABLED' OR
500: wf_event.local_system_status = p_source_type)
501: OR
502: (wf_event.local_system_status <> 'DISABLED' AND
503: p_source_type = 'ERROR'))
504: AND
498: -- Verify if the subscription is eligible for execution.
499: if ((wf_event.local_system_status = 'ENABLED' OR
500: wf_event.local_system_status = p_source_type)
501: OR
502: (wf_event.local_system_status <> 'DISABLED' AND
503: p_source_type = 'ERROR'))
504: AND
505: (p_phase >= wf_event.phase_minthreshold) then
506:
501: OR
502: (wf_event.local_system_status <> 'DISABLED' AND
503: p_source_type = 'ERROR'))
504: AND
505: (p_phase >= wf_event.phase_minthreshold) then
506:
507: --Bug 2519183
508: --If we are in the deferred processing of an
509: --event we will set back the minthreshold so that its
511: --This is after all processed subscriptions have been
512: --discarded hence its fine to set the phase_minthreshold
513: --to zero.
514:
515: if ((wf_event.phase_minthreshold > 0) AND
516: (p_event.from_agent is NOT NULL)) then
517: --Bug 3451981
518: --In the case of EXTERNAL events the from_agent will
519: --not be WF_DEFERRED , in this case no further event
525: --So we can possibly check if it is 'EXTERNAL'
526: --and as we know from the check of min_threshold
527: --that we are deferprocessing lets re-set it.
528: if ((p_event.from_agent.getName = 'WF_DEFERRED') OR (p_source_type = 'EXTERNAL')) then
529: wf_event.phase_minthreshold := 0;
530: end if ;
531: end if;
532:
533: --
538: -- the deferred queue.
539: --
540: -- YOHUANG Bug 4227307
541: -- Error Subscription should never be deferred.
542: if (wf_event.phase_maxthreshold is not null) AND
543: (p_phase >= wf_event.phase_maxthreshold) AND
544: (p_source_type <> 'ERROR')
545: then
546: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
539: --
540: -- YOHUANG Bug 4227307
541: -- Error Subscription should never be deferred.
542: if (wf_event.phase_maxthreshold is not null) AND
543: (p_phase >= wf_event.phase_maxthreshold) AND
544: (p_source_type <> 'ERROR')
545: then
546: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
547: wf_log_pkg.string(wf_log_pkg.level_statement,
544: (p_source_type <> 'ERROR')
545: then
546: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
547: wf_log_pkg.string(wf_log_pkg.level_statement,
548: 'wf.plsql.WF_EVENT.dispatch_internal.Subscription',
549: 'max threshold reached');
550: end if;
551: max_threshold_reached := true;
552: end if;
564:
565: if(defer_to_java OR max_threshold_reached ) then
566: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
567: wf_log_pkg.string(wf_log_pkg.level_statement,
568: 'wf.plsql.WF_EVENT.dispatch_internal.Subscription',
569: 'detected as deferred');
570: end if;
571: --
572: -- mjc Set action priority now, if we defer, this can be used
589:
590: if(defer_to_java) then
591: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
592: wf_log_pkg.string(wf_log_pkg.level_statement,
593: 'wf.plsql.WF_EVENT.dispatch_internal.Subscription',
594: 'deferring to WF_JAVA_DEFERRED');
595: end if;
596: wf_event.DeferEventToJava(p_source_type, p_event);
597: else
592: wf_log_pkg.string(wf_log_pkg.level_statement,
593: 'wf.plsql.WF_EVENT.dispatch_internal.Subscription',
594: 'deferring to WF_JAVA_DEFERRED');
595: end if;
596: wf_event.DeferEventToJava(p_source_type, p_event);
597: else
598: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
599: wf_log_pkg.string(wf_log_pkg.level_statement,
600: 'wf.plsql.WF_EVENT.dispatch_internal.Subscription',
596: wf_event.DeferEventToJava(p_source_type, p_event);
597: else
598: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
599: wf_log_pkg.string(wf_log_pkg.level_statement,
600: 'wf.plsql.WF_EVENT.dispatch_internal.Subscription',
601: 'deferring to WF_DEFERRED');
602: end if;
603: wf_event.deferevent(p_source_type, p_event);
604: end if;
599: wf_log_pkg.string(wf_log_pkg.level_statement,
600: 'wf.plsql.WF_EVENT.dispatch_internal.Subscription',
601: 'deferring to WF_DEFERRED');
602: end if;
603: wf_event.deferevent(p_source_type, p_event);
604: end if;
605: res := 'DEFER';
606:
607: elsif (save_to_java_error) then
606:
607: elsif (save_to_java_error) then
608: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
609: wf_log_pkg.string(wf_log_pkg.level_statement,
610: 'wf.plsql.WF_EVENT.dispatch_internal.Subscription',
611: 'save to java error queue');
612: end if;
613: p_event.error_subscription := p_sub_guid;
614: wf_event.saveErrorToJavaQueue(p_event);
610: 'wf.plsql.WF_EVENT.dispatch_internal.Subscription',
611: 'save to java error queue');
612: end if;
613: p_event.error_subscription := p_sub_guid;
614: wf_event.saveErrorToJavaQueue(p_event);
615: res := 'DEFER';
616: else
617: -- Generate Method is irrelavant to subscription.
618: -- Exception happened in Generate Method should be thrown
626: (p_rule_data = 'MESSAGE') AND
627: (p_source_type = 'LOCAL') then
628: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
629: wf_log_pkg.string(wf_log_pkg.level_statement,
630: 'wf.plsql.WF_EVENT.dispatch_internal.Rule_Data',
631: 'Rule Data is MESSAGE and Source is LOCAL');
632: end if;
633: -- if dbms_lob.istemporary(p_event.GetEventData()) = 0 then
634: -- Bug Fix for 4286207
636: if (p_event.GetEventData() is null) or
637: (p_event.GetEventData() is not null and dbms_lob.getlength(p_event.GetEventData()) = 0) then
638: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
639: wf_log_pkg.string(wf_log_pkg.level_statement,
640: 'wf.plsql.WF_EVENT.dispatch_internal.generate',
641: 'Need to Generate Message');
642: end if;
643: wf_event.setMessage(p_event);
644: genmsg := TRUE;
639: wf_log_pkg.string(wf_log_pkg.level_statement,
640: 'wf.plsql.WF_EVENT.dispatch_internal.generate',
641: 'Need to Generate Message');
642: end if;
643: wf_event.setMessage(p_event);
644: genmsg := TRUE;
645: end if;
646: exception
647: when empty_lob_locator then
647: when empty_lob_locator then
648: -- The lob locator is invalid, probably pointing to a empty_clob();
649: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
650: wf_log_pkg.string(wf_log_pkg.level_statement,
651: 'wf.plsql.WF_EVENT.dispatch_internal.generate',
652: 'Invalid Lob Locator Passed, Generate the Message');
653: end if;
654: wf_event.setMessage(p_event);
655: genmsg := TRUE;
650: wf_log_pkg.string(wf_log_pkg.level_statement,
651: 'wf.plsql.WF_EVENT.dispatch_internal.generate',
652: 'Invalid Lob Locator Passed, Generate the Message');
653: end if;
654: wf_event.setMessage(p_event);
655: genmsg := TRUE;
656: end;
657: end if;
658: exception
658: exception
659: when others then
660: rollback to wf_dispatch_savepoint;
661: p_event.setErrorSubscription(p_sub_guid);
662: wf_event.wf_exception_source := 'RULE';
663: raise;
664: end;
665:
666: --If we came here now we can start processing the
691: begin
692:
693: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
694: wf_log_pkg.string2(wf_log_pkg.level_statement,
695: 'wf.plsql.wf_event.dispatch_internal.rulefunc_callout',
696: 'Start executing rule function - '||p_rule_func, true);
697: end if;
698:
699: if (p_rule_func is not null) then
702: p_event,
703: res,
704: executed);
705: if (not executed) then
706: -- p_rule_func came from WF_EVENT_SUBSCRIPTIONS.Rule_Function or
707: -- WF_EVENT_SUBSCRIPTIONS.Java_Rule_Func
708: myfunc := p_rule_func;
709: -- BINDVAR_SCAN_IGNORE
710: cmd := 'begin :v1 := '||myfunc||'(:v2, :v3); end;';
703: res,
704: executed);
705: if (not executed) then
706: -- p_rule_func came from WF_EVENT_SUBSCRIPTIONS.Rule_Function or
707: -- WF_EVENT_SUBSCRIPTIONS.Java_Rule_Func
708: myfunc := p_rule_func;
709: -- BINDVAR_SCAN_IGNORE
710: cmd := 'begin :v1 := '||myfunc||'(:v2, :v3); end;';
711: execute immediate cmd using in out res,
715: end if;
716:
717: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
718: wf_log_pkg.string2(wf_log_pkg.level_statement,
719: 'wf.plsql.wf_event.dispatch_internal.rulefunc_callout',
720: 'End executing rule function - '||p_rule_func, false);
721: end if;
722:
723: exception
729: else
730: rollback to wf_dispatch_savepoint;
731: p_event.setErrorSubscription(p_sub_guid);
732: p_event.addParameterToList('ERROR_TYPE', 'UNEXPECTED');
733: wf_event.wf_exception_source := 'RULE';
734: WF_CORE.Token('ENAME', p_event.event_name);
735: WF_CORE.Token('EKEY', p_event.event_key);
736: WF_CORE.Token('RULE', myfunc);
737: WF_CORE.Token('SQLCODE', to_char(sqlcode));
743:
744: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
745: -- BINDVAR_SCAN_IGNORE[3]
746: wf_log_pkg.string(wf_log_pkg.level_statement,
747: 'wf.plsql.WF_EVENT.dispatch_internal.rule_function',
748: 'Executed Rule Function '||myfunc||' and returned '||res);
749: end if;
750:
751: end if; -- End of "defer_to_java OR max_threshold_reached"
753: -- Bug 4227307
754: -- Handle the subscriptions that are not eligible for execution.
755: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
756: wf_log_pkg.string(wf_log_pkg.level_statement,
757: 'wf.plsql.wf_event.dispatch_internal.subs_ignore',
758: 'Subscription not executed. Sub Phase='||p_phase||
759: ', Min threshold='||wf_event.phase_minthreshold);
760: end if;
761: return 'SUCCESS';
755: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
756: wf_log_pkg.string(wf_log_pkg.level_statement,
757: 'wf.plsql.wf_event.dispatch_internal.subs_ignore',
758: 'Subscription not executed. Sub Phase='||p_phase||
759: ', Min threshold='||wf_event.phase_minthreshold);
760: end if;
761: return 'SUCCESS';
762: end if;
763:
771: if (p_source_type = 'ERROR') then
772: -- If subscription returns error when listener listens on error agent.
773: -- Bug 4207885: Set the exception source to Rule when
774: -- Raising exceptions.
775: wf_event.wf_exception_source := 'RULE';
776: wf_core.token('ENAME', p_event.event_name);
777: wf_core.token('EKEY', p_event.event_key);
778: wf_core.token('SQLERRM', null);
779: wf_core.token('SQLCODE', null);
781: end if;
782:
783: if (res = 'ERROR') then
784:
785: if (WF_EVENT.g_message_grouping = 'TRANSACTIONAL') then
786: raise dispatch_error;
787: end if;
788:
789: begin
807: end;
808: end if;
809:
810:
811: wf_event.saveErrorToQueue(p_event);
812: p_event.AddParameterToList('SKIP_ERROR_SUB', null);
813: return (res);
814:
815: exception
813: return (res);
814:
815: exception
816: when others then
817: wf_core.context('Wf_Event', 'dispatch_internal');
818: raise;
819: end;
820: ---------------------------------------------------------------------------
821: /*
841: wf_core.raise('WFE_AGENT_NOTEXIST');
842: end if;
843: exception
844: when others then
845: wf_core.context('Wf_Event', 'newAgent', p_agent_guid);
846: raise;
847: end;
848: ---------------------------------------------------------------------------
849: /*
854: event_guid raw(16);
855: result varchar2(10) := 'NONE';
856:
857: -- bes caching implementation
858: l_event_obj wf_event_obj;
859: l_subs_list wf_event_subs_tab;
860:
861: begin
862:
855: result varchar2(10) := 'NONE';
856:
857: -- bes caching implementation
858: l_event_obj wf_event_obj;
859: l_subs_list wf_event_subs_tab;
860:
861: begin
862:
863: l_event_obj := wf_bes_cache.GetEventByName(p_event_name);
880: return result;
881:
882: exception
883: when others then
884: wf_core.context('Wf_Event', 'Test', p_event_name);
885: raise;
886: end;
887: ---------------------------------------------------------------------------
888: /*
887: ---------------------------------------------------------------------------
888: /*
889: ** send -
890: */
891: PROCEDURE send(p_event in out nocopy wf_event_t) is
892: outguid WF_AGENTS.GUID%TYPE;
893: toagtname WF_AGENTS.NAME%TYPE;
894: toagtsys WF_SYSTEMS.NAME%TYPE;
895: outagtname WF_AGENTS.NAME%TYPE;
911: --
912: if (p_event.GetToAgent() is null AND p_event.GetFromAgent() is null) then
913: -- Either source or destination must be defined.
914: -- Raise Error.
915: wf_core.context('Wf_Event', 'Send', p_event.getEventName());
916: wf_core.raise('Either source or destination must be defined.'); -- wfsql.msg
917: end if;
918:
919: if p_event.GetToAgent() is not null then
927: end if;
928:
929: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
930: wf_log_pkg.string(wf_log_pkg.level_statement,
931: 'wf.plsql.WF_EVENT.Send.info',
932: 'To Agt: '||toagtname||' To Agt Sys:'||toagtsys||
933: 'Out Agt: '||outagtname||' Out Agt Sys:'||outagtsys);
934: end if;
935:
969: else
970: raise no_data_found;
971: end if;
972:
973: p_event.setFromAgent(wf_event.newAgent(outguid));
974: end if;
975:
976: if (p_event.getSendDate() is NULL) then
977: p_event.setSendDate(sysdate);
978: end if;
979:
980: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
981: wf_log_pkg.string(wf_log_pkg.level_statement,
982: 'wf.plsql.WF_EVENT.send.enqueue',
983: 'Sending from '||outagtname||' to '||toagtname);
984: end if;
985:
986: wf_event.enqueue(p_event);
982: 'wf.plsql.WF_EVENT.send.enqueue',
983: 'Sending from '||outagtname||' to '||toagtname);
984: end if;
985:
986: wf_event.enqueue(p_event);
987: exception
988: when no_data_found then
989: wf_core.context('Wf_Event', 'Send', p_event.getEventName());
990: wf_core.token('AGENT', toagtname);
985:
986: wf_event.enqueue(p_event);
987: exception
988: when no_data_found then
989: wf_core.context('Wf_Event', 'Send', p_event.getEventName());
990: wf_core.token('AGENT', toagtname);
991: wf_core.raise('WFE_AGENT_NOMATCH');
992: when others then
993: wf_core.context('Wf_Event', 'Send', p_event.getEventName());
989: wf_core.context('Wf_Event', 'Send', p_event.getEventName());
990: wf_core.token('AGENT', toagtname);
991: wf_core.raise('WFE_AGENT_NOMATCH');
992: when others then
993: wf_core.context('Wf_Event', 'Send', p_event.getEventName());
994: raise;
995: end;
996: ---------------------------------------------------------------------------
997: /*
1050: end if;
1051:
1052: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
1053: wf_log_pkg.string(wf_log_pkg.level_statement,
1054: 'wf.plsql.WF_EVENT.Get_Recipient',
1055: 'Recipient is name: ' || p_to_agent_name ||
1056: ' address: ' || l_to_address || ' protocol: ' ||l_to_protocol);
1057: end if;
1058:
1061: -- from protocol names as used in the event manager and the
1062: -- protocol numbers used by AQ.
1063:
1064: if((l_to_protocol is null) or (l_to_protocol not in ('SQLNET'))) then
1065: wf_core.context('WF_EVENT', 'Get_Recipient', 'Bad Protocol',
1066: l_to_protocol, l_to_queue_name);
1067: end if;
1068:
1069: return sys.aq$_agent(p_to_agent_name,
1079: ** If the ToAgent of event is not null(send), set the recipient list
1080: ** address.
1081: ** Only be called if the event.getToAgent() is not null.
1082: */
1083: PROCEDURE Set_Recipient_List(p_event in wf_event_t,
1084: p_out_agent_name in varchar2,
1085: p_out_system_name in varchar2,
1086: x_message_properties in out nocopy dbms_aq.message_properties_t) IS
1087: l_to_type WF_AGENTS.TYPE%TYPE;
1107: l_to_system_name := p_event.getToAgent().getSystem();
1108:
1109: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
1110: wf_log_pkg.string(wf_log_pkg.level_statement,
1111: 'wf.plsql.WF_EVENT.setRecieptList',
1112: 'Setting Recipient List: ' || l_to_agent_name);
1113: end if;
1114:
1115: l_to_agt_obj := wf_bes_cache.GetAgentByName(l_to_agent_name, l_to_system_name);
1183: else
1184: l_parameters := wf_parameter_list_t();
1185: end if;
1186: --Raise the event
1187: wf_event.raise3(p_event_name,
1188: p_event_key,
1189: p_event_data,
1190: l_parameters,
1191: p_send_date);
1231: qh varchar2(240);
1232: stat varchar2(10);
1233: agt raw(16);
1234: sagt raw(16);
1235: evt wf_event_t;
1236: evt_name VARCHAR2(240);
1237: evt_errmsg VARCHAR2(4000);
1238: -- Local Variable, reset everytime the method is called.
1239: l_lsn_msg_count NUMBER := 0;
1266: p_max_error_count := 0;
1267: end if;
1268:
1269: if ((p_correlation is not NULL) and (p_deq_condition is not NULL)) then
1270: WF_CORE.Context('WF_EVENT', 'Listen', p_agent_name, p_correlation,
1271: p_deq_condition);
1272: WF_CORE.Raise('WFE_CORRID_VS_CONDITION');
1273:
1274: end if;
1275:
1276: -- lookup agent info --
1277: --
1278: --
1279: if (WF_EVENT.g_local_system_guid is NULL) then
1280: g_local_system_guid := hextoraw(WF_CORE.Translate('WF_SYSTEM_GUID'));
1281: end if;
1282:
1283: -- get the agent information for the local system
1295: StartAgent(p_agent_name);
1296:
1297: -- set default parameters for queue navigation if not previously set
1298: if (g_navResetThreshold is null) then
1299: wf_event.setNavigationParams(p_agent_name, 0);
1300: end if;
1301:
1302: if (WF_EVENT.g_message_grouping = 'TRANSACTIONAL') then
1303: if ((p_correlation is NULL) and (p_deq_condition is NULL)) then
1298: if (g_navResetThreshold is null) then
1299: wf_event.setNavigationParams(p_agent_name, 0);
1300: end if;
1301:
1302: if (WF_EVENT.g_message_grouping = 'TRANSACTIONAL') then
1303: if ((p_correlation is NULL) and (p_deq_condition is NULL)) then
1304: --This is a transactional queue, we will go ahead and call
1305: --the proper api.
1306: WF_EVENT.Listen_GRP(p_agent_name, p_wait);
1302: if (WF_EVENT.g_message_grouping = 'TRANSACTIONAL') then
1303: if ((p_correlation is NULL) and (p_deq_condition is NULL)) then
1304: --This is a transactional queue, we will go ahead and call
1305: --the proper api.
1306: WF_EVENT.Listen_GRP(p_agent_name, p_wait);
1307: return;
1308:
1309: else
1310: --This is a transactional queue, but since there was a correlation id
1309: else
1310: --This is a transactional queue, but since there was a correlation id
1311: --passed, we cannot call Listen_GRP, so we will raise an error to the
1312: --caller to resolve.
1313: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1314: wf_core.token('AGENT', p_agent_name);
1315: wf_core.token('API', 'WF_EVENT.Listen_GRP');
1316: wf_core.raise('WFE_TRXN_QUEUE');
1317:
1311: --passed, we cannot call Listen_GRP, so we will raise an error to the
1312: --caller to resolve.
1313: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1314: wf_core.token('AGENT', p_agent_name);
1315: wf_core.token('API', 'WF_EVENT.Listen_GRP');
1316: wf_core.raise('WFE_TRXN_QUEUE');
1317:
1318: end if;
1319: end if;
1327:
1328: -- check system status
1329: -- stat := wf_core.translate('WF_SYSTEM_STATUS');
1330: -- Set the account name - only need this for WF_DEFERRED
1331: wf_event.SetAccountName;
1332:
1333: if (wf_event.local_system_status = 'DISABLED' OR
1334: wf_core.database_current_edition <> wf_core.database_default_edition) then
1335: return;
1329: -- stat := wf_core.translate('WF_SYSTEM_STATUS');
1330: -- Set the account name - only need this for WF_DEFERRED
1331: wf_event.SetAccountName;
1332:
1333: if (wf_event.local_system_status = 'DISABLED' OR
1334: wf_core.database_current_edition <> wf_core.database_default_edition) then
1335: return;
1336: end if;
1337:
1334: wf_core.database_current_edition <> wf_core.database_default_edition) then
1335: return;
1336: end if;
1337:
1338: if (wf_event.local_system_status in ('LOCAL','EXTERNAL')) then
1339: if (st = wf_event.local_system_status
1340: OR st = 'ERROR'
1341: OR p_agent_name = 'WF_DEFERRED') then
1342: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
1335: return;
1336: end if;
1337:
1338: if (wf_event.local_system_status in ('LOCAL','EXTERNAL')) then
1339: if (st = wf_event.local_system_status
1340: OR st = 'ERROR'
1341: OR p_agent_name = 'WF_DEFERRED') then
1342: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
1343: wf_log_pkg.string(wf_log_pkg.level_statement,
1340: OR st = 'ERROR'
1341: OR p_agent_name = 'WF_DEFERRED') then
1342: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
1343: wf_log_pkg.string(wf_log_pkg.level_statement,
1344: 'wf.plsql.WF_EVENT.listen.Check1',
1345: 'Source type is equal to system status '||
1346: 'or ERROR or Deferred Processing');
1347: end if;
1348: else
1347: end if;
1348: else
1349: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
1350: wf_log_pkg.string(wf_log_pkg.level_statement,
1351: 'wf.plsql.WF_EVENT.listen.Check2',
1352: 'Source type not valid for current system status');
1353: end if;
1354: return;
1355: end if;
1361: -- We need to explicitly make sure that if someones Queue Handler
1362: -- blows up we rollback the transaction, just in case they don't
1363: begin
1364: savepoint bes_before_dequeue_qh;
1365: wf_event.dequeue(agt, evt, qh, p_wait, p_correlation, p_deq_condition);
1366:
1367: exception
1368: when others then
1369: wf_event.wf_exception_source := 'QH';
1365: wf_event.dequeue(agt, evt, qh, p_wait, p_correlation, p_deq_condition);
1366:
1367: exception
1368: when others then
1369: wf_event.wf_exception_source := 'QH';
1370: rollback to bes_before_dequeue_qh;
1371: raise;
1372: end;
1373:
1386: from_agt_sys := evt.getFromAgent().getSystem();
1387:
1388: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
1389: wf_log_pkg.string(wf_log_pkg.level_statement,
1390: 'wf.plsql.WF_EVENT.listen',
1391: 'Event '||evt.getEventName()||
1392: ', hailing from '||from_agt_name||'@'||from_agt_sys||
1393: ' was dequeued from '||p_agent_name);
1394: end if;
1421: begin
1422: if p_agent_name = 'WF_DEFERRED' then
1423: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
1424: wf_log_pkg.string(wf_log_pkg.level_statement,
1425: 'wf.plsql.WF_EVENT.listen.Deferred',
1426: 'Processing Deferred Event');
1427: end if;
1428:
1429: wf_event.GetDeferEventCtx(st,from_agt_name,from_agt_sys,evt);
1425: 'wf.plsql.WF_EVENT.listen.Deferred',
1426: 'Processing Deferred Event');
1427: end if;
1428:
1429: wf_event.GetDeferEventCtx(st,from_agt_name,from_agt_sys,evt);
1430: -- dispatcher should process all subscriptions
1431: wf_event.phase_maxthreshold := null;
1432: end if;
1433:
1427: end if;
1428:
1429: wf_event.GetDeferEventCtx(st,from_agt_name,from_agt_sys,evt);
1430: -- dispatcher should process all subscriptions
1431: wf_event.phase_maxthreshold := null;
1432: end if;
1433:
1434: begin
1435: -- Dispatcher will throw exception in the following unexpected errors
1439: -- Unable to Save to Error Queue
1440: -- Unable to rollback to savepoint.
1441: -- Listen will swallow all of these exceptions unless the unexpected
1442: -- exception happened when processing error queue
1443: wf_event.dispatch(st, sagt, evt);
1444:
1445: -- We only count consecutive unexpected errors
1446: l_error_count := 0;
1447: commit;
1452: when others then
1453: -- 7828862 Restore apps context from cached values
1454: wfa_sec.Restore_Ctx();
1455:
1456: if (wf_event.wf_exception_source = 'RULE') then
1457: if (st = 'ERROR') then
1458: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1459: wf_log_pkg.string(wf_log_pkg.level_error,
1460: 'wf.plsql.WF_EVENT.listen.dispatch_error',
1456: if (wf_event.wf_exception_source = 'RULE') then
1457: if (st = 'ERROR') then
1458: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1459: wf_log_pkg.string(wf_log_pkg.level_error,
1460: 'wf.plsql.WF_EVENT.listen.dispatch_error',
1461: 'Rule Function with Source Error Exception');
1462: end if;
1463: raise;
1464: else
1463: raise;
1464: else
1465: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1466: wf_log_pkg.string(wf_log_pkg.level_error,
1467: 'wf.plsql.WF_EVENT.listen.dispatch_error',
1468: 'Rule Function Error');
1469: end if;
1470: wf_event.setErrorInfo(evt, 'ERROR');
1471: wf_event.saveErrorToQueue(evt);
1466: wf_log_pkg.string(wf_log_pkg.level_error,
1467: 'wf.plsql.WF_EVENT.listen.dispatch_error',
1468: 'Rule Function Error');
1469: end if;
1470: wf_event.setErrorInfo(evt, 'ERROR');
1471: wf_event.saveErrorToQueue(evt);
1472: commit;
1473: l_error_count := l_error_count + 1;
1474: end if;
1467: 'wf.plsql.WF_EVENT.listen.dispatch_error',
1468: 'Rule Function Error');
1469: end if;
1470: wf_event.setErrorInfo(evt, 'ERROR');
1471: wf_event.saveErrorToQueue(evt);
1472: commit;
1473: l_error_count := l_error_count + 1;
1474: end if;
1475: else
1474: end if;
1475: else
1476: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1477: wf_log_pkg.string(wf_log_pkg.level_error,
1478: 'wf.plsql.WF_EVENT.listen.dispatch_error',
1479: 'Non Rule Function Error');
1480: end if;
1481: -- Bug 4207885: Set the exception source to be WF.
1482: wf_event.wf_exception_source := 'WF';
1478: 'wf.plsql.WF_EVENT.listen.dispatch_error',
1479: 'Non Rule Function Error');
1480: end if;
1481: -- Bug 4207885: Set the exception source to be WF.
1482: wf_event.wf_exception_source := 'WF';
1483: commit;
1484: raise;
1485: end if;
1486: end;
1495: -- agent is the error queue then there is no point in enqueueing
1496: -- the event again into the error queue.
1497: -- In this case we just rollback the dequeue and raise the
1498: -- exception to the user.
1499: if (( wf_event.wf_exception_source = 'RULE') and (st = 'ERROR')) then
1500: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1501: wf_log_pkg.string(wf_log_pkg.level_error,
1502: 'wf.plsql.WF_EVENT.listen.dispatch_error',
1503: 'Error executing Rule Function with Source Type Error');
1498: -- exception to the user.
1499: if (( wf_event.wf_exception_source = 'RULE') and (st = 'ERROR')) then
1500: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1501: wf_log_pkg.string(wf_log_pkg.level_error,
1502: 'wf.plsql.WF_EVENT.listen.dispatch_error',
1503: 'Error executing Rule Function with Source Type Error');
1504: end if;
1505: rollback to bes_before_dequeue_qh;
1506:
1514: wf_core.token('SQLERRM', sqlerrm);
1515: wf_core.token('SQLCODE', sqlcode);
1516: wf_core.raise('WFE_UNHANDLED_ERROR');
1517: end if;
1518: elsif (wf_event.wf_exception_source = 'WF') then
1519: -- Bug 4207885: Add the handler of exception with source WF
1520: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1521: wf_log_pkg.string(wf_log_pkg.level_error,
1522: 'wf.plsql.WF_EVENT.listen.dispatch_error',
1518: elsif (wf_event.wf_exception_source = 'WF') then
1519: -- Bug 4207885: Add the handler of exception with source WF
1520: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1521: wf_log_pkg.string(wf_log_pkg.level_error,
1522: 'wf.plsql.WF_EVENT.listen.dispatch_error',
1523: 'Unexpected Function Error');
1524: end if;
1525: wf_core.token('ENAME', evt.event_name);
1526: wf_core.token('EKEY', evt.event_key);
1529: wf_core.raise('WFE_UNHANDLED_ERROR');
1530: else
1531: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1532: wf_log_pkg.string(wf_log_pkg.level_error,
1533: 'wf.plsql.WF_EVENT.listen.error',
1534: 'GetDeferEventCtx Error');
1535: end if;
1536: wf_event.setErrorInfo(evt,'ERROR');
1537: wf_event.saveErrorToQueue(evt);
1532: wf_log_pkg.string(wf_log_pkg.level_error,
1533: 'wf.plsql.WF_EVENT.listen.error',
1534: 'GetDeferEventCtx Error');
1535: end if;
1536: wf_event.setErrorInfo(evt,'ERROR');
1537: wf_event.saveErrorToQueue(evt);
1538: commit;
1539: l_error_count := l_error_count + 1;
1540: end if;
1533: 'wf.plsql.WF_EVENT.listen.error',
1534: 'GetDeferEventCtx Error');
1535: end if;
1536: wf_event.setErrorInfo(evt,'ERROR');
1537: wf_event.saveErrorToQueue(evt);
1538: commit;
1539: l_error_count := l_error_count + 1;
1540: end if;
1541: end;
1546: exit;
1547: end if;
1548:
1549: evt := null;
1550: wf_event.InitPhaseMinThreshold;
1551: wf_event.SetDispatchMode('SYNC');
1552:
1553: if (p_message_count > 0 AND l_lsn_msg_count >= p_message_count ) then
1554: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
1547: end if;
1548:
1549: evt := null;
1550: wf_event.InitPhaseMinThreshold;
1551: wf_event.SetDispatchMode('SYNC');
1552:
1553: if (p_message_count > 0 AND l_lsn_msg_count >= p_message_count ) then
1554: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
1555: wf_log_pkg.string(wf_log_pkg.level_statement,
1552:
1553: if (p_message_count > 0 AND l_lsn_msg_count >= p_message_count ) then
1554: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
1555: wf_log_pkg.string(wf_log_pkg.level_statement,
1556: 'wf.plsql.WF_EVENT.listen.maxMsgCount',
1557: 'Read the specified maximum number of messages');
1558: end if;
1559: exit;
1560: end if;
1561:
1562: if (p_max_error_count > 0 AND l_error_count >= p_max_error_count ) then
1563: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1564: wf_log_pkg.string(wf_log_pkg.level_error,
1565: 'wf.plsql.WF_EVENT.listen.maxErrCount',
1566: 'Encountered the specified maximum number of errors');
1567: end if;
1568: exit;
1569: end if;
1571: -- We need to explicitly make sure that if someones Queue Handler
1572: -- blows up we rollback the transaction, just in case they don't
1573: begin
1574: savepoint bes_before_dequeue_qh;
1575: wf_event.dequeue(agt, evt, qh, p_wait, p_correlation, p_deq_condition);
1576: exception
1577: when others then
1578: wf_event.wf_exception_source := 'QH';
1579: rollback to bes_before_dequeue_qh;
1574: savepoint bes_before_dequeue_qh;
1575: wf_event.dequeue(agt, evt, qh, p_wait, p_correlation, p_deq_condition);
1576: exception
1577: when others then
1578: wf_event.wf_exception_source := 'QH';
1579: rollback to bes_before_dequeue_qh;
1580: raise;
1581: end;
1582: end loop;
1590: exception
1591: when no_data_found then
1592: -- 7828862 Restore apps context from cached values
1593: wfa_sec.Restore_Ctx();
1594: if (wf_event.wf_exception_source = 'WF'
1595: OR wf_event.wf_exception_source = 'QH') then
1596: raise;
1597: else
1598: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1591: when no_data_found then
1592: -- 7828862 Restore apps context from cached values
1593: wfa_sec.Restore_Ctx();
1594: if (wf_event.wf_exception_source = 'WF'
1595: OR wf_event.wf_exception_source = 'QH') then
1596: raise;
1597: else
1598: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1599: wf_core.raise('WFE_AGENT_NOTEXIST');
1594: if (wf_event.wf_exception_source = 'WF'
1595: OR wf_event.wf_exception_source = 'QH') then
1596: raise;
1597: else
1598: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1599: wf_core.raise('WFE_AGENT_NOTEXIST');
1600: end if;
1601: when others then
1602: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1598: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1599: wf_core.raise('WFE_AGENT_NOTEXIST');
1600: end if;
1601: when others then
1602: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1603: -- 7828862 Restore apps context from cached values
1604: wfa_sec.Restore_Ctx();
1605: raise;
1606: end Listen;
1645:
1646: --Bug 2649327
1647: --The deq condition is not used at present for dequeuing
1648: -- Hence setting it to NULL.
1649: wf_event.listen(p_agent_name => p_agent_name,
1650: p_wait => l_p_wait,
1651: p_correlation => l_correlation,
1652: p_deq_condition=>NULL);
1653:
1680: qh varchar2(240);
1681: stat varchar2(10);
1682: agt raw(16);
1683: sagt raw(16);
1684: evt wf_event_t;
1685: err_evt wf_event_t;
1686: evt_errmsg VARCHAR2(4000);
1687: l_queueTable VARCHAR2(30); --
1688: end_of_transaction exception;
1681: stat varchar2(10);
1682: agt raw(16);
1683: sagt raw(16);
1684: evt wf_event_t;
1685: err_evt wf_event_t;
1686: evt_errmsg VARCHAR2(4000);
1687: l_queueTable VARCHAR2(30); --
1688: end_of_transaction exception;
1689: pragma exception_init (end_of_transaction, -25235);
1694:
1695: -- Confirm that p_agent_name includes a transactional queue.
1696: --
1697: --
1698: if (WF_EVENT.g_local_system_guid is NULL) then
1699: g_local_system_guid := hextoraw(WF_CORE.Translate('WF_SYSTEM_GUID'));
1700: end if;
1701:
1702: GetAgentDetails(p_agent_name);
1703:
1704: -- get agent details for local system
1705: l_agent_obj := wf_bes_cache.GetAgentByName(p_agent_name, null);
1706: if (l_agent_obj is null) then
1707: wf_core.context('Wf_Event', 'Listen_GRP', p_agent_name);
1708: wf_core.raise('WFE_AGENT_NOTEXIST');
1709: end if;
1710: qh := l_agent_obj.queue_handler;
1711: agt := l_agent_obj.guid;
1710: qh := l_agent_obj.queue_handler;
1711: agt := l_agent_obj.guid;
1712:
1713:
1714: if (WF_EVENT.g_message_grouping <> 'TRANSACTIONAL') then
1715: --This is not a transactional queue.
1716: WF_CORE.Context('Wf_Event', 'Listen_GRP', p_agent_name);
1717: WF_CORE.Token('AGENT', p_agent_name);
1718: WF_CORE.Token('API', 'WF_EVENT.Listen');
1712:
1713:
1714: if (WF_EVENT.g_message_grouping <> 'TRANSACTIONAL') then
1715: --This is not a transactional queue.
1716: WF_CORE.Context('Wf_Event', 'Listen_GRP', p_agent_name);
1717: WF_CORE.Token('AGENT', p_agent_name);
1718: WF_CORE.Token('API', 'WF_EVENT.Listen');
1719: WF_CORE.Raise('WFE_NONTRXN_QUEUE');
1720: end if;
1714: if (WF_EVENT.g_message_grouping <> 'TRANSACTIONAL') then
1715: --This is not a transactional queue.
1716: WF_CORE.Context('Wf_Event', 'Listen_GRP', p_agent_name);
1717: WF_CORE.Token('AGENT', p_agent_name);
1718: WF_CORE.Token('API', 'WF_EVENT.Listen');
1719: WF_CORE.Raise('WFE_NONTRXN_QUEUE');
1720: end if;
1721:
1722: --Verifying that the system is not disabled.
1719: WF_CORE.Raise('WFE_NONTRXN_QUEUE');
1720: end if;
1721:
1722: --Verifying that the system is not disabled.
1723: if (wf_event.local_system_status = 'DISABLED' OR
1724: wf_core.database_current_edition <> wf_core.database_default_edition) then
1725: return;
1726: end if;
1727:
1737: savepoint trxn_start;
1738:
1739: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
1740: wf_log_pkg.string(wf_log_pkg.level_statement,
1741: 'wf.plsql.WF_EVENT.Listen_GRP.processing',
1742: 'Begin processing transaction');
1743: end if;
1744:
1745: begin
1745: begin
1746:
1747: -- Dequeue the first message in the transaction
1748: savepoint bes_before_dequeue_qh;
1749: wf_event.dequeue(agt, evt, qh,p_wait);
1750:
1751: exception
1752: when end_of_transaction then
1753: if (wf_log_pkg.level_event >= fnd_log.g_current_runtime_level) then
1751: exception
1752: when end_of_transaction then
1753: if (wf_log_pkg.level_event >= fnd_log.g_current_runtime_level) then
1754: wf_log_pkg.string(wf_log_pkg.level_event,
1755: 'wf.plsql.WF_EVENT.Listen_GRP.complete',
1756: 'End of the transaction');
1757: end if;
1758:
1759: -- reset navigation
1756: 'End of the transaction');
1757: end if;
1758:
1759: -- reset navigation
1760: wf_event.resetNavigationParams;
1761: commit;
1762:
1763: when others then
1764: wf_event.wf_exception_source := 'QH';
1760: wf_event.resetNavigationParams;
1761: commit;
1762:
1763: when others then
1764: wf_event.wf_exception_source := 'QH';
1765: rollback to bes_before_dequeue_qh;
1766: raise;
1767:
1768: end;
1776: from_agt_sys := evt.getFromAgent().getSystem();
1777:
1778: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
1779: wf_log_pkg.string(wf_log_pkg.level_statement,
1780: 'wf.plsql.WF_EVENT.Listen_GRP.event_dequeued',
1781: 'Event '||evt.getEventName()||', hailing from '||from_agt_name||'@'||
1782: from_agt_sys|| ' was dequeued from '|| p_agent_name);
1783: end if;
1784:
1807:
1808: -- Begin Dispatching the event message.
1809:
1810: begin
1811: wf_event.dispatch(st, sagt, evt);
1812:
1813: exception
1814: when others then
1815: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1813: exception
1814: when others then
1815: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1816: wf_log_pkg.string(wf_log_pkg.level_error,
1817: 'wf.plsql.WF_EVENT.Listen_GRP.dispatch_error',
1818: 'Dispatch Error when dispatching Event '||evt.getEventName);
1819: end if;
1820: raise dispatch_error;
1821:
1827: exit;
1828: end if;
1829:
1830: evt := null;
1831: wf_event.InitPhaseMinThreshold;
1832: wf_event.SetDispatchMode('SYNC');
1833:
1834: begin
1835: savepoint bes_before_dequeue_qh;
1828: end if;
1829:
1830: evt := null;
1831: wf_event.InitPhaseMinThreshold;
1832: wf_event.SetDispatchMode('SYNC');
1833:
1834: begin
1835: savepoint bes_before_dequeue_qh;
1836: wf_event.dequeue(agt, evt, qh,p_wait);
1832: wf_event.SetDispatchMode('SYNC');
1833:
1834: begin
1835: savepoint bes_before_dequeue_qh;
1836: wf_event.dequeue(agt, evt, qh,p_wait);
1837:
1838: exception
1839: when end_of_transaction then
1840: if (wf_log_pkg.level_event >= fnd_log.g_current_runtime_level) then
1838: exception
1839: when end_of_transaction then
1840: if (wf_log_pkg.level_event >= fnd_log.g_current_runtime_level) then
1841: wf_log_pkg.string(wf_log_pkg.level_event,
1842: 'wf.plsql.WF_EVENT.Listen_GRP.complete',
1843: 'End of the transaction');
1844: end if;
1845:
1846: -- reset navigation
1843: 'End of the transaction');
1844: end if;
1845:
1846: -- reset navigation
1847: wf_event.resetNavigationParams;
1848: commit;
1849:
1850: when others then
1851: wf_event.wf_exception_source := 'QH';
1847: wf_event.resetNavigationParams;
1848: commit;
1849:
1850: when others then
1851: wf_event.wf_exception_source := 'QH';
1852: rollback to bes_before_dequeue_qh;
1853: raise;
1854:
1855: end;
1862: when dispatch_error then
1863: --Dequeue the rest of the transaction
1864: begin
1865: loop
1866: wf_event.dequeue(agt, err_evt, qh,p_wait);
1867:
1868: end loop;
1869:
1870: exception
1870: exception
1871: when end_of_transaction then
1872: if (wf_log_pkg.level_event >= fnd_log.g_current_runtime_level) then
1873: wf_log_pkg.string(wf_log_pkg.level_event,
1874: 'wf.plsql.WF_EVENT.Listen_GRP.complete',
1875: 'End of the transaction after dispatch error');
1876: end if;
1877:
1878: -- reset navigation
1875: 'End of the transaction after dispatch error');
1876: end if;
1877:
1878: -- reset navigation
1879: wf_event.resetNavigationParams;
1880:
1881: end;
1882:
1883: --Rollback the whole transaction, which will update the retry count
1885: rollback to trxn_start;
1886:
1887: --We will save the current message to the Error Queue.
1888: if ((evt.getValueForParameter('ERROR_NAME')) is NULL) then
1889: wf_event.setErrorInfo(evt, 'ERROR');
1890:
1891: end if;
1892:
1893: evt.addParameterToList('DEQUEUE_MODE', 'TRANSACTIONAL');
1890:
1891: end if;
1892:
1893: evt.addParameterToList('DEQUEUE_MODE', 'TRANSACTIONAL');
1894: wf_event.saveErrorToQueue(evt);
1895:
1896:
1897: when others then
1898: raise;
1901:
1902: -- if QH is using setNavigationParams/getQueueNavigation, condition is
1903: -- g_processedMessagesCount = 0 and g_currentNavigation either
1904: -- FIRST_MESSAGE or NEXT_TRANSACTION,
1905: -- otherwise, condition is wf_event.navigation = dbms_aq.first_message
1906: if (g_navResetThreshold is not null and g_processedMessagesCount = 0
1907: and (g_currentNavigation in (dbms_aq.FIRST_MESSAGE, dbms_aq.NEXT_TRANSACTION)))
1908: OR
1909: (g_navResetThreshold is null and wf_event.navigation = dbms_aq.first_message)
1905: -- otherwise, condition is wf_event.navigation = dbms_aq.first_message
1906: if (g_navResetThreshold is not null and g_processedMessagesCount = 0
1907: and (g_currentNavigation in (dbms_aq.FIRST_MESSAGE, dbms_aq.NEXT_TRANSACTION)))
1908: OR
1909: (g_navResetThreshold is null and wf_event.navigation = dbms_aq.first_message)
1910: then
1911:
1912: exit; --Outer Loop.
1913: --The queue handler must have reached the last message and
1917:
1918: end loop; --Outer loop to process all transactions in the queue.
1919: exception
1920: when no_data_found then
1921: if (wf_event.wf_exception_source = 'WF'
1922: OR wf_event.wf_exception_source = 'QH') then
1923: raise;
1924: else
1925: wf_core.context('Wf_Event', 'Listen_GRP', p_agent_name);
1918: end loop; --Outer loop to process all transactions in the queue.
1919: exception
1920: when no_data_found then
1921: if (wf_event.wf_exception_source = 'WF'
1922: OR wf_event.wf_exception_source = 'QH') then
1923: raise;
1924: else
1925: wf_core.context('Wf_Event', 'Listen_GRP', p_agent_name);
1926: wf_core.raise('WFE_AGENT_NOTEXIST');
1921: if (wf_event.wf_exception_source = 'WF'
1922: OR wf_event.wf_exception_source = 'QH') then
1923: raise;
1924: else
1925: wf_core.context('Wf_Event', 'Listen_GRP', p_agent_name);
1926: wf_core.raise('WFE_AGENT_NOTEXIST');
1927: end if;
1928: when others then
1929: wf_core.context('Wf_Event', 'Listen_GRP', p_agent_name);
1925: wf_core.context('Wf_Event', 'Listen_GRP', p_agent_name);
1926: wf_core.raise('WFE_AGENT_NOTEXIST');
1927: end if;
1928: when others then
1929: wf_core.context('Wf_Event', 'Listen_GRP', p_agent_name);
1930: raise;
1931: end;
1932:
1933: ---------------------------------------------------------------------------
1940: errname varchar2(30);
1941: errmsg varchar2(2000);
1942: errstack varchar2(4000);
1943: begin
1944: wf_event.listen_grp(p_agent_name);
1945:
1946: -- Return 0 for successful completion --
1947: errbuf := '';
1948: retcode := '0';
1964: ** dispatch -
1965: */
1966: PROCEDURE dispatch(p_source_type in varchar2,
1967: p_source_agent_guid in raw,
1968: p_event in out nocopy wf_event_t)
1969: is
1970: res varchar2(20);
1971: cmd varchar2(1000);
1972: stat varchar2(10);
1977: eguid raw(16);
1978: l_skip_sub raw(16);
1979: event_count NUMBER;
1980: l_rule_func varchar2(300);
1981: l_source_type wf_event_subscriptions.source_type%type;
1982: l_phase wf_event_subscriptions.phase%type;
1983: l_rule_data wf_event_subscriptions.rule_data%type;
1984: l_priority wf_event_subscriptions.priority%type;
1985: l_on_error wf_event_subscriptions.on_error_code%type;
1978: l_skip_sub raw(16);
1979: event_count NUMBER;
1980: l_rule_func varchar2(300);
1981: l_source_type wf_event_subscriptions.source_type%type;
1982: l_phase wf_event_subscriptions.phase%type;
1983: l_rule_data wf_event_subscriptions.rule_data%type;
1984: l_priority wf_event_subscriptions.priority%type;
1985: l_on_error wf_event_subscriptions.on_error_code%type;
1986: --Bug 2437354
1979: event_count NUMBER;
1980: l_rule_func varchar2(300);
1981: l_source_type wf_event_subscriptions.source_type%type;
1982: l_phase wf_event_subscriptions.phase%type;
1983: l_rule_data wf_event_subscriptions.rule_data%type;
1984: l_priority wf_event_subscriptions.priority%type;
1985: l_on_error wf_event_subscriptions.on_error_code%type;
1986: --Bug 2437354
1987: trig_savepoint exception;
1980: l_rule_func varchar2(300);
1981: l_source_type wf_event_subscriptions.source_type%type;
1982: l_phase wf_event_subscriptions.phase%type;
1983: l_rule_data wf_event_subscriptions.rule_data%type;
1984: l_priority wf_event_subscriptions.priority%type;
1985: l_on_error wf_event_subscriptions.on_error_code%type;
1986: --Bug 2437354
1987: trig_savepoint exception;
1988: pragma exception_init(trig_savepoint, -04092);
1981: l_source_type wf_event_subscriptions.source_type%type;
1982: l_phase wf_event_subscriptions.phase%type;
1983: l_rule_data wf_event_subscriptions.rule_data%type;
1984: l_priority wf_event_subscriptions.priority%type;
1985: l_on_error wf_event_subscriptions.on_error_code%type;
1986: --Bug 2437354
1987: trig_savepoint exception;
1988: pragma exception_init(trig_savepoint, -04092);
1989:
1988: pragma exception_init(trig_savepoint, -04092);
1989:
1990: -- bes caching implementation
1991: l_event_name varchar2(240);
1992: l_event_obj wf_event_obj;
1993: l_subs_list wf_event_subs_tab;
1994: l_sub wf_event_subs_obj;
1995: begin
1996: l_event_name := p_event.Event_Name;
1989:
1990: -- bes caching implementation
1991: l_event_name varchar2(240);
1992: l_event_obj wf_event_obj;
1993: l_subs_list wf_event_subs_tab;
1994: l_sub wf_event_subs_obj;
1995: begin
1996: l_event_name := p_event.Event_Name;
1997:
1990: -- bes caching implementation
1991: l_event_name varchar2(240);
1992: l_event_obj wf_event_obj;
1993: l_subs_list wf_event_subs_tab;
1994: l_sub wf_event_subs_obj;
1995: begin
1996: l_event_name := p_event.Event_Name;
1997:
1998: -- Deleting any previous Event parameter indexes.
1995: begin
1996: l_event_name := p_event.Event_Name;
1997:
1998: -- Deleting any previous Event parameter indexes.
1999: WF_EVENT.evt_param_index.DELETE;
2000:
2001: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
2002: wf_log_pkg.string(wf_log_pkg.level_procedure,
2003: 'wf.plsql.WF_EVENT.dispatch.Begin',
1999: WF_EVENT.evt_param_index.DELETE;
2000:
2001: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
2002: wf_log_pkg.string(wf_log_pkg.level_procedure,
2003: 'wf.plsql.WF_EVENT.dispatch.Begin',
2004: 'Dispatching event '||l_event_name);
2005: end if;
2006:
2007: l_event_obj := wf_bes_cache.GetEventByName(l_event_name);
2007: l_event_obj := wf_bes_cache.GetEventByName(l_event_name);
2008: if (l_event_obj is null) then
2009: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2010: wf_log_pkg.string(wf_log_pkg.level_statement,
2011: 'wf.plsql.WF_EVENT.dispatch.no_event',
2012: 'Event is either disabled or product not licensed '||
2013: 'or event not registered');
2014: end if;
2015: end if;
2013: 'or event not registered');
2014: end if;
2015: end if;
2016:
2017: wf_event.wf_exception_source := 'NONE';
2018:
2019: --
2020: -- mjc If Source Type is LOCAL and Phase Threshold is less than zero,
2021: -- the raise is to be deferred. Then we immediately return to
2020: -- mjc If Source Type is LOCAL and Phase Threshold is less than zero,
2021: -- the raise is to be deferred. Then we immediately return to
2022: -- calling subprogram
2023: --
2024: -- The wf_event.deferevent is called within a new block
2025: -- Make sure only defer event when event exists.
2026: begin
2027: if (p_source_type = 'LOCAL' AND
2028: (wf_event.phase_maxthreshold < 0 OR p_event.send_date > sysdate) AND
2024: -- The wf_event.deferevent is called within a new block
2025: -- Make sure only defer event when event exists.
2026: begin
2027: if (p_source_type = 'LOCAL' AND
2028: (wf_event.phase_maxthreshold < 0 OR p_event.send_date > sysdate) AND
2029: l_event_obj is not null) then
2030:
2031: if(isDeferToJava(true, l_event_name, p_source_type,
2032: null, null, null)) then
2031: if(isDeferToJava(true, l_event_name, p_source_type,
2032: null, null, null)) then
2033: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2034: wf_log_pkg.string(wf_log_pkg.level_statement,
2035: 'wf.plsql.WF_EVENT.dispatch.Defer',
2036: 'Detected as deferred raise. Deferring to ' ||
2037: 'WF_JAVA_DEFERRED');
2038: end if;
2039: wf_event.DeferEventToJava(p_source_type, p_event);
2035: 'wf.plsql.WF_EVENT.dispatch.Defer',
2036: 'Detected as deferred raise. Deferring to ' ||
2037: 'WF_JAVA_DEFERRED');
2038: end if;
2039: wf_event.DeferEventToJava(p_source_type, p_event);
2040: else
2041: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2042: wf_log_pkg.string(wf_log_pkg.level_statement,
2043: 'wf.plsql.WF_EVENT.dispatch.Defer',
2039: wf_event.DeferEventToJava(p_source_type, p_event);
2040: else
2041: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2042: wf_log_pkg.string(wf_log_pkg.level_statement,
2043: 'wf.plsql.WF_EVENT.dispatch.Defer',
2044: 'Detected as deferred raise. Deferring to ' ||
2045: 'WF_DEFERRED');
2046: end if;
2047: wf_event.deferevent(p_source_type, p_event);
2043: 'wf.plsql.WF_EVENT.dispatch.Defer',
2044: 'Detected as deferred raise. Deferring to ' ||
2045: 'WF_DEFERRED');
2046: end if;
2047: wf_event.deferevent(p_source_type, p_event);
2048: end if;
2049: return;
2050: end if;
2051: exception
2049: return;
2050: end if;
2051: exception
2052: when others then
2053: wf_event.setErrorInfo(p_event, 'ERROR');
2054: wf_event.saveErrorToQueue(p_event);
2055: wf_core.context('Wf_Event', 'Dispatch', l_event_name);
2056: raise;
2057: end;
2050: end if;
2051: exception
2052: when others then
2053: wf_event.setErrorInfo(p_event, 'ERROR');
2054: wf_event.saveErrorToQueue(p_event);
2055: wf_core.context('Wf_Event', 'Dispatch', l_event_name);
2056: raise;
2057: end;
2058:
2051: exception
2052: when others then
2053: wf_event.setErrorInfo(p_event, 'ERROR');
2054: wf_event.saveErrorToQueue(p_event);
2055: wf_core.context('Wf_Event', 'Dispatch', l_event_name);
2056: raise;
2057: end;
2058:
2059: --
2078: exception
2079: when trig_savepoint then
2080: --If the event has not been deferred, defer the event now.
2081: begin
2082: wf_event.deferevent(p_source_type,p_event);
2083: return;
2084: exception
2085: --Incase deferreing of event fails, save the error to queue.
2086: --Should we save the error to queue since it is WF error?
2084: exception
2085: --Incase deferreing of event fails, save the error to queue.
2086: --Should we save the error to queue since it is WF error?
2087: when others then
2088: wf_event.setErrorInfo(p_event, 'ERROR');
2089: wf_event.saveErrorToQueue(p_event);
2090: wf_core.context('Wf_Event', 'Dispatch', l_event_name);
2091: raise;
2092: end;
2085: --Incase deferreing of event fails, save the error to queue.
2086: --Should we save the error to queue since it is WF error?
2087: when others then
2088: wf_event.setErrorInfo(p_event, 'ERROR');
2089: wf_event.saveErrorToQueue(p_event);
2090: wf_core.context('Wf_Event', 'Dispatch', l_event_name);
2091: raise;
2092: end;
2093: end;
2086: --Should we save the error to queue since it is WF error?
2087: when others then
2088: wf_event.setErrorInfo(p_event, 'ERROR');
2089: wf_event.saveErrorToQueue(p_event);
2090: wf_core.context('Wf_Event', 'Dispatch', l_event_name);
2091: raise;
2092: end;
2093: end;
2094:
2101: if (l_skip_sub is not null AND p_source_type = 'LOCAL') then
2102:
2103: l_sub := wf_bes_cache.GetSubscriptionByGUID(l_event_name, l_skip_sub);
2104: if (l_sub is not null) then
2105: res := wf_event.dispatch_internal(p_source_type => l_sub.SOURCE_TYPE,
2106: p_rule_data => l_sub.RULE_DATA,
2107: p_rule_func => trim(l_sub.RULE_FUNCTION),
2108: p_sub_guid => l_skip_sub,
2109: p_source_agent_guid => l_sub.SOURCE_AGENT_GUID,
2129:
2130: for i in 1..l_subs_list.COUNT loop
2131: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2132: wf_log_pkg.string(wf_log_pkg.level_statement,
2133: 'wf.plsql.WF_EVENT.dispatch.Subscriptions',
2134: 'Dispatching '||l_subs_list(i).SOURCE_TYPE||' subscription '||
2135: 'with Phase '||l_subs_list(i).PHASE);
2136: end if;
2137:
2137:
2138: eguid := l_subs_list(i).GUID;
2139: subs_found := TRUE;
2140:
2141: res := wf_event.dispatch_internal(p_source_type => l_subs_list(i).SOURCE_TYPE,
2142: p_rule_data => l_subs_list(i).RULE_DATA,
2143: p_rule_func => trim(l_subs_list(i).RULE_FUNCTION),
2144: p_sub_guid => l_subs_list(i).GUID,
2145: p_source_agent_guid => p_source_agent_guid,
2158: else
2159:
2160: -- dispatch subscriptions to Any event. this call does not execute the
2161: -- cursor with union all
2162: l_subs_list := wf_bes_cache.GetSubscriptions(p_event_name => 'oracle.apps.wf.event.any',
2163: p_source_type => dispatch.p_source_type,
2164: p_source_agent => dispatch.p_source_agent_guid);
2165: -- dispatching all matching subscriptions for Any event
2166: if (l_subs_list is not null) then
2167:
2168: for i in 1..l_subs_list.COUNT loop
2169: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2170: wf_log_pkg.string(wf_log_pkg.level_statement,
2171: 'wf.plsql.WF_EVENT.dispatch.Any',
2172: 'Dispatching '||l_subs_list(i).SOURCE_TYPE||' subscription '||
2173: 'with Phase '||l_subs_list(i).PHASE);
2174: end if;
2175:
2175:
2176: eguid := l_subs_list(i).GUID;
2177: subs_found := TRUE;
2178:
2179: res := wf_event.dispatch_internal(p_source_type => l_subs_list(i).SOURCE_TYPE,
2180: p_rule_data => l_subs_list(i).RULE_DATA,
2181: p_rule_func => trim(l_subs_list(i).RULE_FUNCTION),
2182: p_sub_guid => l_subs_list(i).GUID,
2183: p_source_agent_guid => p_source_agent_guid,
2196: -- If no subscriptions dispatched, dispatch subscriptions for Unexpected event.
2197: -- Unexpected event is dispatched only for non-workflow events
2198: if ((not subs_found) and (l_event_name not like 'oracle.apps.wf%')) then
2199:
2200: l_subs_list := wf_bes_cache.GetSubscriptions(p_event_name => 'oracle.apps.wf.event.unexpected',
2201: p_source_type => dispatch.p_source_type,
2202: p_source_agent => dispatch.p_source_agent_guid);
2203: if (l_subs_list is not null) then
2204:
2204:
2205: for i in 1..l_subs_list.COUNT loop
2206: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2207: wf_log_pkg.string(wf_log_pkg.level_statement,
2208: 'wf.plsql.WF_EVENT.dispatch.Unexpected',
2209: 'Dispatching '||l_subs_list(i).SOURCE_TYPE||' subscription '||
2210: 'with Phase '||l_subs_list(i).PHASE);
2211: end if;
2212:
2210: 'with Phase '||l_subs_list(i).PHASE);
2211: end if;
2212:
2213: eguid := l_subs_list(i).GUID;
2214: res := wf_event.dispatch_internal(p_source_type => l_subs_list(i).SOURCE_TYPE,
2215: p_rule_data => l_subs_list(i).RULE_DATA,
2216: p_rule_func => trim(l_subs_list(i).RULE_FUNCTION),
2217: p_sub_guid => l_subs_list(i).GUID,
2218: p_source_agent_guid => p_source_agent_guid,
2229: end if;
2230: exception
2231: when others then
2232: -- Unexpected Error happened in dispatch_internal
2233: if (WF_EVENT.g_message_grouping = 'TRANSACTIONAL') then
2234: WF_CORE.Context('Wf_Event', 'Dispatch', l_event_name);
2235: else
2236: rollback to wf_dispatch_savepoint;
2237: p_event.setErrorSubscription(eguid);
2230: exception
2231: when others then
2232: -- Unexpected Error happened in dispatch_internal
2233: if (WF_EVENT.g_message_grouping = 'TRANSACTIONAL') then
2234: WF_CORE.Context('Wf_Event', 'Dispatch', l_event_name);
2235: else
2236: rollback to wf_dispatch_savepoint;
2237: p_event.setErrorSubscription(eguid);
2238: if (wf_event.wf_exception_source <> 'RULE') then
2234: WF_CORE.Context('Wf_Event', 'Dispatch', l_event_name);
2235: else
2236: rollback to wf_dispatch_savepoint;
2237: p_event.setErrorSubscription(eguid);
2238: if (wf_event.wf_exception_source <> 'RULE') then
2239: wf_event.wf_exception_source := 'WF';
2240: wf_event.setErrorInfo(p_event, 'UNEXPECTED');
2241: -- Unexpected Exception should be thrown up instead of
2242: -- being enqueued to error queue.
2235: else
2236: rollback to wf_dispatch_savepoint;
2237: p_event.setErrorSubscription(eguid);
2238: if (wf_event.wf_exception_source <> 'RULE') then
2239: wf_event.wf_exception_source := 'WF';
2240: wf_event.setErrorInfo(p_event, 'UNEXPECTED');
2241: -- Unexpected Exception should be thrown up instead of
2242: -- being enqueued to error queue.
2243: -- wf_event.saveErrorToQueue(p_event);
2236: rollback to wf_dispatch_savepoint;
2237: p_event.setErrorSubscription(eguid);
2238: if (wf_event.wf_exception_source <> 'RULE') then
2239: wf_event.wf_exception_source := 'WF';
2240: wf_event.setErrorInfo(p_event, 'UNEXPECTED');
2241: -- Unexpected Exception should be thrown up instead of
2242: -- being enqueued to error queue.
2243: -- wf_event.saveErrorToQueue(p_event);
2244: wf_core.context('Wf_Event', 'Dispatch', l_event_name);
2239: wf_event.wf_exception_source := 'WF';
2240: wf_event.setErrorInfo(p_event, 'UNEXPECTED');
2241: -- Unexpected Exception should be thrown up instead of
2242: -- being enqueued to error queue.
2243: -- wf_event.saveErrorToQueue(p_event);
2244: wf_core.context('Wf_Event', 'Dispatch', l_event_name);
2245: end if;
2246: end if;
2247: raise;
2240: wf_event.setErrorInfo(p_event, 'UNEXPECTED');
2241: -- Unexpected Exception should be thrown up instead of
2242: -- being enqueued to error queue.
2243: -- wf_event.saveErrorToQueue(p_event);
2244: wf_core.context('Wf_Event', 'Dispatch', l_event_name);
2245: end if;
2246: end if;
2247: raise;
2248: end;
2252: ---------------------------------------------------------------------------
2253: /*
2254: ** enqueue -
2255: */
2256: PROCEDURE enqueue(p_event in wf_event_t,
2257: p_out_agent_override in wf_agent_t)
2258: is
2259: cmd varchar2(1000);
2260: qh varchar2(240);
2286: p_executed := false;
2287:
2288: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2289: wf_log_pkg.string2(wf_log_pkg.level_statement,
2290: 'wf.plsql.wf_event.enqueue.qhandler_callout',
2291: 'Start executing queue handler - '||qh, true);
2292: end if;
2293:
2294: WF_AGT_DYN_FUNCS.StaticEnqueue(qh, p_event, p_out_agent_override, p_executed);
2302: end if;
2303:
2304: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2305: wf_log_pkg.string2(wf_log_pkg.level_statement,
2306: 'wf.plsql.wf_event.enqueue.qhandler_callout',
2307: 'End executing queue handler - '||qh, false);
2308: end if;
2309: exception
2310: when others then
2307: 'End executing queue handler - '||qh, false);
2308: end if;
2309: exception
2310: when others then
2311: wf_core.context('Wf_Event', 'Enqueue', p_event.getEventName(), qh);
2312: wf_core.token('FUNCTION_NAME', qh||'.enqueue()');
2313: --wf_core.raise('WF_EXT_FUNCTION');
2314: raise;
2315: end;
2317: /*
2318: ** dequeue -
2319: */
2320: PROCEDURE dequeue(p_agent_guid in raw,
2321: p_event out nocopy wf_event_t,
2322: p_queue_handler in out nocopy varchar2,
2323: p_wait in binary_integer,
2324: p_correlation in varchar2,
2325: p_deq_condition in varchar2)
2343: qh := p_queue_handler;
2344: end if;
2345:
2346: -- Set globals so the queue handlers can reference them.
2347: WF_EVENT.g_correlation := p_correlation;
2348: WF_EVENT.g_deq_condition := p_deq_condition;
2349:
2350: -- Call the static calls implementation first
2351: p_executed := false;
2344: end if;
2345:
2346: -- Set globals so the queue handlers can reference them.
2347: WF_EVENT.g_correlation := p_correlation;
2348: WF_EVENT.g_deq_condition := p_deq_condition;
2349:
2350: -- Call the static calls implementation first
2351: p_executed := false;
2352:
2351: p_executed := false;
2352:
2353: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2354: wf_log_pkg.string2(wf_log_pkg.level_statement,
2355: 'wf.plsql.wf_event.dequeue.qhandler_callout',
2356: 'Start executing queue handler - '||qh, true);
2357: end if;
2358:
2359: WF_AGT_DYN_FUNCS.StaticDequeue(qh, p_agent_guid, p_event, p_wait, p_executed);
2367: end if;
2368:
2369: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2370: wf_log_pkg.string2(wf_log_pkg.level_statement,
2371: 'wf.plsql.wf_event.dequeue.qhandler_callout',
2372: 'End executing queue handler - '||qh, false);
2373: end if;
2374:
2375: p_queue_handler := qh;
2374:
2375: p_queue_handler := qh;
2376: exception
2377: when others then
2378: wf_core.context('Wf_Event', 'Dequeue', p_agent_guid);
2379: wf_core.token('FUNCTION_NAME', qh||'.dequeue()');
2380: --wf_core.raise('WF_EXT_FUNCTION');
2381: raise;
2382: end;
2384: /*
2385: ** AddParameterToList -
2386: */
2387: -- YOHUANG 3571176
2388: -- Share the same logic as WF_EVENT_T.AddParameterToList
2389: -- If there is any change of logic in this method, the change
2390: -- should be propagated over to WF_EVENT_T.
2391: PROCEDURE AddParameterToList(p_name in varchar2,
2392: p_value in varchar2,
2386: */
2387: -- YOHUANG 3571176
2388: -- Share the same logic as WF_EVENT_T.AddParameterToList
2389: -- If there is any change of logic in this method, the change
2390: -- should be propagated over to WF_EVENT_T.
2391: PROCEDURE AddParameterToList(p_name in varchar2,
2392: p_value in varchar2,
2393: p_parameterlist in out nocopy wf_parameter_list_t)
2394: is
2478: if (myList(pos).getName() = p_Name) then
2479:
2480: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2481: wf_log_pkg.string(wf_log_pkg.level_statement,
2482: 'wf.plsql.WF_EVENT.getValueForParam.get',
2483: 'Name:'||p_Name||' Value:'||myList(pos).getValue());
2484: end if;
2485:
2486: return myList(pos).getValue();
2514: PROCEDURE SetDispatchMode (p_mode in varchar2)
2515: is
2516: begin
2517: if p_mode = 'ASYNC' then
2518: wf_event.phase_maxthreshold := -1;
2519: else
2520: wf_event.phase_maxthreshold := 100;
2521: end if;
2522: exception
2516: begin
2517: if p_mode = 'ASYNC' then
2518: wf_event.phase_maxthreshold := -1;
2519: else
2520: wf_event.phase_maxthreshold := 100;
2521: end if;
2522: exception
2523: when others then
2524: wf_core.context('Wf_Event', 'SetDispatchMode', p_mode);
2520: wf_event.phase_maxthreshold := 100;
2521: end if;
2522: exception
2523: when others then
2524: wf_core.context('Wf_Event', 'SetDispatchMode', p_mode);
2525: raise;
2526: end SetDispatchMode;
2527: ---------------------------------------------------------------------------
2528: /*
2530: */
2531: PROCEDURE InitPhaseMinThreshold
2532: is
2533: begin
2534: wf_event.phase_minthreshold := 0;
2535: end InitPhaseMinThreshold;
2536: ---------------------------------------------------------------------------
2537: /*
2538: ** DeferEvent -
2537: /*
2538: ** DeferEvent -
2539: */
2540: PROCEDURE DeferEvent(p_source_type in varchar2,
2541: p_event in out nocopy wf_event_t)
2542: is
2543: defagent wf_agent_t;
2544:
2545: begin
2545: begin
2546:
2547: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
2548: wf_log_pkg.string(wf_log_pkg.level_procedure,
2549: 'wf.plsql.WF_EVENT.DeferEvent.Begin',
2550: 'Deferring Event: '||p_event.getEventName());
2551: end if;
2552: --
2553: -- Get the Local System Name and set the deferred agent
2552: --
2553: -- Get the Local System Name and set the deferred agent
2554: --
2555:
2556: defagent := wf_agent_t('WF_DEFERRED',wf_event.local_system_name);
2557:
2558: --
2559: -- If the defer is for a local event, set the
2560: -- Deferred Agent/System into the message for
2562: --
2563: if p_source_type = 'LOCAL' then
2564: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2565: wf_log_pkg.string(wf_log_pkg.level_statement,
2566: 'wf.plsql.WF_EVENT.DeferEvent.Local',
2567: 'Detected as Local, setting From Agent:'||
2568: 'WF_DEFERRED@'||wf_event.local_system_name);
2569: end if;
2570: p_event.From_Agent := defagent;
2564: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2565: wf_log_pkg.string(wf_log_pkg.level_statement,
2566: 'wf.plsql.WF_EVENT.DeferEvent.Local',
2567: 'Detected as Local, setting From Agent:'||
2568: 'WF_DEFERRED@'||wf_event.local_system_name);
2569: end if;
2570: p_event.From_Agent := defagent;
2571: end if;
2572:
2574: -- Enqueue onto the deferred agent
2575: --
2576: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2577: wf_log_pkg.string(wf_log_pkg.level_statement,
2578: 'wf.plsql.WF_EVENT.DeferEvent.done',
2579: 'Enqueuing on Deferred Queue');
2580: end if;
2581:
2582: wf_event.enqueue(p_event,defagent);
2578: 'wf.plsql.WF_EVENT.DeferEvent.done',
2579: 'Enqueuing on Deferred Queue');
2580: end if;
2581:
2582: wf_event.enqueue(p_event,defagent);
2583:
2584: exception
2585: when others then
2586: wf_core.context('Wf_Event', 'DeferEvent', p_event.getEventName(),
2582: wf_event.enqueue(p_event,defagent);
2583:
2584: exception
2585: when others then
2586: wf_core.context('Wf_Event', 'DeferEvent', p_event.getEventName(),
2587: p_event.getEventKey());
2588: raise;
2589: end DeferEvent;
2590: ---------------------------------------------------------------------------
2591: /*
2592: ** DeferEventToJava -
2593: */
2594: PROCEDURE DeferEventToJava(p_source_type in varchar2,
2595: p_event in out nocopy wf_event_t)
2596: is
2597: defagent wf_agent_t;
2598:
2599: begin
2598:
2599: begin
2600: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
2601: wf_log_pkg.string(wf_log_pkg.level_procedure,
2602: 'wf.plsql.WF_EVENT.DeferEventToJava.Begin',
2603: 'Deferring Event: '|| p_event.getEventName());
2604: end if;
2605: --
2606: -- Get the Local System Name and set the deferred agent
2604: end if;
2605: --
2606: -- Get the Local System Name and set the deferred agent
2607: --
2608: defagent := wf_agent_t('WF_JAVA_DEFERRED', wf_event.local_system_name);
2609:
2610: --
2611: -- If the defer is for a local event, set the
2612: -- Deferred Agent/System into the message for
2614: --
2615: if p_source_type = 'LOCAL' then
2616: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2617: wf_log_pkg.string(wf_log_pkg.level_statement,
2618: 'wf.plsql.WF_EVENT.DeferEventToJava.Local',
2619: 'Detected as Local, setting From Agent:'||
2620: 'WF_JAVA_DEFERRED@'|| wf_event.local_system_name);
2621:
2622: end if;
2616: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2617: wf_log_pkg.string(wf_log_pkg.level_statement,
2618: 'wf.plsql.WF_EVENT.DeferEventToJava.Local',
2619: 'Detected as Local, setting From Agent:'||
2620: 'WF_JAVA_DEFERRED@'|| wf_event.local_system_name);
2621:
2622: end if;
2623: p_event.From_Agent := defagent;
2624: end if;
2630: --
2631: -- NOTE: Since we know that we need to defer to WF_JAVA_DEFERRED, we will
2632: -- directly invoke enqueue on the PL/SQL queue handler
2633: --
2634: wf_event_ojmstext_qh.enqueue(p_event, defagent);
2635:
2636: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2637: wf_log_pkg.string(wf_log_pkg.level_statement,
2638: 'wf.plsql.WF_EVENT.DeferEventToJava.done',
2634: wf_event_ojmstext_qh.enqueue(p_event, defagent);
2635:
2636: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2637: wf_log_pkg.string(wf_log_pkg.level_statement,
2638: 'wf.plsql.WF_EVENT.DeferEventToJava.done',
2639: 'Enqueuing on Java Deferred Queue');
2640: end if;
2641:
2642: exception
2640: end if;
2641:
2642: exception
2643: when others then
2644: wf_core.context('Wf_Event', 'DeferEventToJava', p_event.getEventName(),
2645: p_event.getEventKey());
2646: raise;
2647: end DeferEventToJava;
2648: ---------------------------------------------------------------------------
2651: */
2652: PROCEDURE GetDeferEventCtx (p_source_type in out nocopy varchar2,
2653: p_agent_name in varchar2,
2654: p_system_name in varchar2,
2655: p_event in wf_event_t)
2656: is
2657: subguid raw(16);
2658: lphasestart number;
2659: lsrc varchar2(10);
2658: lphasestart number;
2659: lsrc varchar2(10);
2660:
2661: -- bes caching implementation
2662: l_sub wf_event_subs_obj;
2663: l_event_name varchar2(240);
2664: begin
2665:
2666: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
2664: begin
2665:
2666: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
2667: wf_log_pkg.string(wf_log_pkg.level_procedure,
2668: 'wf.plsql.WF_EVENT.DeferEventCtx.Begin',
2669: 'Getting Defer Event Ctx');
2670: end if;
2671: --
2672: -- Determine the Start Phase, and sourec type
2673: --
2674: subguid := p_event.Error_Subscription;
2675: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2676: wf_log_pkg.string(wf_log_pkg.level_statement,
2677: 'wf.plsql.WF_EVENT.DeferEventCtx.sub_guid',
2678: 'Sub Guid is '||subguid);
2679: end if;
2680:
2681: l_event_name := p_event.GetEventName();
2694: END if;
2695:
2696: end if;
2697:
2698: wf_event.phase_minthreshold := lphasestart;
2699: else
2700: wf_event.phase_minthreshold := 0; -- for deferred raise
2701: end if;
2702:
2696: end if;
2697:
2698: wf_event.phase_minthreshold := lphasestart;
2699: else
2700: wf_event.phase_minthreshold := 0; -- for deferred raise
2701: end if;
2702:
2703: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2704: wf_log_pkg.string(wf_log_pkg.level_statement,
2701: end if;
2702:
2703: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2704: wf_log_pkg.string(wf_log_pkg.level_statement,
2705: 'wf.plsql.WF_EVENT.DeferEventCtx.phase',
2706: 'Start Phase is '||to_char(wf_event.phase_minthreshold));
2707: end if;
2708:
2709: if lsrc is null then
2702:
2703: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
2704: wf_log_pkg.string(wf_log_pkg.level_statement,
2705: 'wf.plsql.WF_EVENT.DeferEventCtx.phase',
2706: 'Start Phase is '||to_char(wf_event.phase_minthreshold));
2707: end if;
2708:
2709: if lsrc is null then
2710: --
2709: if lsrc is null then
2710: --
2711: -- Derive the Source Type
2712: --
2713: if ((p_agent_name = 'WF_DEFERRED') AND (p_system_name = wf_event.local_system_name)) then
2714: p_source_type := 'LOCAL';
2715: elsif ((p_system_name is null) OR (p_system_name <> wf_event.local_system_name))then
2716: p_source_type := 'EXTERNAL';
2717: elsif ((p_agent_name <> 'WF_DEFERRED') AND (p_system_name = wf_event.local_system_name)) then
2711: -- Derive the Source Type
2712: --
2713: if ((p_agent_name = 'WF_DEFERRED') AND (p_system_name = wf_event.local_system_name)) then
2714: p_source_type := 'LOCAL';
2715: elsif ((p_system_name is null) OR (p_system_name <> wf_event.local_system_name))then
2716: p_source_type := 'EXTERNAL';
2717: elsif ((p_agent_name <> 'WF_DEFERRED') AND (p_system_name = wf_event.local_system_name)) then
2718: p_source_type := 'EXTERNAL';
2719: end if;
2713: if ((p_agent_name = 'WF_DEFERRED') AND (p_system_name = wf_event.local_system_name)) then
2714: p_source_type := 'LOCAL';
2715: elsif ((p_system_name is null) OR (p_system_name <> wf_event.local_system_name))then
2716: p_source_type := 'EXTERNAL';
2717: elsif ((p_agent_name <> 'WF_DEFERRED') AND (p_system_name = wf_event.local_system_name)) then
2718: p_source_type := 'EXTERNAL';
2719: end if;
2720: else
2721: p_source_type := lsrc;
2722: end if;
2723:
2724: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
2725: wf_log_pkg.string(wf_log_pkg.level_procedure,
2726: 'wf.plsql.WF_EVENT.DeferEventCtx.End',
2727: 'Source Type is '||p_source_type);
2728: end if;
2729:
2730: exception
2730: exception
2731: /* Bug 2210085 */
2732: when no_data_found then
2733: /*
2734: wf_core.context('Wf_Event', 'GetDeferEventCtx','Sub guid is ' || subguid);
2735: wf_core.token('SGUID', subguid);
2736: wf_core.raise('WFE_SUB_DELETED');
2737: */
2738: raise;
2737: */
2738: raise;
2739:
2740: when others then
2741: wf_core.context('Wf_Event', 'GetDeferEventCtx', p_event.getEventName(),
2742: p_event.getEventKey());
2743: raise;
2744: end GetDeferEventCtx;
2745: ---------------------------------------------------------------------------
2750: is
2751: begin
2752: -- get the account name - only need this for WF_DEFERRED
2753: select sys_context('USERENV', 'CURRENT_SCHEMA')
2754: into wf_event.account_name
2755: from sys.dual;
2756: exception
2757: when others then
2758: wf_core.context('Wf_Event', 'SetAccountName');
2754: into wf_event.account_name
2755: from sys.dual;
2756: exception
2757: when others then
2758: wf_core.context('Wf_Event', 'SetAccountName');
2759: raise;
2760: end SetAccountName;
2761: ---------------------------------------------------------------------------
2762: --
2815: begin
2816:
2817: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
2818: wf_log_pkg.string(wf_log_pkg.level_procedure,
2819: 'wf.plsql.WF_EVENT.raise2.Begin',
2820: 'Event Name:'||p_event_name||' Event Key:'||p_event_key);
2821: end if;
2822:
2823: if (p_parameter_name1 is not NULL) then
2938: l_parameter_list.extend;
2939: l_parameter_list(i) := CreateParameter(p_parameter_name20, p_parameter_value20);
2940: end if;
2941:
2942: wf_event.raise(p_event_name, p_event_key, p_event_data, l_parameter_list, p_send_date);
2943:
2944: exception
2945: when others then
2946: raise;
2974: p_parameter_list in out nocopy wf_parameter_list_t,
2975: p_send_date in date)
2976: is
2977: o_value varchar2(200);
2978: event wf_event_t;
2979: begin
2980:
2981: -- Bug 9370391: tag DB session for BES module
2982: wf_core.tag_db_session(wf_core.conn_tag_bes, p_event_name);
2982: wf_core.tag_db_session(wf_core.conn_tag_bes, p_event_name);
2983:
2984: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
2985: wf_log_pkg.string(wf_log_pkg.level_procedure,
2986: 'wf.plsql.WF_EVENT.raise3.Begin',
2987: 'Event Name:'||p_event_name||' Event Key:'||p_event_key ||
2988: 'Maximum nested raise count:'|| wf_event.max_nested_raises||
2989: 'Nested raise count: '|| wf_event.nested_raise_count);
2990: end if;
2984: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
2985: wf_log_pkg.string(wf_log_pkg.level_procedure,
2986: 'wf.plsql.WF_EVENT.raise3.Begin',
2987: 'Event Name:'||p_event_name||' Event Key:'||p_event_key ||
2988: 'Maximum nested raise count:'|| wf_event.max_nested_raises||
2989: 'Nested raise count: '|| wf_event.nested_raise_count);
2990: end if;
2991:
2992: wf_event.nested_raise_count := wf_event.nested_raise_count + 1;
2985: wf_log_pkg.string(wf_log_pkg.level_procedure,
2986: 'wf.plsql.WF_EVENT.raise3.Begin',
2987: 'Event Name:'||p_event_name||' Event Key:'||p_event_key ||
2988: 'Maximum nested raise count:'|| wf_event.max_nested_raises||
2989: 'Nested raise count: '|| wf_event.nested_raise_count);
2990: end if;
2991:
2992: wf_event.nested_raise_count := wf_event.nested_raise_count + 1;
2993: if (wf_event.nested_raise_count > wf_event.max_nested_raises) then
2988: 'Maximum nested raise count:'|| wf_event.max_nested_raises||
2989: 'Nested raise count: '|| wf_event.nested_raise_count);
2990: end if;
2991:
2992: wf_event.nested_raise_count := wf_event.nested_raise_count + 1;
2993: if (wf_event.nested_raise_count > wf_event.max_nested_raises) then
2994: --Bug 2620834
2995: --The nested count is reset to the initial value that was set before the
2996: --recursion error occurs.
2989: 'Nested raise count: '|| wf_event.nested_raise_count);
2990: end if;
2991:
2992: wf_event.nested_raise_count := wf_event.nested_raise_count + 1;
2993: if (wf_event.nested_raise_count > wf_event.max_nested_raises) then
2994: --Bug 2620834
2995: --The nested count is reset to the initial value that was set before the
2996: --recursion error occurs.
2997: --In future if we allow the user to set the nested-raises -count
2995: --The nested count is reset to the initial value that was set before the
2996: --recursion error occurs.
2997: --In future if we allow the user to set the nested-raises -count
2998: --we could think of restting it to that value instead of zero.
2999: wf_event.nested_raise_count := 0;
3000:
3001: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
3002: wf_log_pkg.string(wf_log_pkg.level_error,
3003: 'wf.plsql.WF_EVENT.raise3.recursion_error',
2999: wf_event.nested_raise_count := 0;
3000:
3001: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
3002: wf_log_pkg.string(wf_log_pkg.level_error,
3003: 'wf.plsql.WF_EVENT.raise3.recursion_error',
3004: 'Recursion error raised. Nested raise count exceeded threshold');
3005: end if;
3006:
3007: wf_core.context('Wf_Event', 'raise', p_event_name, p_event_key);
3003: 'wf.plsql.WF_EVENT.raise3.recursion_error',
3004: 'Recursion error raised. Nested raise count exceeded threshold');
3005: end if;
3006:
3007: wf_core.context('Wf_Event', 'raise', p_event_name, p_event_key);
3008: wf_core.raise('WFE_RECURSION');
3009: end if;
3010:
3011: --Create the event that is to be raised
3008: wf_core.raise('WFE_RECURSION');
3009: end if;
3010:
3011: --Create the event that is to be raised
3012: wf_event_t.initialize(event);
3013: event.Send_Date := nvl(p_send_date,sysdate);
3014: event.Event_Name := p_event_name;
3015: event.Event_Key := p_event_key;
3016: event.Parameter_List := p_parameter_list;
3017: if (p_event_data is not null) then
3018: event.event_data := p_event_data ;
3019: end if;
3020:
3021: wf_event.dispatch('LOCAL', null, event);
3022:
3023: --Output the parameterlist which may have been
3024: --modified
3025: p_parameter_list := event.getParameterList();
3023: --Output the parameterlist which may have been
3024: --modified
3025: p_parameter_list := event.getParameterList();
3026:
3027: if (wf_event.nested_raise_count >0) then
3028: wf_event.nested_raise_count := wf_event.nested_raise_count - 1;
3029: end if;
3030:
3031: event := null;
3024: --modified
3025: p_parameter_list := event.getParameterList();
3026:
3027: if (wf_event.nested_raise_count >0) then
3028: wf_event.nested_raise_count := wf_event.nested_raise_count - 1;
3029: end if;
3030:
3031: event := null;
3032:
3045: --------------------------------------------------------------------------------
3046: PROCEDURE Set_Correlation(p_correlation in varchar2)
3047: IS
3048: BEGIN
3049: WF_EVENT.g_correlation := p_correlation;
3050: WF_EVENT.navigation := dbms_aq.first_message;
3051:
3052: END Set_Correlation;
3053:
3046: PROCEDURE Set_Correlation(p_correlation in varchar2)
3047: IS
3048: BEGIN
3049: WF_EVENT.g_correlation := p_correlation;
3050: WF_EVENT.navigation := dbms_aq.first_message;
3051:
3052: END Set_Correlation;
3053:
3054: ---------------------------------------------------------------------------
3058: */
3059: PROCEDURE SetMaxNestedRaise (maxcount in number)
3060: is
3061: begin
3062: wf_event.max_nested_raises := maxcount;
3063: end;
3064: ---------------------------------------------------------------------------
3065: /*
3066: ** SetNestedRaiseCount - Populates Global Variable : nested_raises_count
3069: */
3070: PROCEDURE SetNestedRaiseCount (nestedcount in number)
3071: is
3072: begin
3073: wf_event.nested_raise_count := nestedcount;
3074: --This private variable P_NESTED_RAISE_COUNT is updated
3075: --in sync with the setting of nested_raise_count global variable
3076: --It is used when the recursion error occurs inorder to reset the
3077: --value of wf_event.nested_raise_count.
3073: wf_event.nested_raise_count := nestedcount;
3074: --This private variable P_NESTED_RAISE_COUNT is updated
3075: --in sync with the setting of nested_raise_count global variable
3076: --It is used when the recursion error occurs inorder to reset the
3077: --value of wf_event.nested_raise_count.
3078: --P_NESTED_RAISE_COUNT := wf_event.nested_raise_count;
3079: end;
3080: ---------------------------------------------------------------------------
3081: /*
3074: --This private variable P_NESTED_RAISE_COUNT is updated
3075: --in sync with the setting of nested_raise_count global variable
3076: --It is used when the recursion error occurs inorder to reset the
3077: --value of wf_event.nested_raise_count.
3078: --P_NESTED_RAISE_COUNT := wf_event.nested_raise_count;
3079: end;
3080: ---------------------------------------------------------------------------
3081: /*
3082: ** GetMaxNestedRaise - Get the value of the Global Variable max_nested_raises
3085: FUNCTION GetMaxNestedRaise
3086: return number
3087: is
3088: begin
3089: return wf_event.max_nested_raises;
3090: end;
3091:
3092: ---------------------------------------------------------------------------
3093: /*
3098: FUNCTION GetNestedRaiseCount
3099: return number
3100: is
3101: begin
3102: return wf_event.nested_raise_count;
3103: end;
3104:
3105: ---------------------------------------------------------------------------
3106:
3107: FUNCTION Get_MsgId
3108: return varchar2
3109: is
3110: begin
3111: return wf_event.g_msgid;
3112: end;
3113:
3114: ---------------------------------------------------------------------------
3115: /*
3119: system_name out nocopy varchar2,
3120: system_status out nocopy varchar2)
3121: is
3122: begin
3123: system_guid := wf_event.local_system_guid;
3124: system_name := wf_event.local_system_name;
3125: system_status := wf_event.local_system_status;
3126: exception
3127: when others then
3120: system_status out nocopy varchar2)
3121: is
3122: begin
3123: system_guid := wf_event.local_system_guid;
3124: system_name := wf_event.local_system_name;
3125: system_status := wf_event.local_system_status;
3126: exception
3127: when others then
3128: wf_core.context('Wf_Event', 'GetLocalSystemName');
3121: is
3122: begin
3123: system_guid := wf_event.local_system_guid;
3124: system_name := wf_event.local_system_name;
3125: system_status := wf_event.local_system_status;
3126: exception
3127: when others then
3128: wf_core.context('Wf_Event', 'GetLocalSystemName');
3129: end GetLocalSystemInfo;
3124: system_name := wf_event.local_system_name;
3125: system_status := wf_event.local_system_status;
3126: exception
3127: when others then
3128: wf_core.context('Wf_Event', 'GetLocalSystemName');
3129: end GetLocalSystemInfo;
3130: ---------------------------------------------------------------------------
3131: /*
3132: ** GetSourceAgentGUID -
3145: agent_guid := l_agent_obj.GUID;
3146: else
3147: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
3148: wf_log_pkg.string(wf_log_pkg.level_error,
3149: 'wf.plsql.WF_EVENT.GetSourceAgentGUID.Error',
3150: 'Specified source agent row does '||
3151: 'not exist in database. Setting to NULL.');
3152: end if;
3153: agent_guid := null;
3153: agent_guid := null;
3154: end if;
3155: exception
3156: when others then
3157: wf_core.context('Wf_Event', 'GetSourceAgentGUID', agent_name);
3158: raise;
3159: end GetSourceAgentGUID;
3160: ---------------------------------------------------------------------------
3161: /*
3175: l_agent_obj wf_agent_obj;
3176: begin
3177: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
3178: wf_log_pkg.string(wf_log_pkg.level_procedure,
3179: 'wf.plsql.WF_EVENT.GetAgentDetails.Begin',
3180: 'Get Agent Details');
3181: end if;
3182:
3183: if(agent_name is not null and agent_name <> wf_event.pv_last_agent_name) then
3179: 'wf.plsql.WF_EVENT.GetAgentDetails.Begin',
3180: 'Get Agent Details');
3181: end if;
3182:
3183: if(agent_name is not null and agent_name <> wf_event.pv_last_agent_name) then
3184: -- for a given agent name Query wf_agents to get the agent info
3185:
3186: l_agent_obj := wf_bes_cache.GetAgentByName(agent_name, null);
3187: if (l_agent_obj is not null) then
3189: end if;
3190:
3191: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
3192: wf_log_pkg.string(wf_log_pkg.level_statement,
3193: 'wf.plsql.WF_EVENT.GetAgentDetails',
3194: 'l_queue_name = ' || l_queue_name);
3195: end if;
3196:
3197: -- since since queue_name is a nullable col. l_queue_name could be null
3205: if (l_pos > 0) then
3206: l_owner := substr(l_queue_name, 1, l_pos - 1);
3207: else
3208: -- if queue_name does not contain schema we will look in WF_SCHEMA
3209: l_owner := wf_event.schema_name;
3210: end if;
3211:
3212: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
3213: wf_log_pkg.string(wf_log_pkg.level_statement,
3210: end if;
3211:
3212: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
3213: wf_log_pkg.string(wf_log_pkg.level_statement,
3214: 'wf.plsql.WF_EVENT.GetAgentDetails',
3215: 'l_name = ' || l_name ||
3216: ' l_owner = ' || l_owner);
3217: end if;
3218:
3218:
3219: -- retrieve recipients (MULTIPLE or SINGLE) for AQ
3220: -- 3659756 When get agent details, check if the enqueue and dequeue are enabled.
3221: select aq.queue_type, aq.QUEUE_TABLE, trim(dequeue_enabled)
3222: into WF_EVENT.g_queueType, l_queue_table, WF_EVENT.pv_last_dequeue_enabled
3223: from all_queues aq
3224: where aq.owner = l_owner
3225: and aq.name = l_name;
3226:
3224: where aq.owner = l_owner
3225: and aq.name = l_name;
3226:
3227: select aqt.recipients, aqt.message_grouping
3228: into WF_EVENT.pv_last_recipients, WF_EVENT.g_message_grouping
3229: from all_queue_tables aqt
3230: where aqt.queue_table = l_queue_table
3231: and aqt.owner = l_owner;
3232:
3230: where aqt.queue_table = l_queue_table
3231: and aqt.owner = l_owner;
3232:
3233: -- update package variables
3234: wf_event.pv_last_agent_name := agent_name;
3235: -- YOHUANG, l_queue_name shouldn't have owner information
3236: wf_event.pv_last_queue_name := l_name; --l_queue_name;
3237: wf_event.pv_last_schema_name := l_owner;
3238: else
3232:
3233: -- update package variables
3234: wf_event.pv_last_agent_name := agent_name;
3235: -- YOHUANG, l_queue_name shouldn't have owner information
3236: wf_event.pv_last_queue_name := l_name; --l_queue_name;
3237: wf_event.pv_last_schema_name := l_owner;
3238: else
3239: raise no_data_found;
3240: end if;
3233: -- update package variables
3234: wf_event.pv_last_agent_name := agent_name;
3235: -- YOHUANG, l_queue_name shouldn't have owner information
3236: wf_event.pv_last_queue_name := l_name; --l_queue_name;
3237: wf_event.pv_last_schema_name := l_owner;
3238: else
3239: raise no_data_found;
3240: end if;
3241: end if;
3240: end if;
3241: end if;
3242: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
3243: wf_log_pkg.string(wf_log_pkg.level_procedure,
3244: 'wf.plsql.WF_EVENT.GetAgentDetails.END',
3245: 'Get Agent Details');
3246: end if;
3247: exception
3248: when no_data_found then
3285:
3286: begin
3287: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
3288: wf_log_pkg.string(wf_log_pkg.level_procedure,
3289: 'wf.plsql.WF_EVENT.StartAgent.Begin',
3290: 'Starting Agents');
3291: end if;
3292: --Bug 2307433
3293: --Enable the deferred and error queues for
3296: --must be started.
3297: --schema := wf_core.translate('WF_SCHEMA');
3298: --Bug 3659756, no longer start fixed name queues.
3299: /*
3300: for q_name in q_disabled (wf_event.schema_name) loop
3301: DBMS_AQADM.START_QUEUE(wf_event.schema_name||'.'||q_name.name);
3302: end loop;
3303: */
3304: -- The agent details must be retrieved even for seeded queue.
3297: --schema := wf_core.translate('WF_SCHEMA');
3298: --Bug 3659756, no longer start fixed name queues.
3299: /*
3300: for q_name in q_disabled (wf_event.schema_name) loop
3301: DBMS_AQADM.START_QUEUE(wf_event.schema_name||'.'||q_name.name);
3302: end loop;
3303: */
3304: -- The agent details must be retrieved even for seeded queue.
3305: GetAgentDetails(agent_name);
3305: GetAgentDetails(agent_name);
3306:
3307: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
3308: wf_log_pkg.string(wf_log_pkg.level_statement,
3309: 'wf.plsql.WF_EVENT.StartAgent',
3310: 'dequeue_enabled = ' || WF_EVENT.pv_last_dequeue_enabled);
3311: end if;
3312:
3313: if (WF_EVENT.pv_last_dequeue_enabled = 'NO') then
3306:
3307: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
3308: wf_log_pkg.string(wf_log_pkg.level_statement,
3309: 'wf.plsql.WF_EVENT.StartAgent',
3310: 'dequeue_enabled = ' || WF_EVENT.pv_last_dequeue_enabled);
3311: end if;
3312:
3313: if (WF_EVENT.pv_last_dequeue_enabled = 'NO') then
3314: -- If the user has disabled the queue for enqueue don't override it.
3309: 'wf.plsql.WF_EVENT.StartAgent',
3310: 'dequeue_enabled = ' || WF_EVENT.pv_last_dequeue_enabled);
3311: end if;
3312:
3313: if (WF_EVENT.pv_last_dequeue_enabled = 'NO') then
3314: -- If the user has disabled the queue for enqueue don't override it.
3315: -- So we only enable the dequeue if dequeue is not enabled and we don't change
3316: -- the current setting of enqueue.
3317:
3316: -- the current setting of enqueue.
3317:
3318: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
3319: wf_log_pkg.string(wf_log_pkg.level_statement,
3320: 'wf.plsql.WF_EVENT.StartAgent',
3321: 'starting queue = ' || wf_event.pv_last_schema_name
3322: || '.' || wf_event.pv_last_agent_name);
3323: end if;
3324:
3317:
3318: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
3319: wf_log_pkg.string(wf_log_pkg.level_statement,
3320: 'wf.plsql.WF_EVENT.StartAgent',
3321: 'starting queue = ' || wf_event.pv_last_schema_name
3322: || '.' || wf_event.pv_last_agent_name);
3323: end if;
3324:
3325: DBMS_AQADM.START_QUEUE(wf_event.pv_last_schema_name || '.' || wf_event.pv_last_queue_name, FALSE);
3318: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
3319: wf_log_pkg.string(wf_log_pkg.level_statement,
3320: 'wf.plsql.WF_EVENT.StartAgent',
3321: 'starting queue = ' || wf_event.pv_last_schema_name
3322: || '.' || wf_event.pv_last_agent_name);
3323: end if;
3324:
3325: DBMS_AQADM.START_QUEUE(wf_event.pv_last_schema_name || '.' || wf_event.pv_last_queue_name, FALSE);
3326:
3321: 'starting queue = ' || wf_event.pv_last_schema_name
3322: || '.' || wf_event.pv_last_agent_name);
3323: end if;
3324:
3325: DBMS_AQADM.START_QUEUE(wf_event.pv_last_schema_name || '.' || wf_event.pv_last_queue_name, FALSE);
3326:
3327: WF_EVENT.pv_last_dequeue_enabled := 'YES';
3328: end if;
3329:
3323: end if;
3324:
3325: DBMS_AQADM.START_QUEUE(wf_event.pv_last_schema_name || '.' || wf_event.pv_last_queue_name, FALSE);
3326:
3327: WF_EVENT.pv_last_dequeue_enabled := 'YES';
3328: end if;
3329:
3330: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
3331: wf_log_pkg.string(wf_log_pkg.level_procedure,
3328: end if;
3329:
3330: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
3331: wf_log_pkg.string(wf_log_pkg.level_procedure,
3332: 'wf.plsql.WF_EVENT.StartAgent.End',
3333: 'Starting Agents');
3334: end if;
3335: exception
3336: when no_data_found then
3333: 'Starting Agents');
3334: end if;
3335: exception
3336: when no_data_found then
3337: wf_core.context('Wf_Event', 'StartAgent', agent_name);
3338: wf_core.raise('WFE_AGENT_NOTEXIST');
3339: when others then
3340: wf_core.context('Wf_Event', 'StartAgent', agent_name);
3341: raise;
3336: when no_data_found then
3337: wf_core.context('Wf_Event', 'StartAgent', agent_name);
3338: wf_core.raise('WFE_AGENT_NOTEXIST');
3339: when others then
3340: wf_core.context('Wf_Event', 'StartAgent', agent_name);
3341: raise;
3342: end StartAgent;
3343: ---------------------------------------------------------------------------
3344: /*
3375:
3376: -- bug 2897326, agent_list is initialized differently for
3377: -- multi or single consumer queue
3378:
3379: IF wf_event.pv_last_recipients = 'MULTIPLE' THEN
3380: l_agent_list(1) := sys.aq$_agent(wf_event.pv_last_agent_name,
3381: wf_event.pv_last_schema_name || '.' || wf_event.pv_last_queue_name, null);
3382: ELSE
3383: l_agent_list(1) := sys.aq$_agent(null,
3376: -- bug 2897326, agent_list is initialized differently for
3377: -- multi or single consumer queue
3378:
3379: IF wf_event.pv_last_recipients = 'MULTIPLE' THEN
3380: l_agent_list(1) := sys.aq$_agent(wf_event.pv_last_agent_name,
3381: wf_event.pv_last_schema_name || '.' || wf_event.pv_last_queue_name, null);
3382: ELSE
3383: l_agent_list(1) := sys.aq$_agent(null,
3384: wf_event.pv_last_schema_name || '.' || wf_event.pv_last_queue_name, null);
3377: -- multi or single consumer queue
3378:
3379: IF wf_event.pv_last_recipients = 'MULTIPLE' THEN
3380: l_agent_list(1) := sys.aq$_agent(wf_event.pv_last_agent_name,
3381: wf_event.pv_last_schema_name || '.' || wf_event.pv_last_queue_name, null);
3382: ELSE
3383: l_agent_list(1) := sys.aq$_agent(null,
3384: wf_event.pv_last_schema_name || '.' || wf_event.pv_last_queue_name, null);
3385: END IF;
3380: l_agent_list(1) := sys.aq$_agent(wf_event.pv_last_agent_name,
3381: wf_event.pv_last_schema_name || '.' || wf_event.pv_last_queue_name, null);
3382: ELSE
3383: l_agent_list(1) := sys.aq$_agent(null,
3384: wf_event.pv_last_schema_name || '.' || wf_event.pv_last_queue_name, null);
3385: END IF;
3386:
3387: -- "Listen" for messages on this queue
3388: BEGIN
3433: l_equalpos := instr(l_namevalue, '=', 1, 1);
3434: l_name := substr(l_namevalue,1,l_equalpos-1);
3435: l_value := substr(l_namevalue,l_equalpos+1,length(l_namevalue));
3436:
3437: wf_event.AddParameterToList(l_name, l_value, l_param_list);
3438: l_start := l_endposition+1;
3439: end loop;
3440: end if;
3441: return l_param_list;
3440: end if;
3441: return l_param_list;
3442: exception
3443: when others then
3444: wf_core.Context('WF_EVENT', 'GetParamListFromString');
3445: raise;
3446: end GetParamListFromString;
3447:
3448: /* PRIVATE
3455: l_msgGrouping varchar2(30);
3456: begin
3457: if (p_agentName is not null) then
3458:
3459: if(p_agentName <> wf_event.pv_last_agent_name) then
3460: GetAgentDetails(p_agentName);
3461: end if;
3462:
3463: return (WF_EVENT.g_message_grouping = 'TRANSACTIONAL');
3459: if(p_agentName <> wf_event.pv_last_agent_name) then
3460: GetAgentDetails(p_agentName);
3461: end if;
3462:
3463: return (WF_EVENT.g_message_grouping = 'TRANSACTIONAL');
3464: else
3465: return false;
3466: end if;
3467: exception
3694: /*
3695: ** SetSystemGlobals - Populates System Global Variables
3696: */
3697: begin
3698: wf_event.local_system_guid := hextoraw(wf_core.translate('WF_SYSTEM_GUID'));
3699:
3700: wf_event.local_system_status := wf_core.translate('WF_SYSTEM_STATUS');
3701:
3702: select name into wf_event.local_system_name
3696: */
3697: begin
3698: wf_event.local_system_guid := hextoraw(wf_core.translate('WF_SYSTEM_GUID'));
3699:
3700: wf_event.local_system_status := wf_core.translate('WF_SYSTEM_STATUS');
3701:
3702: select name into wf_event.local_system_name
3703: from wf_systems
3704: where guid = wf_event.local_system_guid;
3698: wf_event.local_system_guid := hextoraw(wf_core.translate('WF_SYSTEM_GUID'));
3699:
3700: wf_event.local_system_status := wf_core.translate('WF_SYSTEM_STATUS');
3701:
3702: select name into wf_event.local_system_name
3703: from wf_systems
3704: where guid = wf_event.local_system_guid;
3705: ---------------------------------------------------------------------------
3706: wf_event.schema_name := wf_core.translate('WF_SCHEMA');
3700: wf_event.local_system_status := wf_core.translate('WF_SYSTEM_STATUS');
3701:
3702: select name into wf_event.local_system_name
3703: from wf_systems
3704: where guid = wf_event.local_system_guid;
3705: ---------------------------------------------------------------------------
3706: wf_event.schema_name := wf_core.translate('WF_SCHEMA');
3707:
3708: wf_event.pv_last_agent_name := ' ';
3702: select name into wf_event.local_system_name
3703: from wf_systems
3704: where guid = wf_event.local_system_guid;
3705: ---------------------------------------------------------------------------
3706: wf_event.schema_name := wf_core.translate('WF_SCHEMA');
3707:
3708: wf_event.pv_last_agent_name := ' ';
3709: wf_event.pv_last_queue_name := ' ';
3710: wf_event.pv_last_schema_name := ' ';
3704: where guid = wf_event.local_system_guid;
3705: ---------------------------------------------------------------------------
3706: wf_event.schema_name := wf_core.translate('WF_SCHEMA');
3707:
3708: wf_event.pv_last_agent_name := ' ';
3709: wf_event.pv_last_queue_name := ' ';
3710: wf_event.pv_last_schema_name := ' ';
3711: wf_event.pv_last_recipients := ' ';
3712: wf_event.pv_last_dequeue_enabled := ' ';
3705: ---------------------------------------------------------------------------
3706: wf_event.schema_name := wf_core.translate('WF_SCHEMA');
3707:
3708: wf_event.pv_last_agent_name := ' ';
3709: wf_event.pv_last_queue_name := ' ';
3710: wf_event.pv_last_schema_name := ' ';
3711: wf_event.pv_last_recipients := ' ';
3712: wf_event.pv_last_dequeue_enabled := ' ';
3713:
3706: wf_event.schema_name := wf_core.translate('WF_SCHEMA');
3707:
3708: wf_event.pv_last_agent_name := ' ';
3709: wf_event.pv_last_queue_name := ' ';
3710: wf_event.pv_last_schema_name := ' ';
3711: wf_event.pv_last_recipients := ' ';
3712: wf_event.pv_last_dequeue_enabled := ' ';
3713:
3714: end WF_EVENT;
3707:
3708: wf_event.pv_last_agent_name := ' ';
3709: wf_event.pv_last_queue_name := ' ';
3710: wf_event.pv_last_schema_name := ' ';
3711: wf_event.pv_last_recipients := ' ';
3712: wf_event.pv_last_dequeue_enabled := ' ';
3713:
3714: end WF_EVENT;
3708: wf_event.pv_last_agent_name := ' ';
3709: wf_event.pv_last_queue_name := ' ';
3710: wf_event.pv_last_schema_name := ' ';
3711: wf_event.pv_last_recipients := ' ';
3712: wf_event.pv_last_dequeue_enabled := ' ';
3713:
3714: end WF_EVENT;
3710: wf_event.pv_last_schema_name := ' ';
3711: wf_event.pv_last_recipients := ' ';
3712: wf_event.pv_last_dequeue_enabled := ' ';
3713:
3714: end WF_EVENT;