Content Length Metadata Selector (.^contentLength)
Returns the content length of the value, if the value is present.
In the following Mule app flow, the Logger uses payload.^contentLength to select the length of the string my string, set in the Set Payload (set-payload) component.
Mule App XML in Anypoint Studio:
<flow name=”setpayloadobjectFlow” >
<scheduler doc:name=”Scheduler” >
<scheduling-strategy >
<fixed-frequency frequency=”15″ timeUnit=”SECONDS”/>
</scheduling-strategy>
</scheduler>
<!– Set the payload to “my string”. –>
<set-payload value='”my string”‘ doc:name=”Set Payload” />
<!– Select the class to which “my string” belongs. –>
<logger level=”INFO” doc:name=”Logger” message=”#[payload.^contentLength]”/>
</flow>
The Studio console output shows that the length of the input string (my string) is eleven (9) characters long. The length includes the blank space in the string.
Console Output in Anypoint Studio:
INFO 2019-05-07 16:59:33,690 [[MuleRuntime].cpuLight.07:
[carets].caretsFlow.CPU_LITE @39f1dbde]
[event: 28ce97a0-7124-11e9-acfe-8c8590a99d48]
org.mule.runtime.core.internal.processor.LoggerMessageProcessor:
11
If you like my post please follow me to read my latest post on programming and technology.
Problem Statement: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example…
Given an integer A. Compute and return the square root of A. If A is…
Given a zero-based permutation nums (0-indexed), build an array ans of the same length where…
A heap is a specialized tree-based data structure that satisfies the heap property. It is…
What is the Lowest Common Ancestor? In a tree, the lowest common ancestor (LCA) of…