75:
76: l_event_obj := wf_bes_cache.GetEventByName(ename);
77:
78: if (l_event_obj is null) then
79: wf_core.context('Wf_Event', 'setMessage', ename, ekey);
80: wf_core.raise('WFE_EVENT_NOTEXIST');
81: end if;
82:
83: func := l_event_obj.GENERATE_FUNCTION;
76: l_event_obj := wf_bes_cache.GetEventByName(ename);
77:
78: if (l_event_obj is null) then
79: wf_core.context('Wf_Event', 'setMessage', ename, ekey);
80: wf_core.raise('WFE_EVENT_NOTEXIST');
81: end if;
82:
83: func := l_event_obj.GENERATE_FUNCTION;
84:
132: -- p_event.setEventData(msg);
133: --end if;
134: exception
135: when others then
136: if (Wf_Core.Error_Name = 'WFE_EVENT_NOTEXIST') then
137: raise;
138: else
139: wf_core.context('Wf_Event', 'setMessage', ename, ekey, func);
140: WF_CORE.Token('ENAME', p_event.event_name);
135: when others then
136: if (Wf_Core.Error_Name = 'WFE_EVENT_NOTEXIST') then
137: raise;
138: else
139: wf_core.context('Wf_Event', 'setMessage', ename, ekey, func);
140: WF_CORE.Token('ENAME', p_event.event_name);
141: wf_core.token('FUNCTION_NAME', func);
142: WF_CORE.Token('SQLCODE', to_char(sqlcode));
143: WF_CORE.Token('SQLERRM', sqlerrm);
136: if (Wf_Core.Error_Name = 'WFE_EVENT_NOTEXIST') then
137: raise;
138: else
139: wf_core.context('Wf_Event', 'setMessage', ename, ekey, func);
140: WF_CORE.Token('ENAME', p_event.event_name);
141: wf_core.token('FUNCTION_NAME', func);
142: WF_CORE.Token('SQLCODE', to_char(sqlcode));
143: WF_CORE.Token('SQLERRM', sqlerrm);
144: WF_CORE.Raise('WFE_DISPATCH_GEN_ERR');
137: raise;
138: else
139: wf_core.context('Wf_Event', 'setMessage', ename, ekey, func);
140: WF_CORE.Token('ENAME', p_event.event_name);
141: wf_core.token('FUNCTION_NAME', func);
142: WF_CORE.Token('SQLCODE', to_char(sqlcode));
143: WF_CORE.Token('SQLERRM', sqlerrm);
144: WF_CORE.Raise('WFE_DISPATCH_GEN_ERR');
145: end if;
138: else
139: wf_core.context('Wf_Event', 'setMessage', ename, ekey, func);
140: WF_CORE.Token('ENAME', p_event.event_name);
141: wf_core.token('FUNCTION_NAME', func);
142: WF_CORE.Token('SQLCODE', to_char(sqlcode));
143: WF_CORE.Token('SQLERRM', sqlerrm);
144: WF_CORE.Raise('WFE_DISPATCH_GEN_ERR');
145: end if;
146: end;
139: wf_core.context('Wf_Event', 'setMessage', ename, ekey, func);
140: WF_CORE.Token('ENAME', p_event.event_name);
141: wf_core.token('FUNCTION_NAME', func);
142: WF_CORE.Token('SQLCODE', to_char(sqlcode));
143: WF_CORE.Token('SQLERRM', sqlerrm);
144: WF_CORE.Raise('WFE_DISPATCH_GEN_ERR');
145: end if;
146: end;
147: -----------------------------------------------------------------------
140: WF_CORE.Token('ENAME', p_event.event_name);
141: wf_core.token('FUNCTION_NAME', func);
142: WF_CORE.Token('SQLCODE', to_char(sqlcode));
143: WF_CORE.Token('SQLERRM', sqlerrm);
144: WF_CORE.Raise('WFE_DISPATCH_GEN_ERR');
145: end if;
146: end;
147: -----------------------------------------------------------------------
148: /*
161: 'wf.plsql.WF_EVENT.setErrorInfo.begin',
162: 'Setting Error Info');
163: end if;
164:
165: -- First look for a standard WF_CORE exception.
166: wf_core.get_error(err_name, err_msg, err_stack, 2000);
167:
168: if (err_name is null) then
169: -- If no WF_CORE exception, look for an Oracle error.
162: 'Setting Error Info');
163: end if;
164:
165: -- First look for a standard WF_CORE exception.
166: wf_core.get_error(err_name, err_msg, err_stack, 2000);
167:
168: if (err_name is null) then
169: -- If no WF_CORE exception, look for an Oracle error.
170: err_name := to_char(sqlcode);
165: -- First look for a standard WF_CORE exception.
166: wf_core.get_error(err_name, err_msg, err_stack, 2000);
167:
168: if (err_name is null) then
169: -- If no WF_CORE exception, look for an Oracle error.
170: err_name := to_char(sqlcode);
171: err_msg := sqlerrm;
172: end if;
173:
177: p_event.addParameterToList('ERROR_NAME', err_name);
178: p_event.addParameterToList('ERROR_TYPE', p_type);
179: exception
180: when others then
181: wf_core.context('Wf_Event', 'setErrorInfo', p_event.getEventName());
182: raise;
183: end;
184: -----------------------------------------------------------------------
185: /*
213: 'error info saved');
214: end if;
215: exception
216: when others then
217: wf_core.context('Wf_Event', 'saveErrorToQueue', p_event.getEventName());
218: wf_core.token('FUNCTION_NAME', 'WF_ERROR_QH.enqueue()');
219: --wf_core.raise('WF_EXT_FUNCTION');
220: raise;
221: end;
214: end if;
215: exception
216: when others then
217: wf_core.context('Wf_Event', 'saveErrorToQueue', p_event.getEventName());
218: wf_core.token('FUNCTION_NAME', 'WF_ERROR_QH.enqueue()');
219: --wf_core.raise('WF_EXT_FUNCTION');
220: raise;
221: end;
222: --------------------------------------------------------------------------
215: exception
216: when others then
217: wf_core.context('Wf_Event', 'saveErrorToQueue', p_event.getEventName());
218: wf_core.token('FUNCTION_NAME', 'WF_ERROR_QH.enqueue()');
219: --wf_core.raise('WF_EXT_FUNCTION');
220: raise;
221: end;
222: --------------------------------------------------------------------------
223: -----------------------------------------------------------------------
252: 'error info saved');
253: end if;
254: exception
255: when others then
256: wf_core.context('Wf_Event', 'saveErrorToQueue', p_event.getEventName());
257: wf_core.token('FUNCTION_NAME', 'WF_EVENT_OJMSTEXT_QH.enqueue()');
258: --wf_core.raise('WF_EXT_FUNCTION');
259: raise;
260: end;
253: end if;
254: exception
255: when others then
256: wf_core.context('Wf_Event', 'saveErrorToQueue', p_event.getEventName());
257: wf_core.token('FUNCTION_NAME', 'WF_EVENT_OJMSTEXT_QH.enqueue()');
258: --wf_core.raise('WF_EXT_FUNCTION');
259: raise;
260: end;
261: --------------------------------------------------------------------------
254: exception
255: when others then
256: wf_core.context('Wf_Event', 'saveErrorToQueue', p_event.getEventName());
257: wf_core.token('FUNCTION_NAME', 'WF_EVENT_OJMSTEXT_QH.enqueue()');
258: --wf_core.raise('WF_EXT_FUNCTION');
259: raise;
260: end;
261: --------------------------------------------------------------------------
262: /*
380:
381: return false;
382: exception
383: when others then
384: wf_core.context('Wf_Event', 'isDeferToJava', p_event_name);
385: raise;
386: end isDeferToJava;
387:
388: --------------------------------------------------------------------------
700: rollback to wf_dispatch_savepoint;
701: p_event.setErrorSubscription(p_sub_guid);
702: p_event.addParameterToList('ERROR_TYPE', 'UNEXPECTED');
703: wf_event.wf_exception_source := 'RULE';
704: WF_CORE.Token('ENAME', p_event.event_name);
705: WF_CORE.Token('EKEY', p_event.event_key);
706: WF_CORE.Token('RULE', myfunc);
707: WF_CORE.Token('SQLCODE', to_char(sqlcode));
708: WF_CORE.Token('SQLERRM', sqlerrm);
701: p_event.setErrorSubscription(p_sub_guid);
702: p_event.addParameterToList('ERROR_TYPE', 'UNEXPECTED');
703: wf_event.wf_exception_source := 'RULE';
704: WF_CORE.Token('ENAME', p_event.event_name);
705: WF_CORE.Token('EKEY', p_event.event_key);
706: WF_CORE.Token('RULE', myfunc);
707: WF_CORE.Token('SQLCODE', to_char(sqlcode));
708: WF_CORE.Token('SQLERRM', sqlerrm);
709: WF_CORE.Raise('WFE_DISPATCH_RULE_ERR');
702: p_event.addParameterToList('ERROR_TYPE', 'UNEXPECTED');
703: wf_event.wf_exception_source := 'RULE';
704: WF_CORE.Token('ENAME', p_event.event_name);
705: WF_CORE.Token('EKEY', p_event.event_key);
706: WF_CORE.Token('RULE', myfunc);
707: WF_CORE.Token('SQLCODE', to_char(sqlcode));
708: WF_CORE.Token('SQLERRM', sqlerrm);
709: WF_CORE.Raise('WFE_DISPATCH_RULE_ERR');
710: end if;
703: wf_event.wf_exception_source := 'RULE';
704: WF_CORE.Token('ENAME', p_event.event_name);
705: WF_CORE.Token('EKEY', p_event.event_key);
706: WF_CORE.Token('RULE', myfunc);
707: WF_CORE.Token('SQLCODE', to_char(sqlcode));
708: WF_CORE.Token('SQLERRM', sqlerrm);
709: WF_CORE.Raise('WFE_DISPATCH_RULE_ERR');
710: end if;
711:
704: WF_CORE.Token('ENAME', p_event.event_name);
705: WF_CORE.Token('EKEY', p_event.event_key);
706: WF_CORE.Token('RULE', myfunc);
707: WF_CORE.Token('SQLCODE', to_char(sqlcode));
708: WF_CORE.Token('SQLERRM', sqlerrm);
709: WF_CORE.Raise('WFE_DISPATCH_RULE_ERR');
710: end if;
711:
712: end;
705: WF_CORE.Token('EKEY', p_event.event_key);
706: WF_CORE.Token('RULE', myfunc);
707: WF_CORE.Token('SQLCODE', to_char(sqlcode));
708: WF_CORE.Token('SQLERRM', sqlerrm);
709: WF_CORE.Raise('WFE_DISPATCH_RULE_ERR');
710: end if;
711:
712: end;
713:
742: -- If subscription returns error when listener listens on error agent.
743: -- Bug 4207885: Set the exception source to Rule when
744: -- Raising exceptions.
745: wf_event.wf_exception_source := 'RULE';
746: wf_core.token('ENAME', p_event.event_name);
747: wf_core.token('EKEY', p_event.event_key);
748: wf_core.token('SQLERRM', null);
749: wf_core.token('SQLCODE', null);
750: wf_core.raise('WFE_DISPATCH_RULE_ERR');
743: -- Bug 4207885: Set the exception source to Rule when
744: -- Raising exceptions.
745: wf_event.wf_exception_source := 'RULE';
746: wf_core.token('ENAME', p_event.event_name);
747: wf_core.token('EKEY', p_event.event_key);
748: wf_core.token('SQLERRM', null);
749: wf_core.token('SQLCODE', null);
750: wf_core.raise('WFE_DISPATCH_RULE_ERR');
751: end if;
744: -- Raising exceptions.
745: wf_event.wf_exception_source := 'RULE';
746: wf_core.token('ENAME', p_event.event_name);
747: wf_core.token('EKEY', p_event.event_key);
748: wf_core.token('SQLERRM', null);
749: wf_core.token('SQLCODE', null);
750: wf_core.raise('WFE_DISPATCH_RULE_ERR');
751: end if;
752:
745: wf_event.wf_exception_source := 'RULE';
746: wf_core.token('ENAME', p_event.event_name);
747: wf_core.token('EKEY', p_event.event_key);
748: wf_core.token('SQLERRM', null);
749: wf_core.token('SQLCODE', null);
750: wf_core.raise('WFE_DISPATCH_RULE_ERR');
751: end if;
752:
753: if (res = 'ERROR') then
746: wf_core.token('ENAME', p_event.event_name);
747: wf_core.token('EKEY', p_event.event_key);
748: wf_core.token('SQLERRM', null);
749: wf_core.token('SQLCODE', null);
750: wf_core.raise('WFE_DISPATCH_RULE_ERR');
751: end if;
752:
753: if (res = 'ERROR') then
754:
769: -- Bug 1840819
770: -- Catch the no savepoint exception incase commit has happened.
771: -- In this case, the subsequent subscriptions can't be executed
772: -- because is savepoint no longer valid.
773: wf_core.token('EVENT',p_event.getEventName());
774: p_event.setErrorMessage(wf_core.substitute('WFERR',
775: 'WFE_COMMIT_IN_DISPATCH'));
776: res := 'TRANSACTION_COMMITED';
777: end;
770: -- Catch the no savepoint exception incase commit has happened.
771: -- In this case, the subsequent subscriptions can't be executed
772: -- because is savepoint no longer valid.
773: wf_core.token('EVENT',p_event.getEventName());
774: p_event.setErrorMessage(wf_core.substitute('WFERR',
775: 'WFE_COMMIT_IN_DISPATCH'));
776: res := 'TRANSACTION_COMMITED';
777: end;
778: end if;
783: return (res);
784:
785: exception
786: when others then
787: wf_core.context('Wf_Event', 'dispatch_internal');
788: raise;
789: end;
790: ---------------------------------------------------------------------------
791: /*
807:
808: if (l_agent_obj is not null) then
809: return wf_agent_t(l_agent_obj.NAME, l_agent_obj.SYSTEM_NAME);
810: else
811: wf_core.raise('WFE_AGENT_NOTEXIST');
812: end if;
813: exception
814: when others then
815: wf_core.context('Wf_Event', 'newAgent', p_agent_guid);
811: wf_core.raise('WFE_AGENT_NOTEXIST');
812: end if;
813: exception
814: when others then
815: wf_core.context('Wf_Event', 'newAgent', p_agent_guid);
816: raise;
817: end;
818: ---------------------------------------------------------------------------
819: /*
850: return result;
851:
852: exception
853: when others then
854: wf_core.context('Wf_Event', 'Test', p_event_name);
855: raise;
856: end;
857: ---------------------------------------------------------------------------
858: /*
881: --
882: if (p_event.GetToAgent() is null AND p_event.GetFromAgent() is null) then
883: -- Either source or destination must be defined.
884: -- Raise Error.
885: wf_core.context('Wf_Event', 'Send', p_event.getEventName());
886: wf_core.raise('Either source or destination must be defined.'); -- wfsql.msg
887: end if;
888:
889: if p_event.GetToAgent() is not null then
882: if (p_event.GetToAgent() is null AND p_event.GetFromAgent() is null) then
883: -- Either source or destination must be defined.
884: -- Raise Error.
885: wf_core.context('Wf_Event', 'Send', p_event.getEventName());
886: wf_core.raise('Either source or destination must be defined.'); -- wfsql.msg
887: end if;
888:
889: if p_event.GetToAgent() is not null then
890: toagtname := p_event.getToAgent().getName();
955:
956: wf_event.enqueue(p_event);
957: exception
958: when no_data_found then
959: wf_core.context('Wf_Event', 'Send', p_event.getEventName());
960: wf_core.token('AGENT', toagtname);
961: wf_core.raise('WFE_AGENT_NOMATCH');
962: when others then
963: wf_core.context('Wf_Event', 'Send', p_event.getEventName());
956: wf_event.enqueue(p_event);
957: exception
958: when no_data_found then
959: wf_core.context('Wf_Event', 'Send', p_event.getEventName());
960: wf_core.token('AGENT', toagtname);
961: wf_core.raise('WFE_AGENT_NOMATCH');
962: when others then
963: wf_core.context('Wf_Event', 'Send', p_event.getEventName());
964: raise;
957: exception
958: when no_data_found then
959: wf_core.context('Wf_Event', 'Send', p_event.getEventName());
960: wf_core.token('AGENT', toagtname);
961: wf_core.raise('WFE_AGENT_NOMATCH');
962: when others then
963: wf_core.context('Wf_Event', 'Send', p_event.getEventName());
964: raise;
965: end;
959: wf_core.context('Wf_Event', 'Send', p_event.getEventName());
960: wf_core.token('AGENT', toagtname);
961: wf_core.raise('WFE_AGENT_NOMATCH');
962: when others then
963: wf_core.context('Wf_Event', 'Send', p_event.getEventName());
964: raise;
965: end;
966: ---------------------------------------------------------------------------
967: /*
1031: -- from protocol names as used in the event manager and the
1032: -- protocol numbers used by AQ.
1033:
1034: if((l_to_protocol is null) or (l_to_protocol not in ('SQLNET'))) then
1035: wf_core.context('WF_EVENT', 'Get_Recipient', 'Bad Protocol',
1036: l_to_protocol, l_to_queue_name);
1037: end if;
1038:
1039: return sys.aq$_agent(p_to_agent_name,
1238: p_max_error_count := 0;
1239: end if;
1240:
1241: if ((p_correlation is not NULL) and (p_deq_condition is not NULL)) then
1242: WF_CORE.Context('WF_EVENT', 'Listen', p_agent_name, p_correlation,
1243: p_deq_condition);
1244: WF_CORE.Raise('WFE_CORRID_VS_CONDITION');
1245:
1246: end if;
1240:
1241: if ((p_correlation is not NULL) and (p_deq_condition is not NULL)) then
1242: WF_CORE.Context('WF_EVENT', 'Listen', p_agent_name, p_correlation,
1243: p_deq_condition);
1244: WF_CORE.Raise('WFE_CORRID_VS_CONDITION');
1245:
1246: end if;
1247:
1248: -- lookup agent info --
1248: -- lookup agent info --
1249: --
1250: --
1251: if (WF_EVENT.g_local_system_guid is NULL) then
1252: g_local_system_guid := hextoraw(WF_CORE.Translate('WF_SYSTEM_GUID'));
1253: end if;
1254:
1255: -- get the agent information for the local system
1256: l_agent_obj := wf_bes_cache.GetAgentByName(p_agent_name, null);
1277: else
1278: --This is a transactional queue, but since there was a correlation id
1279: --passed, we cannot call Listen_GRP, so we will raise an error to the
1280: --caller to resolve.
1281: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1282: wf_core.token('AGENT', p_agent_name);
1283: wf_core.token('API', 'WF_EVENT.Listen_GRP');
1284: wf_core.raise('WFE_TRXN_QUEUE');
1285:
1278: --This is a transactional queue, but since there was a correlation id
1279: --passed, we cannot call Listen_GRP, so we will raise an error to the
1280: --caller to resolve.
1281: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1282: wf_core.token('AGENT', p_agent_name);
1283: wf_core.token('API', 'WF_EVENT.Listen_GRP');
1284: wf_core.raise('WFE_TRXN_QUEUE');
1285:
1286: end if;
1279: --passed, we cannot call Listen_GRP, so we will raise an error to the
1280: --caller to resolve.
1281: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1282: wf_core.token('AGENT', p_agent_name);
1283: wf_core.token('API', 'WF_EVENT.Listen_GRP');
1284: wf_core.raise('WFE_TRXN_QUEUE');
1285:
1286: end if;
1287: end if;
1280: --caller to resolve.
1281: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1282: wf_core.token('AGENT', p_agent_name);
1283: wf_core.token('API', 'WF_EVENT.Listen_GRP');
1284: wf_core.raise('WFE_TRXN_QUEUE');
1285:
1286: end if;
1287: end if;
1288:
1293: st := 'EXTERNAL';
1294: end if;
1295:
1296: -- check system status --
1297: -- stat := wf_core.translate('WF_SYSTEM_STATUS');
1298:
1299: -- Set the account name - only need this for WF_DEFERRED
1300: wf_event.SetAccountName;
1301:
1380:
1381: IF evt_name IS NULL THEN
1382: evt.setEventName('UNEXPECTED_ERROR');
1383: evt.setEventKey('UNEXPERR');
1384: evt_errmsg := evt.getErrorMessage || wf_core.newline ||
1385: wf_core.translate('WF_EVTNAME_NULL');
1386: evt.setErrorMessage(wf_core.translate('WF_EVTNAME_NULL'));
1387: END IF;
1388: end if;
1381: IF evt_name IS NULL THEN
1382: evt.setEventName('UNEXPECTED_ERROR');
1383: evt.setEventKey('UNEXPERR');
1384: evt_errmsg := evt.getErrorMessage || wf_core.newline ||
1385: wf_core.translate('WF_EVTNAME_NULL');
1386: evt.setErrorMessage(wf_core.translate('WF_EVTNAME_NULL'));
1387: END IF;
1388: end if;
1389:
1382: evt.setEventName('UNEXPECTED_ERROR');
1383: evt.setEventKey('UNEXPERR');
1384: evt_errmsg := evt.getErrorMessage || wf_core.newline ||
1385: wf_core.translate('WF_EVTNAME_NULL');
1386: evt.setErrorMessage(wf_core.translate('WF_EVTNAME_NULL'));
1387: END IF;
1388: end if;
1389:
1390: --
1469: end if;
1470: rollback to bes_before_dequeue_qh;
1471:
1472: -- Error WFE_DISPATCH_RULE_ERR already has sufficient info on the error. Just raise it
1473: if (wf_core.error_name = 'WFE_DISPATCH_RULE_ERR') then
1474: raise;
1475: else
1476: wf_core.token('ENAME', evt.event_name);
1477: wf_core.token('EKEY', evt.event_key);
1472: -- Error WFE_DISPATCH_RULE_ERR already has sufficient info on the error. Just raise it
1473: if (wf_core.error_name = 'WFE_DISPATCH_RULE_ERR') then
1474: raise;
1475: else
1476: wf_core.token('ENAME', evt.event_name);
1477: wf_core.token('EKEY', evt.event_key);
1478: wf_core.token('SQLERRM', sqlerrm);
1479: wf_core.token('SQLCODE', sqlcode);
1480: wf_core.raise('WFE_UNHANDLED_ERROR');
1473: if (wf_core.error_name = 'WFE_DISPATCH_RULE_ERR') then
1474: raise;
1475: else
1476: wf_core.token('ENAME', evt.event_name);
1477: wf_core.token('EKEY', evt.event_key);
1478: wf_core.token('SQLERRM', sqlerrm);
1479: wf_core.token('SQLCODE', sqlcode);
1480: wf_core.raise('WFE_UNHANDLED_ERROR');
1481: end if;
1474: raise;
1475: else
1476: wf_core.token('ENAME', evt.event_name);
1477: wf_core.token('EKEY', evt.event_key);
1478: wf_core.token('SQLERRM', sqlerrm);
1479: wf_core.token('SQLCODE', sqlcode);
1480: wf_core.raise('WFE_UNHANDLED_ERROR');
1481: end if;
1482: elsif (wf_event.wf_exception_source = 'WF') then
1475: else
1476: wf_core.token('ENAME', evt.event_name);
1477: wf_core.token('EKEY', evt.event_key);
1478: wf_core.token('SQLERRM', sqlerrm);
1479: wf_core.token('SQLCODE', sqlcode);
1480: wf_core.raise('WFE_UNHANDLED_ERROR');
1481: end if;
1482: elsif (wf_event.wf_exception_source = 'WF') then
1483: -- Bug 4207885: Add the handler of exception with source WF
1476: wf_core.token('ENAME', evt.event_name);
1477: wf_core.token('EKEY', evt.event_key);
1478: wf_core.token('SQLERRM', sqlerrm);
1479: wf_core.token('SQLCODE', sqlcode);
1480: wf_core.raise('WFE_UNHANDLED_ERROR');
1481: end if;
1482: elsif (wf_event.wf_exception_source = 'WF') then
1483: -- Bug 4207885: Add the handler of exception with source WF
1484: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1485: wf_log_pkg.string(wf_log_pkg.level_error,
1486: 'wf.plsql.WF_EVENT.listen.dispatch_error',
1487: 'Unexpected Function Error');
1488: end if;
1489: wf_core.token('ENAME', evt.event_name);
1490: wf_core.token('EKEY', evt.event_key);
1491: wf_core.token('SQLERRM', sqlerrm);
1492: wf_core.token('SQLCODE', sqlcode);
1493: wf_core.raise('WFE_UNHANDLED_ERROR');
1486: 'wf.plsql.WF_EVENT.listen.dispatch_error',
1487: 'Unexpected Function Error');
1488: end if;
1489: wf_core.token('ENAME', evt.event_name);
1490: wf_core.token('EKEY', evt.event_key);
1491: wf_core.token('SQLERRM', sqlerrm);
1492: wf_core.token('SQLCODE', sqlcode);
1493: wf_core.raise('WFE_UNHANDLED_ERROR');
1494: else
1487: 'Unexpected Function Error');
1488: end if;
1489: wf_core.token('ENAME', evt.event_name);
1490: wf_core.token('EKEY', evt.event_key);
1491: wf_core.token('SQLERRM', sqlerrm);
1492: wf_core.token('SQLCODE', sqlcode);
1493: wf_core.raise('WFE_UNHANDLED_ERROR');
1494: else
1495: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1488: end if;
1489: wf_core.token('ENAME', evt.event_name);
1490: wf_core.token('EKEY', evt.event_key);
1491: wf_core.token('SQLERRM', sqlerrm);
1492: wf_core.token('SQLCODE', sqlcode);
1493: wf_core.raise('WFE_UNHANDLED_ERROR');
1494: else
1495: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1496: wf_log_pkg.string(wf_log_pkg.level_error,
1489: wf_core.token('ENAME', evt.event_name);
1490: wf_core.token('EKEY', evt.event_key);
1491: wf_core.token('SQLERRM', sqlerrm);
1492: wf_core.token('SQLCODE', sqlcode);
1493: wf_core.raise('WFE_UNHANDLED_ERROR');
1494: else
1495: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1496: wf_log_pkg.string(wf_log_pkg.level_error,
1497: 'wf.plsql.WF_EVENT.listen.error',
1504: end if;
1505: end;
1506:
1507: -- check system status --
1508: stat := wf_core.translate('WF_SYSTEM_STATUS');
1509: if ((stat <> 'ENABLED') AND (st <> stat)) then
1510: exit;
1511: end if;
1512:
1555: if (wf_event.wf_exception_source = 'WF'
1556: OR wf_event.wf_exception_source = 'QH') then
1557: raise;
1558: else
1559: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1560: wf_core.raise('WFE_AGENT_NOTEXIST');
1561: end if;
1562: when others then
1563: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1556: OR wf_event.wf_exception_source = 'QH') then
1557: raise;
1558: else
1559: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1560: wf_core.raise('WFE_AGENT_NOTEXIST');
1561: end if;
1562: when others then
1563: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1564: raise;
1559: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1560: wf_core.raise('WFE_AGENT_NOTEXIST');
1561: end if;
1562: when others then
1563: wf_core.context('Wf_Event', 'Listen', p_agent_name);
1564: raise;
1565: end;
1566: ---------------------------------------------------------------------------
1567: /*
1614: errbuf := '';
1615: retcode := '0';
1616: exception
1617: when others then
1618: wf_core.get_error(errname, errmsg, errstack);
1619: if (errmsg is not null) then
1620: errbuf := errmsg;
1621: else
1622: errbuf := sqlerrm;
1654: -- Confirm that p_agent_name includes a transactional queue.
1655: --
1656: --
1657: if (WF_EVENT.g_local_system_guid is NULL) then
1658: g_local_system_guid := hextoraw(WF_CORE.Translate('WF_SYSTEM_GUID'));
1659: end if;
1660:
1661: GetAgentDetails(p_agent_name);
1662:
1662:
1663: -- get agent details for local system
1664: l_agent_obj := wf_bes_cache.GetAgentByName(p_agent_name, null);
1665: if (l_agent_obj is null) then
1666: wf_core.context('Wf_Event', 'Listen_GRP', p_agent_name);
1667: wf_core.raise('WFE_AGENT_NOTEXIST');
1668: end if;
1669:
1670: if (WF_EVENT.g_message_grouping <> 'TRANSACTIONAL') then
1663: -- get agent details for local system
1664: l_agent_obj := wf_bes_cache.GetAgentByName(p_agent_name, null);
1665: if (l_agent_obj is null) then
1666: wf_core.context('Wf_Event', 'Listen_GRP', p_agent_name);
1667: wf_core.raise('WFE_AGENT_NOTEXIST');
1668: end if;
1669:
1670: if (WF_EVENT.g_message_grouping <> 'TRANSACTIONAL') then
1671: --This is not a transactional queue.
1668: end if;
1669:
1670: if (WF_EVENT.g_message_grouping <> 'TRANSACTIONAL') then
1671: --This is not a transactional queue.
1672: WF_CORE.Context('Wf_Event', 'Listen_GRP', p_agent_name);
1673: WF_CORE.Token('AGENT', p_agent_name);
1674: WF_CORE.Token('API', 'WF_EVENT.Listen');
1675: WF_CORE.Raise('WFE_NONTRXN_QUEUE');
1676: end if;
1669:
1670: if (WF_EVENT.g_message_grouping <> 'TRANSACTIONAL') then
1671: --This is not a transactional queue.
1672: WF_CORE.Context('Wf_Event', 'Listen_GRP', p_agent_name);
1673: WF_CORE.Token('AGENT', p_agent_name);
1674: WF_CORE.Token('API', 'WF_EVENT.Listen');
1675: WF_CORE.Raise('WFE_NONTRXN_QUEUE');
1676: end if;
1677:
1670: if (WF_EVENT.g_message_grouping <> 'TRANSACTIONAL') then
1671: --This is not a transactional queue.
1672: WF_CORE.Context('Wf_Event', 'Listen_GRP', p_agent_name);
1673: WF_CORE.Token('AGENT', p_agent_name);
1674: WF_CORE.Token('API', 'WF_EVENT.Listen');
1675: WF_CORE.Raise('WFE_NONTRXN_QUEUE');
1676: end if;
1677:
1678: --Verifying that the system is not disabled.
1671: --This is not a transactional queue.
1672: WF_CORE.Context('Wf_Event', 'Listen_GRP', p_agent_name);
1673: WF_CORE.Token('AGENT', p_agent_name);
1674: WF_CORE.Token('API', 'WF_EVENT.Listen');
1675: WF_CORE.Raise('WFE_NONTRXN_QUEUE');
1676: end if;
1677:
1678: --Verifying that the system is not disabled.
1679: if (wf_event.local_system_status = 'DISABLED') then
1686: ** We need to explicitly make sure that if someones Queue Handler
1687: ** blows up we rollback the transaction, just in case they don't
1688: */
1689: loop --Outer loop to process all transactions.
1690: WF_CORE.Clear; --Clear any tokens that were set from the previous
1691: --transaction dequeue.
1692:
1693: begin --We will begin processing a transaction (message group).
1694: savepoint trxn_start;
1753:
1754: if (evt.getEventName) is NULL then
1755: evt.setEventName('UNEXPECTED_ERROR');
1756: evt.setEventKey('UNEXPERR');
1757: evt_errmsg := evt.getErrorMessage || wf_core.newline ||
1758: wf_core.translate('WF_EVTNAME_NULL');
1759: evt.setErrorMessage(wf_core.translate('WF_EVTNAME_NULL'));
1760: END IF;
1761:
1754: if (evt.getEventName) is NULL then
1755: evt.setEventName('UNEXPECTED_ERROR');
1756: evt.setEventKey('UNEXPERR');
1757: evt_errmsg := evt.getErrorMessage || wf_core.newline ||
1758: wf_core.translate('WF_EVTNAME_NULL');
1759: evt.setErrorMessage(wf_core.translate('WF_EVTNAME_NULL'));
1760: END IF;
1761:
1762:
1755: evt.setEventName('UNEXPECTED_ERROR');
1756: evt.setEventKey('UNEXPERR');
1757: evt_errmsg := evt.getErrorMessage || wf_core.newline ||
1758: wf_core.translate('WF_EVTNAME_NULL');
1759: evt.setErrorMessage(wf_core.translate('WF_EVTNAME_NULL'));
1760: END IF;
1761:
1762:
1763: -- Begin Dispatching the event message.
1776:
1777: end;
1778:
1779: -- check system status --
1780: stat := wf_core.translate('WF_SYSTEM_STATUS');
1781: if ((stat <> 'ENABLED') AND (st <> stat)) then
1782: exit;
1783: end if;
1784:
1864: if (wf_event.wf_exception_source = 'WF'
1865: OR wf_event.wf_exception_source = 'QH') then
1866: raise;
1867: else
1868: wf_core.context('Wf_Event', 'Listen_GRP', p_agent_name);
1869: wf_core.raise('WFE_AGENT_NOTEXIST');
1870: end if;
1871: when others then
1872: wf_core.context('Wf_Event', 'Listen_GRP', p_agent_name);
1865: OR wf_event.wf_exception_source = 'QH') then
1866: raise;
1867: else
1868: wf_core.context('Wf_Event', 'Listen_GRP', p_agent_name);
1869: wf_core.raise('WFE_AGENT_NOTEXIST');
1870: end if;
1871: when others then
1872: wf_core.context('Wf_Event', 'Listen_GRP', p_agent_name);
1873: raise;
1868: wf_core.context('Wf_Event', 'Listen_GRP', p_agent_name);
1869: wf_core.raise('WFE_AGENT_NOTEXIST');
1870: end if;
1871: when others then
1872: wf_core.context('Wf_Event', 'Listen_GRP', p_agent_name);
1873: raise;
1874: end;
1875:
1876: ---------------------------------------------------------------------------
1890: errbuf := '';
1891: retcode := '0';
1892: exception
1893: when others then
1894: wf_core.get_error(errname, errmsg, errstack);
1895: if (errmsg is not null) then
1896: errbuf := errmsg;
1897: else
1898: errbuf := sqlerrm;
1994: exception
1995: when others then
1996: wf_event.setErrorInfo(p_event, 'ERROR');
1997: wf_event.saveErrorToQueue(p_event);
1998: wf_core.context('Wf_Event', 'Dispatch', l_event_name);
1999: raise;
2000: end;
2001:
2002: --
2029: --Should we save the error to queue since it is WF error?
2030: when others then
2031: wf_event.setErrorInfo(p_event, 'ERROR');
2032: wf_event.saveErrorToQueue(p_event);
2033: wf_core.context('Wf_Event', 'Dispatch', l_event_name);
2034: raise;
2035: end;
2036: end;
2037:
2173: exception
2174: when others then
2175: -- Unexpected Error happened in dispatch_internal
2176: if (WF_EVENT.g_message_grouping = 'TRANSACTIONAL') then
2177: WF_CORE.Context('Wf_Event', 'Dispatch', l_event_name);
2178: else
2179: rollback to wf_dispatch_savepoint;
2180: p_event.setErrorSubscription(eguid);
2181: if (wf_event.wf_exception_source <> 'RULE') then
2183: wf_event.setErrorInfo(p_event, 'UNEXPECTED');
2184: -- Unexpected Exception should be thrown up instead of
2185: -- being enqueued to error queue.
2186: -- wf_event.saveErrorToQueue(p_event);
2187: wf_core.context('Wf_Event', 'Dispatch', l_event_name);
2188: end if;
2189: end if;
2190: raise;
2191: end;
2250: 'End executing queue handler - '||qh, false);
2251: end if;
2252: exception
2253: when others then
2254: wf_core.context('Wf_Event', 'Enqueue', p_event.getEventName(), qh);
2255: wf_core.token('FUNCTION_NAME', qh||'.enqueue()');
2256: --wf_core.raise('WF_EXT_FUNCTION');
2257: raise;
2258: end;
2251: end if;
2252: exception
2253: when others then
2254: wf_core.context('Wf_Event', 'Enqueue', p_event.getEventName(), qh);
2255: wf_core.token('FUNCTION_NAME', qh||'.enqueue()');
2256: --wf_core.raise('WF_EXT_FUNCTION');
2257: raise;
2258: end;
2259: ---------------------------------------------------------------------------
2252: exception
2253: when others then
2254: wf_core.context('Wf_Event', 'Enqueue', p_event.getEventName(), qh);
2255: wf_core.token('FUNCTION_NAME', qh||'.enqueue()');
2256: --wf_core.raise('WF_EXT_FUNCTION');
2257: raise;
2258: end;
2259: ---------------------------------------------------------------------------
2260: /*
2317:
2318: p_queue_handler := qh;
2319: exception
2320: when others then
2321: wf_core.context('Wf_Event', 'Dequeue', p_agent_guid);
2322: wf_core.token('FUNCTION_NAME', qh||'.dequeue()');
2323: --wf_core.raise('WF_EXT_FUNCTION');
2324: raise;
2325: end;
2318: p_queue_handler := qh;
2319: exception
2320: when others then
2321: wf_core.context('Wf_Event', 'Dequeue', p_agent_guid);
2322: wf_core.token('FUNCTION_NAME', qh||'.dequeue()');
2323: --wf_core.raise('WF_EXT_FUNCTION');
2324: raise;
2325: end;
2326: ---------------------------------------------------------------------------
2319: exception
2320: when others then
2321: wf_core.context('Wf_Event', 'Dequeue', p_agent_guid);
2322: wf_core.token('FUNCTION_NAME', qh||'.dequeue()');
2323: --wf_core.raise('WF_EXT_FUNCTION');
2324: raise;
2325: end;
2326: ---------------------------------------------------------------------------
2327: /*
2463: wf_event.phase_maxthreshold := 100;
2464: end if;
2465: exception
2466: when others then
2467: wf_core.context('Wf_Event', 'SetDispatchMode', p_mode);
2468: raise;
2469: end SetDispatchMode;
2470: ---------------------------------------------------------------------------
2471: /*
2525: wf_event.enqueue(p_event,defagent);
2526:
2527: exception
2528: when others then
2529: wf_core.context('Wf_Event', 'DeferEvent', p_event.getEventName(),
2530: p_event.getEventKey());
2531: raise;
2532: end DeferEvent;
2533: ---------------------------------------------------------------------------
2582: end if;
2583:
2584: exception
2585: when others then
2586: wf_core.context('Wf_Event', 'DeferEventToJava', p_event.getEventName(),
2587: p_event.getEventKey());
2588: raise;
2589: end DeferEventToJava;
2590: ---------------------------------------------------------------------------
2672: exception
2673: /* Bug 2210085 */
2674: when no_data_found then
2675: /*
2676: wf_core.context('Wf_Event', 'GetDeferEventCtx','Sub guid is ' || subguid);
2677: wf_core.token('SGUID', subguid);
2678: wf_core.raise('WFE_SUB_DELETED');
2679: */
2680: raise;
2673: /* Bug 2210085 */
2674: when no_data_found then
2675: /*
2676: wf_core.context('Wf_Event', 'GetDeferEventCtx','Sub guid is ' || subguid);
2677: wf_core.token('SGUID', subguid);
2678: wf_core.raise('WFE_SUB_DELETED');
2679: */
2680: raise;
2681:
2674: when no_data_found then
2675: /*
2676: wf_core.context('Wf_Event', 'GetDeferEventCtx','Sub guid is ' || subguid);
2677: wf_core.token('SGUID', subguid);
2678: wf_core.raise('WFE_SUB_DELETED');
2679: */
2680: raise;
2681:
2682: when others then
2679: */
2680: raise;
2681:
2682: when others then
2683: wf_core.context('Wf_Event', 'GetDeferEventCtx', p_event.getEventName(),
2684: p_event.getEventKey());
2685: raise;
2686: end GetDeferEventCtx;
2687: ---------------------------------------------------------------------------
2696: into wf_event.account_name
2697: from sys.dual;
2698: exception
2699: when others then
2700: wf_core.context('Wf_Event', 'SetAccountName');
2701: raise;
2702: end SetAccountName;
2703: ---------------------------------------------------------------------------
2704: --
2942: 'wf.plsql.WF_EVENT.raise3.recursion_error',
2943: 'Recursion error raised. Nested raise count exceeded threshold');
2944: end if;
2945:
2946: wf_core.context('Wf_Event', 'raise', p_event_name, p_event_key);
2947: wf_core.raise('WFE_RECURSION');
2948: end if;
2949:
2950: --Create the event that is to be raised
2943: 'Recursion error raised. Nested raise count exceeded threshold');
2944: end if;
2945:
2946: wf_core.context('Wf_Event', 'raise', p_event_name, p_event_key);
2947: wf_core.raise('WFE_RECURSION');
2948: end if;
2949:
2950: --Create the event that is to be raised
2951: wf_event_t.initialize(event);
3062: system_name := wf_event.local_system_name;
3063: system_status := wf_event.local_system_status;
3064: exception
3065: when others then
3066: wf_core.context('Wf_Event', 'GetLocalSystemName');
3067: end GetLocalSystemInfo;
3068: ---------------------------------------------------------------------------
3069: /*
3070: ** GetSourceAgentGUID -
3091: agent_guid := null;
3092: end if;
3093: exception
3094: when others then
3095: wf_core.context('Wf_Event', 'GetSourceAgentGUID', agent_name);
3096: raise;
3097: end GetSourceAgentGUID;
3098: ---------------------------------------------------------------------------
3099: /*
3231: --Enable the deferred and error queues for
3232: --enqueue and dequeue incase they are disabled
3233: --In any cases, the WF_DEFERRED, WF_ERROR, WF_JAVA_ERROR and WF_JAVA_DEFERRED
3234: --must be started.
3235: --schema := wf_core.translate('WF_SCHEMA');
3236: --Bug 3659756, no longer start fixed name queues.
3237: /*
3238: for q_name in q_disabled (wf_event.schema_name) loop
3239: DBMS_AQADM.START_QUEUE(wf_event.schema_name||'.'||q_name.name);
3271: 'Starting Agents');
3272: end if;
3273: exception
3274: when no_data_found then
3275: wf_core.context('Wf_Event', 'StartAgent', agent_name);
3276: wf_core.raise('WFE_AGENT_NOTEXIST');
3277: when others then
3278: wf_core.context('Wf_Event', 'StartAgent', agent_name);
3279: raise;
3272: end if;
3273: exception
3274: when no_data_found then
3275: wf_core.context('Wf_Event', 'StartAgent', agent_name);
3276: wf_core.raise('WFE_AGENT_NOTEXIST');
3277: when others then
3278: wf_core.context('Wf_Event', 'StartAgent', agent_name);
3279: raise;
3280: end StartAgent;
3274: when no_data_found then
3275: wf_core.context('Wf_Event', 'StartAgent', agent_name);
3276: wf_core.raise('WFE_AGENT_NOTEXIST');
3277: when others then
3278: wf_core.context('Wf_Event', 'StartAgent', agent_name);
3279: raise;
3280: end StartAgent;
3281: ---------------------------------------------------------------------------
3282: /*
3355: begin
3356: l_parameters := p_parameters;
3357:
3358: if (l_parameters is not null) then
3359: l_parameters := replace(l_parameters, wf_core.newline,' ');
3360: l_parameters := replace(l_parameters, wf_core.tab,' ');
3361: l_parameters := replace(l_parameters, wf_core.cr,'');
3362: l_parameters := l_parameters||' ';
3363:
3356: l_parameters := p_parameters;
3357:
3358: if (l_parameters is not null) then
3359: l_parameters := replace(l_parameters, wf_core.newline,' ');
3360: l_parameters := replace(l_parameters, wf_core.tab,' ');
3361: l_parameters := replace(l_parameters, wf_core.cr,'');
3362: l_parameters := l_parameters||' ';
3363:
3364: l_start:= 1;
3357:
3358: if (l_parameters is not null) then
3359: l_parameters := replace(l_parameters, wf_core.newline,' ');
3360: l_parameters := replace(l_parameters, wf_core.tab,' ');
3361: l_parameters := replace(l_parameters, wf_core.cr,'');
3362: l_parameters := l_parameters||' ';
3363:
3364: l_start:= 1;
3365: l_end := length(l_parameters);
3378: end if;
3379: return l_param_list;
3380: exception
3381: when others then
3382: wf_core.Context('WF_EVENT', 'GetParamListFromString');
3383: raise;
3384: end GetParamListFromString;
3385:
3386: ---------------------------------------------------------------------------
3387: /*
3388: ** SetSystemGlobals - Populates System Global Variables
3389: */
3390: begin
3391: wf_event.local_system_guid := hextoraw(wf_core.translate('WF_SYSTEM_GUID'));
3392:
3393: wf_event.local_system_status := wf_core.translate('WF_SYSTEM_STATUS');
3394:
3395: select name into wf_event.local_system_name
3389: */
3390: begin
3391: wf_event.local_system_guid := hextoraw(wf_core.translate('WF_SYSTEM_GUID'));
3392:
3393: wf_event.local_system_status := wf_core.translate('WF_SYSTEM_STATUS');
3394:
3395: select name into wf_event.local_system_name
3396: from wf_systems
3397: where guid = wf_event.local_system_guid;
3395: select name into wf_event.local_system_name
3396: from wf_systems
3397: where guid = wf_event.local_system_guid;
3398: ---------------------------------------------------------------------------
3399: wf_event.schema_name := wf_core.translate('WF_SCHEMA');
3400:
3401: wf_event.pv_last_agent_name := ' ';
3402: wf_event.pv_last_queue_name := ' ';
3403: wf_event.pv_last_schema_name := ' ';