Skip to content
PlektonLabs

Navid Newage · 11 February 2020 · 2 min read

How event object changes when calls are made to external resources

plektonlabs-ejb-connection-mule3

This short tutorial discusses how the objects in a Mule event change when an external source is called through the flow. A Mule event consists of Mule message, attributes, payload and variables. The tutorial is explained with parent and child flow respectively.

Fig 1: Mule flow calling an external resource like a webservice. The request component is call to external service.

Lets say that HelloFlow is the parentFlow which calls the childFlow goodbyeFlow. Will call the objects in parentFlow as A_P ( Attributes of parentFlow), P_P (payload of parentFlow) and V_P (variable of parentFlow) (see Fig 2). In case of childFlow objects are A_C ( Attributes of childFlow), P_C (payload of childFlow) and V_C (variable of childFlow) (see Fig 3) . The two queryParams passed to the parentFlow are fname and lname respectively.

Fig 2: Attributes in parentFlow shown in debug mode.

Comparing Fig 2 and Fig 3 it is evident that attributes A_P gets replaced with attributes A_C. The two queryParams in parentFlow is modified with no queryParam in the childFlow. Similarly, the payload P_P is modified to P_C. However, if a response header from parentFlow then it gets added to the response header. In Fig 1 the variable in the childflow firstname refers to object which is attributes of parentFlow. Since the A_P are not transferred to child object so the var.firstName is Null.

Fig 3: Attributes in childFlow shown in debug mode.

If a variable V_P is defined in the parentFlow then it remains available even after response from the request is made. But V_C in the childFlow is not available only payload is available to the parentFlow.

Have Questions or a Different Take?

PlektonLabs

Reach out to our team. We're always open to sharing benchmarks or bouncing ideas around.