Mulesoft Anypoint Studio Issue with DataMapper - Unable to identify/sense the input source

888 views Asked by At

I am facing a problem with datamapper functionality. I have created a flow where I am querying the database and want the output to be passed to datamapper for converting it to a good readable format say xml. The problem is that when I insert a datamapper after the database connector, it does not sense the input correctly. Also I am not able to select the actual Source and type for input/output.

enter image description here

Below is my configuration XML:

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.6.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/ee/data-mapper http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd">
<http:listener-config name="HTTP_Listener_Configuration-2" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<db:mysql-config name="MySQL_Configuration" host="localhost" port="3306" user="user" password="XXXXX" database="test" doc:name="MySQL Configuration"/>
<flow name="sample2Flow">
<http:listener config-ref="HTTP_Listener_Configuration-2" path="/mysqlconnect" doc:name="HTTP"/>
<set-payload value="'mysql connect'" doc:name="Set Payload"/>
<db:select config-ref="MySQL_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[select * from employee where id=#[message.inboundProperties.'http.query.params'.id]]]></db:parameterized-query>
</db:select>
<data-mapper:transform doc:name="DataMapper"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<echo-component doc:name="Echo"/>
</flow>
</mule>
2

There are 2 answers

0
k10gaurav On BEST ANSWER

The datasense was started working when I refreshed the metadata. To do this I have clicked on 'Refresh Metadata' on below right corner of the studio.

Additionally If it doesn't appear, just click on studio canvas.

0
Purnachandra Velagapudi On

Remove the data mapper and add it again, and also make sure that data sense enabled at top on toolbar, data sense checked in database connector configuration.