Oracle EBuziness Event Notes

Submitted by code_admin on Mon, 07/23/2018 - 15:04

To raise an event

  1. declare
  2.   l_AutoRunFinishedEvent Varchar2(1024) := 'ic.oracle.apps.ar.batch.AutoInvoice.run';
  3.     ln_num_request_id           NUMBER := 42057299;
  4.   lt_parameter_list            wf_parameter_list_t;  
  5. begin
  6.             wf_event.addparametertolist('REQUEST_ID',ln_num_request_id,lt_parameter_list );
  7.             wf_event.addparametertolist('CORRELATION_ID','TEST006',lt_parameter_list );
  8.             wf_event.addparametertolist('AIREQUEST_ID',ln_num_request_id,lt_parameter_list );
  9.             wf_event.addparametertolist('BATCHFAIL',0,lt_parameter_list );
  10.             wf_event.addparametertolist('BATCHFAILMSG','',lt_parameter_list );
  11.  
  12.  
  13.             wf_event.RAISE(
  14.               p_event_name => l_AutoRunFinishedEvent
  15.                           ,p_event_key  =>  ln_num_request_id
  16.                           ,p_parameters =>  lt_parameter_list
  17.                          );
  18.              
  19.      commit;
  20. end;

To see if an event has been raised:

  1. select *
  2. from wf_deferred
  3. where corrid like '%AutoInvoice%'; --below 50
  4.  
  5.  
  6. select *
  7. from wf_bpel_qtab
  8. order by enq_time desc --Above 50

Code to create and subsubscribe to an event

  1. Rem +=======================================================================+
  2. Rem | FILENAME                                                              |
  3. Rem |      icarcreate_ICIS_event.sql                                        |
  4. Rem |                                                                       |
  5. Rem | DESCRIPTION                                                           |
  6. Rem |      Creates event for ICIS                                           |
  7. Rem |                                                                       |
  8. Rem | HISTORY                                                               |
  9. Rem |   18-May-2011  Robert Metcalf         Create                          |
  10. Rem +=======================================================================+
  11. DECLARE
  12.   ln_subscription_present    NUMBER := 0;
  13.   ln_event_present           NUMBER := 0;
  14.   lc_agent_guid              VARCHAR2(32);
  15.   lc_creation_msg            VARCHAR2(4000);
  16.   ln_phase_val               NUMBER := 0;
  17.   lc_event_guid              VARCHAR2(4000);
  18. BEGIN
  19.   SELECT count(*) into ln_event_present FROM wf_events WHERE name = 'xxic.oracle.apps.ar.batch.AutoInvoice.run';
  20.   IF(ln_event_present <> 1 )
  21.   THEN
  22.     lc_creation_msg := '<WF_TABLE_DATA>
  23.                           <WF_EVENTS>
  24.                             <VERSION>1.0</VERSION>
  25.                             <GUID>#NEW</GUID>
  26.                             <NAME>xxic.oracle.apps.ar.batch.AutoInvoice.run</NAME>
  27.                             <TYPE>EVENT</TYPE>
  28.                             <STATUS>ENABLED</STATUS>
  29.                             <GENERATE_FUNCTION/>
  30.                             <OWNER_NAME>Imperial College Receivables</OWNER_NAME>
  31.                             <OWNER_TAG>ICAR</OWNER_TAG>
  32.                             <CUSTOMIZATION_LEVEL>U</CUSTOMIZATION_LEVEL>
  33.                             <LICENSED_FLAG>Y</LICENSED_FLAG>
  34.                             <JAVA_GENERATE_FUNC/>
  35.                             <DISPLAY_NAME>xxic.oracle.apps.ar.batch.AutoInvoice.run</DISPLAY_NAME>
  36.                             <DESCRIPTION>Business event to transfer AR invoice interface information</DESCRIPTION>
  37.                           </WF_EVENTS>
  38.                         </WF_TABLE_DATA>';
  39.     wf_events_pkg.Receive(lc_creation_msg);
  40.   END IF;
  41.   SELECT guid into lc_agent_guid FROM wf_agents WHERE name = 'WF_BPEL_QAGENT';
  42.   SELECT guid into lc_event_guid FROM wf_events WHERE name ='xxic.oracle.apps.ar.batch.AutoInvoice.run';
  43.   SELECT count(*) into ln_subscription_present FROM wf_event_subscriptions WHERE event_filter_guid = lc_event_guid and out_agent_guid = lc_agent_guid ;
  44.   IF ( ln_subscription_present <> 1 )
  45.   THEN
  46.     SELECT max(phase) into ln_phase_val FROM wf_event_subscriptions WHERE event_filter_guid = lc_event_guid;
  47.     ln_phase_val := ln_phase_val*2 + 201;
  48.     lc_creation_msg := '<WF_TABLE_DATA>
  49.                           <WF_EVENT_SUBSCRIPTIONS>
  50.                             <VERSION>1.0</VERSION>
  51.                             <GUID>#NEW</GUID>
  52.                             <SYSTEM_GUID>#LOCAL</SYSTEM_GUID>
  53.                             <SOURCE_TYPE>LOCAL</SOURCE_TYPE>
  54.                             <SOURCE_AGENT_GUID/>
  55.                             <EVENT_FILTER_GUID>'||lc_event_guid||'</EVENT_FILTER_GUID>
  56.                             <PHASE>'||ln_phase_val||'</PHASE>
  57.                             <STATUS>ENABLED</STATUS>
  58.                             <RULE_DATA>KEY</RULE_DATA>
  59.                             <OUT_AGENT_GUID>'||lc_agent_guid||'</OUT_AGENT_GUID>
  60.                             <TO_AGENT_GUID/>
  61.                             <PRIORITY>50</PRIORITY>
  62.                             <RULE_FUNCTION/>
  63.                             <WF_PROCESS_TYPE/>
  64.                             <WF_PROCESS_NAME/>
  65.                             <PARAMETERS/>
  66.                             <OWNER_NAME>Imperial College Receivables</OWNER_NAME>
  67.                             <OWNER_TAG>ICAR</OWNER_TAG>
  68.                             <CUSTOMIZATION_LEVEL>U</CUSTOMIZATION_LEVEL>
  69.                             <LICENSED_FLAG>Y</LICENSED_FLAG>
  70.                             <DESCRIPTION>Subscription for enqueuing event in WF_BPEL_Q</DESCRIPTION>
  71.                             <EXPRESSION/>
  72.                           </WF_EVENT_SUBSCRIPTIONS>
  73.                         </WF_TABLE_DATA>';
  74.     wf_event_subscriptions_pkg.receive(lc_creation_msg);
  75.   END IF;
  76.   commit;
  77. EXCEPTION
  78.   WHEN OTHERS THEN
  79.     ROLLBACK;  
  80. END;
  81. /

WF_DEFFERED

  1. select
  2.   q.retry_count as cretry_count,
  3.   q.*
  4. from
  5.   applsys.aq$WF_DEFERRED q
  6. where 1=1
  7. --and msg_state not in ('PROCESSED','UNDELIVERABLE')
  8. order by
  9.   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