I build a api using Mule ESB, and when I deployed it on production env (redhat). a bug appeared.
I have a uri parameter "page" http://localhost:8081/api/assets/33/annotations?page=0
.
On api I capture that query parameter into a variable <set-variable variableName="page" value="#[header:INBOUND:page?]" doc:name="page"/>
And after that I try to capture it the flow. But if I capture using #[flowVar.page]
some times its value is null
even if ?page=0
.
Now if I try to capture that same variable 'page' using #[flowVars['page']]
, never it comes null
.
My entire flow is
<flow name="get:/assets/{assetsId}/annotations:api-config" initialState="started">
<set-variable variableName="page" value="#[header:INBOUND:page?]" doc:name="page"/>
<jdbc:outbound-endpoint exchange-pattern="request-response" connector-ref="tool_de_anotacao_JDBC" queryKey="get annotations" queryTimeout="-1" doc:name="Database" mimeType="application/json" disableTransportTransformer="true">
<jdbc:transaction action="ALWAYS_BEGIN"/>
<jdbc:query key="get annotations" value="select content from tool.tasset_annotation
where 1 = 1 and assetId = cast(#[flowVars.assetsId] as text)
and CASE WHEN #[flowVars.containsKey('page')] THEN
page = cast(#[flowVars['page']] as integer ) ELSE
1 = 1 END order by id desc;
"/>
</jdbc:outbound-endpoint>
<object-to-string-transformer doc:name="Object to String"/>
<scripting:component doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[payload = payload.replaceAll("content=","\"content\":");]]></scripting:script>
</scripting:component>
<message-properties-transformer mimeType="application/json" doc:name="Message Properties"/>
</flow>
Is that any bug or am I doing some thing wrong?
I couldn't replay that bug in my windows env,
Thanks a lot for your help.
Regards, Valter Gomes