jdbcmulemule-el

MULE_JDBC_UDATE_COUNT is returning Null value even after deleting data from Database


I have a Mule flow in which I have a Database delete operation :-

<jdbc-ee:connector name="Database_Global" dataSource-ref="DB_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database">
    <jdbc-ee:query key="DeleteQuery" value="delete from getData where ID=10"/>
    </jdbc-ee:connector>

<flow name="DeleteFlow" doc:name="restFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" doc:name="HTTP"/>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="DeleteQuery" queryTimeout="-1" connector-ref="Database_Global" doc:name="Database (JDBC)"/>
<logger message="Deleted #[flowVars['MULE_JDBC_UDATE_COUNT']] rows" level="INFO" doc:name="Logger"/>
<set-payload value="Deleted #[flowVars['MULE_JDBC_UDATE_COUNT']] rows" doc:name="Set Payload"/>
</flow>

Now the issue is flowVars['MULE_JDBC_UDATE_COUNT'] is returning null even the row exists and is deleted from Database ... I am using Mule 3.5 anypoint studio with JDBC ee connector .. One more issue I like to address ... I need something like :-

<choice doc:name="Choice">
 <when expression="#[flowVars['MULE_JDBC_UDATE_COUNT']==null] ">
<logger message="Deleted #[flowVars['MULE_JDBC_UDATE_COUNT']] rows... Failed!!!" level="INFO" doc:name="Logger"/>
<set-payload value="Deleted #[flowVars['MULE_JDBC_UDATE_COUNT']] rows ...Failed!!!" doc:name="Set Payload"/>
 </when>
<otherwise>
<set-payload value="Deleted Successfully !!!" doc:name="Set Payload"/>
 </otherwise>
</choice> 

just after the jdbc-ee:outbound-endpoint where I can display success message if row is deleted and failure message if not ... But I am getting error like :-

Root Exception stack trace:

[Error: unresolvable property or identifier: ]]
[Near : {... flowVars['MULE_JDBC_UDATE_COUNT']==null] ....}]

How can I achieve it ... Please help


Solution

  • You have a typo: it's MULE_JDBC_UPDATE_COUNT not MULE_JDBC_UDATE_COUNT.