| Previous | Next |  | Contents | Index | Glossary

## Event Message Structure

Oracle Workflow uses the object type WF_EVENT_T to store event messages. This datatype contains all the header properties of an event message as well as the event data payload, in a serialized form that is suitable for transmission outside the system.

WF_EVENT_T defines the event message structure that the Business Event System and the Workflow Engine use to represent a business event. Internally, the Business Event System and the Workflow Engine can only communicate events in this format.

The standard queues that Oracle Workflow provides for the Business Event System, called WF_IN, WF_OUT, and WF_ERROR, all use WF_EVENT_T as their payload type. If you want to use queues with an alternate payload type, including any existing queues you already have defined on your system, you must create a queue handler to translate between the standard Workflow WF_EVENT_T structure and your custom payload type. See: Setting Up Queues and Standard APIs for a Queue Handler.

WF_EVENT_T includes the following attributes:

WF_EVENT_T

Attribute Name | Datatype | Description
--- | --- | ---
PRIORITY | NUMBER | The priority with which the message recipient should dequeue the message. A smaller number indicates a higher priority. For example, 1 represents a high priority, 50 represents a normal priority, and 99 represents a low priority.
SEND_DATE | DATE | The date and time when the message is sent. This attribute is reserved for future use.
RECEIVE_DATE | DATE | The date and time when the message is dequeued. This attribute is reserved for future use.
CORRELATION_ID | VARCHAR2(240) | A correlation identifier that associates this message with other messages. This attribute is initially blank but can be set by a function. If a value is set for the correlation ID, then that value is used as the item key if the event is sent to a workflow process.
PARAMETER_LIST | WF_PARAMETER_ LIST_T | A list of additional parameter name and value pairs.
EVENT_NAME | VARCHAR2(240) | The internal name of the event.
EVENT_KEY | VARCHAR2(240) | The string that uniquely identifies the instance of the event.
EVENT_DATA | CLOB | A set of additional details describing what occurred in the event. The event data can be structured as an XML document.
FROM_AGENT | WF_AGENT_T | The agent from which the event is sent. For locally raised events, this attribute is initially null.
TO_AGENT | WF_AGENT_T | The agent to which the event should be sent (the message recipient).
ERROR_ SUBSCRIPTION | RAW(16) | If an error occurs while processing this event, this is the subscription that was being executed when the error was encountered.
ERROR_MESSAGE | VARCHAR2(4000) | An error message that the Event Manager generates if an error occurs while processing this event.
ERROR_STACK | VARCHAR2(4000) | An error stack of arguments that the Event Manager generates if an error occurs while processing this event. The error stack provides context information to help you locate the source of an error.

The WF_EVENT_T object type also includes the following methods, which you can use to retrieve and set the values of its attributes.

- Initialize

- getPriority

- getSendDate

- getReceiveDate

- getCorrelationID

- getParameterList

- getEventName

- getEventKey

- getEventData

- getFromAgent

- getToAgent

- getErrorSubscription

- getErrorMessage

- getErrorStack

- setPriority

- setSendDate

- setReceiveDate

- setCorrelationID

- setParameterList

- setEventName

- setEventKey

- setEventData

- setFromAgent

- setToAgent

- setErrorSubscription

- setErrorMessage

- setErrorStack

- Content

- Address

- AddParameterToList

- GetValueForParameter

> Note: You can set the values of the EVENT_NAME, EVENT_KEY, and EVENT_DATA attributes individually using the setEventName, setEventKey, and setEventData methods, or you can use the Content method to set all three event content attributes at once. See: Content.

> Similarly, you can set the values of the FROM_AGENT, TO_AGENT, PRIORITY, and SEND__DATE attributes individually using the setFromAgent, setToAgent, setPriority, and setSendDate methods, or you can use the Address method to set all four address attributes at once. See: Address.

### See Also

Example for Using Abstract Datatypes

Mapping Between WF_EVENT_T and OMBAQ_TEXT_MSG

## Initialize

PL/SQL Syntax

`STATIC PROCEDURE initialize`

         (new_wf_event_t in out wf_event_t)

Description

Initializes a new WF_EVENT_T object by setting the PRIORITY attribute to 0, initializing the EVENT_DATA attribute to EMPTY using the Empty_CLOB() function, and setting all other attributes to NULL.

> Attention: You must call the Initialize method before you can perform any further manipulation on a new WF_EVENT_T object.

Arguments (input) | new_wf_event_tThe WF_EVENT_T object to initialize.

## getPriority

PL/SQL Syntax

`MEMBER FUNCTION getPriority`

         return number

Description

Returns the value of the PRIORITY attribute in a WF_EVENT_T object.

## getSendDate

PL/SQL Syntax

`MEMBER FUNCTION getSendDate`

         return date

Description

Returns the value of the SEND_DATE attribute in a WF_EVENT_T object.

## getReceiveDate

PL/SQL Syntax

`MEMBER FUNCTION getReceiveDate`

         return date

Description

Returns the value of the RECEIVE_DATE attribute in a WF_EVENT_T object.

## getCorrelationID

PL/SQL Syntax

`MEMBER FUNCTION getCorrelationID`

         return varchar2

Description

Returns the value of the CORRELATION_ID attribute in a WF_EVENT_T object.

## getParameterList

PL/SQL Syntax

`MEMBER FUNCTION getParameterList`

         return wf_parameter_list_t

Description

Returns the value of the PARAMETER_LIST attribute in a WF_EVENT_T object.

## getEventName

PL/SQL Syntax

`MEMBER FUNCTION getEventName`

         return varchar2

Description

Returns the value of the EVENT_NAME attribute in a WF_EVENT_T object.

## getEventKey

PL/SQL Syntax

`MEMBER FUNCTION getEventKey`

         return varchar2

Description

Returns the value of the EVENT_KEY attribute in a WF_EVENT_T object.

## getEventData

PL/SQL Syntax

`MEMBER FUNCTION getEventData`

         return clob

Description

Returns the value of the EVENT_DATA attribute in a WF_EVENT_T object.

## getFromAgent

PL/SQL Syntax

`MEMBER FUNCTION getFromAgent`

         return wf_agent_t

Description

Returns the value of the FROM_AGENT attribute in a WF_EVENT_T object.

## getToAgent

PL/SQL Syntax

`MEMBER FUNCTION getToAgent`

         return wf_agent_t

Description

Returns the value of the TO_AGENT attribute in a WF_EVENT_T object.

## getErrorSubscription

PL/SQL Syntax

`MEMBER FUNCTION getErrorSubscription`

         return raw

Description

Returns the value of the ERROR_SUBSCRIPTION attribute in a WF_EVENT_T object.

## getErrorMessage

PL/SQL Syntax

`MEMBER FUNCTION getErrorMessage`

         return varchar2

Description

Returns the value of the ERROR_MESSAGE attribute in a WF_EVENT_T object.

## getErrorStack

PL/SQL Syntax

`MEMBER FUNCTION getErrorStack`

         return varchar2

Description

Returns the value of the ERROR_STACK attribute in a WF_EVENT_T object.

## setPriority

PL/SQL Syntax

`MEMBER PROCEDURE setPriority`

         (pPriority in number)

Description

Sets the value of the PRIORITY attribute in a WF_EVENT_T object.

Arguments (input) | pPriorityThe value for the PRIORITY attribute.

## setSendDate

PL/SQL Syntax

`MEMBER PROCEDURE setSendDate`

         (pSendDate in date default sysdate)

Description

Sets the value of the SEND_DATE attribute in a WF_EVENT_T object.

Arguments (input) | pSendDateThe value for the SEND_DATE attribute.

## setReceiveDate

PL/SQL Syntax

`MEMBER PROCEDURE setReceiveDate`

         (pReceiveDate in date default sysdate)

Description

Sets the value of the RECEIVE_DATE attribute in a WF_EVENT_T object.

Arguments (input) | pReceiveDateThe value for the RECEIVE_DATE attribute.

## setCorrelationID

PL/SQL Syntax

`MEMBER PROCEDURE setCorrelationID`

         (pCorrelationID in varchar2)

Description

Sets the value of the CORRELATION_ID attribute in a WF_EVENT_T object.

Arguments (input) | pCorrelationIDThe value for the CORRELATION_ID attribute.

## setParameterList

PL/SQL Syntax

`MEMBER PROCEDURE setParameterList`

         (pParameterList in wf_parameter_list_t)

Description

Sets the value of the PARAMETER_LIST attribute in a WF_EVENT_T object.

Arguments (input) | pParameterListThe value for the PARAMETER_LIST attribute.

## setEventName

PL/SQL Syntax

`MEMBER PROCEDURE setEventName`

         (pEventName in varchar2)

Description

Sets the value of the EVENT_NAME attribute in a WF_EVENT_T object.

Arguments (input) | pEventNameThe value for the EVENT_NAME attribute.

## setEventKey

PL/SQL Syntax

`MEMBER PROCEDURE setEventKey`

         (pEventKey in varchar2)

Description

Sets the value of the EVENT_KEY attribute in a WF_EVENT_T object.

Arguments (input) | pEventKeyThe value for the EVENT_KEY attribute.

## setEventData

PL/SQL Syntax

`MEMBER PROCEDURE setEventData`

         (pEventData in clob)

Description

Sets the value of the EVENT_DATA attribute in a WF_EVENT_T object.

Arguments (input) | pEventDataThe value for the EVENT_DATA attribute.

## setFromAgent

PL/SQL Syntax

`MEMBER PROCEDURE setFromAgent`

         (pFromAgent in wf_agent_t)

Description

Sets the value of the FROM_AGENT attribute in a WF_EVENT_T object.

Arguments (input) | pFromAgentThe value for the FROM_AGENT attribute.

## setToAgent

PL/SQL Syntax

`MEMBER PROCEDURE setToAgent`

         (pToAgent in wf_agent_t)

Description

Sets the value of the TO_AGENT attribute in a WF_EVENT_T object.

Arguments (input) | pToAgentThe value for the TO_AGENT attribute.

## setErrorSubscription

PL/SQL Syntax

`MEMBER PROCEDURE setErrorSubscription`

         (pErrorSubscription in raw)

Description

Sets the value of the ERROR_SUBSCRIPTION attribute in a WF_EVENT_T object.

Arguments (input) | pErrorSubscrip tionThe value for the ERROR_SUBSCRIPTION attribute.

## setErrorMessage

PL/SQL Syntax

`MEMBER PROCEDURE setErrorMessage`

         (pErrorMessage in varchar2)

Description

Sets the value of the ERROR_MESSAGE attribute in a WF_EVENT_T object.

Arguments (input) | pErrorMessageThe value for the ERROR_MESSAGE attribute.

## setErrorStack

PL/SQL Syntax

`MEMBER PROCEDURE setErrorStack`

         (pErrorStack in varchar2)

Description

Sets the value of the ERROR_STACK attribute in a WF_EVENT_T object.

Arguments (input) | pErrorStackThe value for the ERROR_STACK attribute.

## Content

PL/SQL Syntax

`MEMBER PROCEDURE Content`

         (pName in varchar2,

          pKey in varchar2,

          pData in clob)

Description

Sets the values of all the event content attributes in a WF_EVENT_T object, including EVENT_NAME, EVENT_KEY, and EVENT_DATA.

Arguments (input) | pNameThe value for the EVENT_NAME attribute.
pKey | The value for the EVENT_KEY attribute.
pData | The value for the EVENT_DATA attribute.

## Address

PL/SQL Syntax

`MEMBER PROCEDURE Address`

         (pOutAgent in wf_agent_t,

          pToAgent in wf_agent_t,

          pPriority in number,

          pSendDate in date)

Description

Sets the values of the all address attributes in a WF_EVENT_T object, including FROM_AGENT, TO_AGENT, PRIORITY, and SEND_DATE.

Arguments (input) | pOutAgentThe value for the FROM_AGENT attribute.
pToAgent | The value for the TO_AGENT attribute.
pPriority | The value for the PRIORITY attribute.
pSendDate | The value for the SEND_DATE attribute.

## AddParameterToList

PL/SQL Syntax

`MEMBER PROCEDURE AddParameterToList`

         (pName in varchar2,

          pValue in varchar2)

Description

Adds a new parameter name and value pair to the list stored in the PARAMETER_LIST attribute of a WF_EVENT_T object. If a parameter with the specified name already exists in the parameter list, then the previous value of that parameter is overwritten with the specified value.

Arguments (input) | pNameThe parameter name.
pValue | The parameter value.

## GetValueForParameter

PL/SQL Syntax

`MEMBER FUNCTION GetValueForParameter`

         (pName in varchar2) return varchar2

Description

Returns the value of the specified parameter from the list stored in the PARAMETER_LIST attribute of a WF_EVENT_T object. If no parameter with the specified name is found in the parameter list, then the GetValueForParameter method returns NULL.

Arguments (input) | pNameThe parameter name.

| Previous | Next |  | Contents | Index | Glossary