CONTEXTINVOCATIONNODE function
The CONTEXTINVOCATIONNODE function in ESQL returns the captured context tree node section for a message flow input node. The most common use case for this function is to access the payload that came into the message flow. You do not need to know the name of the input node.
Syntax
When you use the CONTEXTINVOCATIONNODE function in an IBM® App Connect Enterprise
message flow, the invocation node context tree section is accessed, and a read-only reference to
that node section is returned. You do not need to know the name of the input node or async response
node that invoked the flow, or the level in the message flow where the input node is located. The
CONTEXTINVOCATIONNODE function has the following behavior:
- Its use enables context trees for a message flow that uses it.
- One of the PAYLOAD, PAYLOADDETAILS, HEADERS, and METADATA keywords can be used, as shown in the
following table:
Table 1. Keyword Description PAYLOAD Optional keyword, which allows the CONTEXTINVOCATIONNODE function to return a reference to the specified nodes Payload field. PAYLOADDETAILS Optional keyword that allows CONTEXTINVOCATIONNODE to return a reference to the specified nodes PayloadDetails field (if it exists). HEADERS Optional keyword that allows CONTEXTINVOCATIONNODE to return a reference to the specified nodes Headers field (if it exists). METADATA Optional keyword that allows CONTEXTINVOCATIONNODE to return a reference to the specified nodes Metadata field (if it exists).
When you use the CONTEXTINVOCATIONNODE function with no keywords, the function usually returns a valid reference, as a message flow must have a node that invoked the flow. The only exception is the DatabaseInput node that does not have an input node section at the time the ESQL is being executed.
The CONTEXTINVOCATIONNODE function has the following limitations:
- You cannot make updates through the REFERENCE variable. It is read-only.
- You cannot navigate to a higher level than the parent of the node.
- Only one of PAYLOAD, PAYLOADDETAILS, HEADERS, and METADATA can be specified.
- If the Context Tree field cannot be found, then CONTEXTINVOCATIONNODE
returns a REFERENCE in cases where LASTMOVE evaluates to FALSE (as with other REFERENCE variables).
This result can happen in the following cases:
- The function is used in a DatabaseInput node.
- A PAYLOADDETAILS keyword is specified but there are no payload details for the captured node section. There is always a payload field in the context tree for a node. If there is no message body, then the payload field exists and has a value of null.
- A HEADERS keyword is specified but there are no headers for the captured node section.
- A METADATA keyword is specified but there is no metadata for the captured node section.
- You cannot use the function in EVAL functions or directly in schema-level ESQL routines.
For more information about Context trees, see Context tree.
Examples
DECLARE myCtxRef01 REFERENCE TO CONTEXTINVOCATIONNODE();
DECLARE myCtxRef02 REFERENCE TO CONTEXTINVOCATIONNODE(PAYLOAD);
DECLARE myCtxRef03 REFERENCE TO CONTEXTINVOCATIONNODE(PAYLOADDETAILS);
DECLARE myCtxRef04 REFERENCE TO CONTEXTINVOCATIONNODE(HEADERS);
DECLARE myCtxRef05 REFERENCE TO CONTEXTINVOCATIONNODE(METADATA);
