I am pretty new to mule and am working on a dynamic routing using mule. At run time I am getting the port number where my service is hosted.
Please find my code below:
<script:component doc:name="Script">
<script:script engine="groovy">
<![CDATA[
String endpnt = reqUrl.prepareFile(requestUrl);
message.setProperty('port', reqUrl.getPort(),org.mule.api.transport.PropertyScope.INVOCATION);
]]>
</script:script>
</script:component>
<logger message="#[flowVars['port']]" level="INFO" doc:name="port" />
<http:request config-ref="FlowRef"
path="/subflow" method="GET" doc:name="Invoke Dynamic service" />
The above script returns me the port number on which the service is hosted and am invoking the same using
<flow name="testFlow1">
<http:listener config-ref="BaseRef" path="/subflow"
doc:name="Eval" />
<logger message="calling testFlow1 service" level="INFO" doc:name="Logger" />
<http:request config-ref="ServiceMonProxy1" path="/"
method="GET" doc:name="Credit validation"/>
</flow>
The problem is "#[flowVars['port']]"
is not getting resolved at runtime and mule is throwing me an exception which says improper port
Please assist.