BEvent_客制化BusinessEvent通过Workflow Event接受消息传递(案例)

2014-08-03 Created By BaoXinjian

一、摘要

 

CREATE TABLE BXJ_BES_EVENTS_T

(

  DEMO_ID                 NUMBER,

  MESSAGE_NAME            VARCHAR2(100),

  MESSAGE_KEY             VARCHAR2(100),

  MESSAGE_CONTENTS        CLOB,

  PARAMETER_VALUE1        VARCHAR2(4000),

  PARAMETER_VALUE2        VARCHAR2(4000),

  EVENT_DATE              DATE  

);



CREATE SEQUENCE BXJ_BES_EVENTS_S;

 

 

CREATE OR REPLACE PACKAGE bxj_bes_events_pkg

AS

   --2013 Created By BaoXinjian

   FUNCTION process_an_event (p_sub_guid   IN            RAW,

                              p_event      IN OUT NOCOPY wf_event_t)

      RETURN VARCHAR2;

END;



CREATE OR REPLACE PACKAGE BODY bxj_bes_events_pkg

AS

   FUNCTION process_an_event (p_sub_guid   IN            RAW,

                              p_event      IN OUT NOCOPY wf_event_t)

      RETURN VARCHAR2

   IS

      l_demo_rec   bxj_bes_events_t%ROWTYPE;

   BEGIN

      SELECT   bxj_bes_events_s.NEXTVAL INTO l_demo_rec.demo_id FROM DUAL;



      --get evevent itself

      l_demo_rec.message_name := p_event.geteventname;

      l_demo_rec.event_date := p_event.getsenddate;



      --we can use this key to transfer message only

      l_demo_rec.message_key := p_event.geteventkey;



      --optional, get xml data

      l_demo_rec.message_contents := p_event.geteventdata;



      --optional, get parameter

      l_demo_rec.parameter_value1 :=

         p_event.getvalueforparameter ('PARAMETER1');

      l_demo_rec.parameter_value2 :=

         p_event.getvalueforparameter ('PARAMETER2');



      --do anything here

      INSERT INTO bxj_bes_events_t cbd

        VALUES   l_demo_rec;



      RETURN 'SUCCESS';

   EXCEPTION

      WHEN OTHERS

      THEN

         RETURN 'ERROR';

   END;

END;

 

 

二、创建Business Event

 

 

 

 

 

 

 

 三、创建Workflow接受Event

 

 

 

 四、测试

 

 

Thanks and Regards

你可能感兴趣的:(workflow)