To raise an event
-
declare
-
l_AutoRunFinishedEvent Varchar2(1024) := 'ic.oracle.apps.ar.batch.AutoInvoice.run';
-
ln_num_request_id NUMBER := 42057299;
-
lt_parameter_list wf_parameter_list_t;
-
begin
-
wf_event.addparametertolist('REQUEST_ID',ln_num_request_id,lt_parameter_list );
-
wf_event.addparametertolist('CORRELATION_ID','TEST006',lt_parameter_list );
-
wf_event.addparametertolist('AIREQUEST_ID',ln_num_request_id,lt_parameter_list );
-
wf_event.addparametertolist('BATCHFAIL',0,lt_parameter_list );
-
wf_event.addparametertolist('BATCHFAILMSG','',lt_parameter_list );
-
-
-
wf_event.RAISE(
-
p_event_name => l_AutoRunFinishedEvent
-
,p_event_key => ln_num_request_id
-
,p_parameters => lt_parameter_list
-
);
-
-
commit;
-
end;
To see if an event has been raised:
-
select *
-
from wf_deferred
-
where corrid like '%AutoInvoice%'; --below 50
-
-
-
select *
-
from wf_bpel_qtab
-
order by enq_time desc --Above 50
Code to create and subsubscribe to an event
-
Rem +=======================================================================+
-
Rem | FILENAME |
-
Rem | icarcreate_ICIS_event.sql |
-
Rem | |
-
Rem | DESCRIPTION |
-
Rem | Creates event for ICIS |
-
Rem | |
-
Rem | HISTORY |
-
Rem | 18-May-2011 Robert Metcalf Create |
-
Rem +=======================================================================+
-
DECLARE
-
ln_subscription_present NUMBER := 0;
-
ln_event_present NUMBER := 0;
-
lc_agent_guid VARCHAR2(32);
-
lc_creation_msg VARCHAR2(4000);
-
ln_phase_val NUMBER := 0;
-
lc_event_guid VARCHAR2(4000);
-
BEGIN
-
SELECT count(*) into ln_event_present FROM wf_events WHERE name = 'xxic.oracle.apps.ar.batch.AutoInvoice.run';
-
IF(ln_event_present <> 1 )
-
THEN
-
lc_creation_msg := '<WF_TABLE_DATA>
-
<WF_EVENTS>
-
<VERSION>1.0</VERSION>
-
<GUID>#NEW</GUID>
-
<NAME>xxic.oracle.apps.ar.batch.AutoInvoice.run</NAME>
-
<TYPE>EVENT</TYPE>
-
<STATUS>ENABLED</STATUS>
-
<GENERATE_FUNCTION/>
-
<OWNER_NAME>Imperial College Receivables</OWNER_NAME>
-
<OWNER_TAG>ICAR</OWNER_TAG>
-
<CUSTOMIZATION_LEVEL>U</CUSTOMIZATION_LEVEL>
-
<LICENSED_FLAG>Y</LICENSED_FLAG>
-
<JAVA_GENERATE_FUNC/>
-
<DISPLAY_NAME>xxic.oracle.apps.ar.batch.AutoInvoice.run</DISPLAY_NAME>
-
<DESCRIPTION>Business event to transfer AR invoice interface information</DESCRIPTION>
-
</WF_EVENTS>
-
</WF_TABLE_DATA>';
-
wf_events_pkg.Receive(lc_creation_msg);
-
END IF;
-
SELECT guid into lc_agent_guid FROM wf_agents WHERE name = 'WF_BPEL_QAGENT';
-
SELECT guid into lc_event_guid FROM wf_events WHERE name ='xxic.oracle.apps.ar.batch.AutoInvoice.run';
-
SELECT count(*) into ln_subscription_present FROM wf_event_subscriptions WHERE event_filter_guid = lc_event_guid and out_agent_guid = lc_agent_guid ;
-
IF ( ln_subscription_present <> 1 )
-
THEN
-
SELECT max(phase) into ln_phase_val FROM wf_event_subscriptions WHERE event_filter_guid = lc_event_guid;
-
ln_phase_val := ln_phase_val*2 + 201;
-
lc_creation_msg := '<WF_TABLE_DATA>
-
<WF_EVENT_SUBSCRIPTIONS>
-
<VERSION>1.0</VERSION>
-
<GUID>#NEW</GUID>
-
<SYSTEM_GUID>#LOCAL</SYSTEM_GUID>
-
<SOURCE_TYPE>LOCAL</SOURCE_TYPE>
-
<SOURCE_AGENT_GUID/>
-
<EVENT_FILTER_GUID>'||lc_event_guid||'</EVENT_FILTER_GUID>
-
<PHASE>'||ln_phase_val||'</PHASE>
-
<STATUS>ENABLED</STATUS>
-
<RULE_DATA>KEY</RULE_DATA>
-
<OUT_AGENT_GUID>'||lc_agent_guid||'</OUT_AGENT_GUID>
-
<TO_AGENT_GUID/>
-
<PRIORITY>50</PRIORITY>
-
<RULE_FUNCTION/>
-
<WF_PROCESS_TYPE/>
-
<WF_PROCESS_NAME/>
-
<PARAMETERS/>
-
<OWNER_NAME>Imperial College Receivables</OWNER_NAME>
-
<OWNER_TAG>ICAR</OWNER_TAG>
-
<CUSTOMIZATION_LEVEL>U</CUSTOMIZATION_LEVEL>
-
<LICENSED_FLAG>Y</LICENSED_FLAG>
-
<DESCRIPTION>Subscription for enqueuing event in WF_BPEL_Q</DESCRIPTION>
-
<EXPRESSION/>
-
</WF_EVENT_SUBSCRIPTIONS>
-
</WF_TABLE_DATA>';
-
wf_event_subscriptions_pkg.receive(lc_creation_msg);
-
END IF;
-
commit;
-
EXCEPTION
-
WHEN OTHERS THEN
-
ROLLBACK;
-
END;
-
/
WF_DEFFERED
-
select
-
q.retry_count as cretry_count,
-
q.*
-
from
-
applsys.aq$WF_DEFERRED q
-
where 1=1
-
--and msg_state not in ('PROCESSED','UNDELIVERABLE')
-
order by
-
q.enq_timestamp desc
Messages in WAIT state in the queue when they shouldn't be.
(SR 3-12624005051)
Stopping and starting the "WF Deferred Agent listener" listner seemed to clear it:
1. Add more debug messages to the WF Deferred Agent listener
Navigation path:
a. Workflow Administrator Web Applications Responsibility
b. Workflow Manager
c. Click on the Agent Listeners icon
RJM Article Type
Work Notes