[Home] [Help]
PACKAGE BODY: APPS.M4U_UCC_ADAPTER
Source
1 PACKAGE BODY m4u_ucc_adapter AS
2 /* $Header: m4uinaqb.pls 120.0 2005/05/24 16:19:08 appldev noship $ */
3 l_debug_level NUMBER;
4 G_PKG_NAME CONSTANT VARCHAR2(30) := 'm4u_ucc_adapter';
5 -- Name
6 -- set_aq_correlation
7 -- Purpose
8 -- sets the PROTOCOL_TYPE event attribute in the ECX_EVENT_MESSAGE item attribute
9 -- This is in-turn used to set AQ correlation-id by the queue-handler
10 -- Arguments
11 -- itemtype => WF item type
12 -- itemkey => WF item key
13 -- actid => WF act id
14 -- funcmode => WF func mode
15 -- resultout => result param
16 -- Notes
17 -- none
18 FUNCTION pushtoAQ( clob_payload CLOB) RETURN VARCHAR2
19 IS
20 q_name VARCHAR2(100);
21 q_schema_name VARCHAR2(50);
22 jms_msg SYS.AQ$_JMS_TEXT_MESSAGE;
23 l_event_key VARCHAR2(30) ;
24 msg_id RAW(16);
25 l_msgid RAW(16);
26 l_rownum NUMBER;
27 l_nextval NUMBER;
28 l_event_name VARCHAR2(256);
29 l_event wf_event_t;
30 l_parameter_list WF_PARAMETER_LIST_T;
31 enqueue_options dbms_aq.enqueue_options_t;
32 msg_properties dbms_aq.message_properties_t;
33 x_out_msg_id RAW(16);
34
35 BEGIN
36 q_schema_name := 'APPLSYS'; -- code workaround, for GSCC error, needs to be resolved subsequently.
37 q_name := 'WF_JMS_IN';
38 --q_name := 'WF_JAVA_DEFERRED';
39 l_event_name := 'oracle.apps.m4u.inbound.ALL';
40
41 IF (l_Debug_Level <= 2) THEN
42 cln_debug_pub.Add('=========== Entering m4u_ucc_adapter.pushtoAQ =========== ',2);
43 END IF;
44
45 SELECT SYS_GUID()
46 INTO msg_id
47 FROM DUAL;
48
49 SELECT M4U_WLQID_S.nextval
50 INTO l_nextval
51 FROM DUAL;
52
53 IF (l_Debug_Level <= 1) THEN
54 cln_debug_pub.Add('Payload clob created',1);
55 END IF;
56
57 l_parameter_list :=
58 WF_PARAMETER_LIST_T(
59 WF_PARAMETER_T('ECX_PARAMETER1', 0 ),
60 WF_PARAMETER_T('ECX_PARAMETER2', 'M4U' ),
61 WF_PARAMETER_T('ECX_TRANSACTION_TYPE', 'M4U' ),
62 WF_PARAMETER_T('ECX_TRANSACTION_SUBTYPE', 'GENERIC' ),
63 WF_PARAMETER_T('ECX_PARTY_SITE_ID', 'UCCNET_HUB' ),
64 WF_PARAMETER_T('ECX_DOCUMENT_ID', l_nextval ),
65 WF_PARAMETER_T('ECX_MSGID', msg_id ),
66 WF_PARAMETER_T('ECX_MESSAGE_STANDARD', 'UCCNET' )
67 );
68
69 IF (l_Debug_Level <= 1) THEN
70 cln_debug_pub.Add('Event created with the following paramters' ,1);
71 cln_debug_pub.Add('ECX_PARAMETER1 - 0' ,1);
72 cln_debug_pub.Add('ECX_PARAMETER2 - M4U' ,1);
73 cln_debug_pub.Add('ECX_TRANSACTION_TYPE - M4U' ,1);
74 cln_debug_pub.Add('ECX_TRANSACTION_SUBTYPE - GENERIC' ,1);
75 cln_debug_pub.Add('ECX_PARTY_SITE_ID - UCCNET_HUB' ,1);
76 cln_debug_pub.Add('ECX_DOCUMENT_ID - ' || l_nextval,1);
77 cln_debug_pub.Add('ECX_MSGID - ' || msg_id ,1);
78 cln_debug_pub.Add('ECX_MESSAGE_STANDARD - UCCNET' ,1);
79 END IF;
80
81
82
83 wf_event_t.initialize(l_event);
84 l_event.seteventname(l_event_name);
85 l_event.seteventkey(l_nextval);
86 l_event.seteventdata(clob_payload);
87 l_event.setParameterList(l_parameter_list);
88
89 wf_event_ojmstext_qh.SERIALIZE(l_event,jms_msg);
90
91 IF (l_Debug_Level <= 1) THEN
92 cln_debug_pub.Add('Event to be enqueued initialized',2);
93 END IF;
94
95 dbms_aq.enqueue(
96 queue_name => q_schema_name || '.' || q_name,
97 enqueue_options => enqueue_options,
98 message_properties => msg_properties,
99 payload => jms_msg,
100 msgid => x_out_msg_id
101 );
102
103 IF (l_Debug_Level <= 1) THEN
104 cln_debug_pub.Add('dbms_aq.enqueue msgid returned - ' || x_out_msg_id,2);
105 END IF;
106
107
108 IF (l_Debug_Level <= 2) THEN
109 cln_debug_pub.Add('=========== Exiting m4u_ucc_adapter.pushtoAQ normal - Success =========== ',2);
110 END IF;
111
112 RETURN 'SUCCESS';
113 EXCEPTION
114 WHEN OTHERS THEN
115 IF (l_Debug_Level <= 5) THEN
116 cln_debug_pub.Add('Error : ' || SQLCODE || ':' || SQLERRM, 5);
117 END IF;
118 IF (l_Debug_Level <= 2) THEN
119 cln_debug_pub.Add('=========== Exiting m4u_ucc_adapter.pushtoAQ - on Exception =========== ',2);
120 END IF;
121
122 RETURN 'F:'||SQLERRM;
123 END;
124 BEGIN
125 l_debug_level := to_number(nvl(fnd_profile.value('CLN_DEBUG_LEVEL'), '5'));
126 END m4u_ucc_adapter;