Mule same Payload is displaying in different format in logger for different condition



I have a mule flow :-



<jdbc-ee:connector name="Database_Global" dataSource-ref="DB_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database">
<jdbc-ee:query key="UpdateQuerySOAPRequest" value="UPDATE getData SET ID=#[xpath('//v1:Id').text], NAME=#[xpath('//v1:Name').text], AGE=#[xpath('//v1:Age').text], DESIGNATION = #[xpath('//v1:Designation').text] where ID=#[xpath('//v1:Id').text]"/>
</jdbc-ee:connector>
<flow name="NodeNameFlow" doc:name="NodeNameFlow" initialState="started">
<file:inbound-endpoint responseTimeout="10000" connector-ref="File_Input" doc:name="File" path="E:\backup\test">
<file:filename-regex-filter pattern="XMLRequest.xml" caseSensitive="false"/>
</file:inbound-endpoint>
<splitter evaluator="xpath" expression="//v1:updateDataRequest" doc:name="Splitter_For_MultipleSameNodes"/>
<mulexml:dom-to-xml-transformer name="DomToXmlSOAPUpdate2" doc:name="Dom To XmlSOAPUpdate"/>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="UpdateQuerySOAPRequest" queryTimeout="-1" connector-ref="Database_Global" doc:name="Database (JDBC)"/>

<choice doc:name="Choice">
<when expression="#[flowVars['MULE_JDBC_UPDATE_COUNT']==0]"> <!-- If not updated -->
<logger message="Updated #[flowVars['MULE_JDBC_UPDATE_COUNT']] rows... Failed!!! No rows were Updated" level="INFO" doc:name="Logger"/>
</when>
<otherwise> <!-- if updated -->
<set-payload value="Updated Successfully !!!" doc:name="Set Payload"/>
</otherwise>
</choice>

<mulexml:object-to-xml-transformer doc:name="Object to XML"></mulexml:object-to-xml-transformer>
<async doc:name="Async_Database_Response_in_File">
<logger message="Request *************************** #[payload:java.lang.String] *************************" level="INFO" doc:name="Logger"/>

<file:outbound-endpoint path="E:\backup\test" outputPattern="SimpleResponse.txt" responseTimeout="10000" doc:name="File" connector-ref="File_Global"/>
</async>

</flow>


Now you can see It is taking an xml file as input, splitting it and updating the database based on ID and at the end it is logging the payload in an outbound file .. .. if It is able to update the data base successfully it is able to display the payload in the logger <logger message="Request *************************** #[payload:java.lang.String] *************************" level="INFO" doc:name="Logger"/> at the end in correct way like:-



org.mule.api.processor.LoggerMessageProcessor: Request ***************************<string> <soapenv:Envelope xmlns:soapenv="http://ift.tt/sVJIaE" xmlns:v1="http://ift.tt/1kFt6Sx">
<soapenv:Header/>
<soapenv:Body>
<v1:updateDataRequest>
<v1:Id>1</v1:Id>
<v1:Name>BnnnnnnBB !!!!!</v1:Name>
<v1:Age>66</v1:Age>
<v1:Designation>EEEEEE</v1:Designation>
</v1:updateDataRequest>
</soapenv:Body>
</soapenv:Envelope> </string> *************************


But if it is not able to update the Database based on ID it will display the payload like the following :-



org.mule.api.processor.LoggerMessageProcessor: Request *************************** <string>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;v1:updateDataRequest xmlns:v1=&quot;http://ift.tt/1yLVwgN;
&lt;v1:Id&gt;1&lt;/v1:Id&gt;
&lt;v1:Name&gt;BnnnnnnBB !!!!!&lt;/v1:Name&gt;
&lt;v1:Age&gt;66&lt;/v1:Age&gt;
&lt;v1:Designation&gt;EEEEEE&lt;/v1:Designation&gt;
&lt;/v1:updateDataRequest&gt;</string> *************************


... So my question is why it is display the same payload in this format if it is not able to update .... any suggestion .. Do.. I need to transform the payload in any format ... any suggestion ????


No comments:

Post a Comment