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.

Share This Post

More To Explore

How can we help?

A little about yourself and we're ready to go

We pride ourselves on swift communication and prompt responses. Let us know what you're thinking and how we can help you.

Contact Information​

Head Office
18 King Street E, Suite 1400, Toronto ON M5C 1C4, Canada

Durham Office
Unit 265, 1099 Kingston Rd. Pickering, ON. L1V1B5, Canada

Austin Office
5900 Balcones Dr, STE 4000 Austin, TX 78731, USA

Dallas Office
Suite 1103, 2370 Victory Avenue, Dallas, TX 75219, USA

Phone: +1(877) 855-8775
Email: info@plektonlabs.com

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.