Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am still new at Mulesoft EE. I need to get CSV file from FTP server (Filezilla) and insert it into MySQL database (Wamp).
I want to run this test code (I replaced the FTP with HTTP in order to test) but postman plugin shows no results!
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:...>
<db:mysql-config name="MySQL_Configuration" host="localhost"
port="3306" database="information"
doc:name="MySQL Configuration" />
<data-mapper:config name="CSV_To_XML" transformationGraphPath="csv_to_xml.grf" doc:name="CSV_To_XML"/>
<jdbc-ee:mysql-data-source name="MySQL_Data_Source" user="User" password="Pass" url="jdbc:mysql://localhost:3306/information" transactionIsolation="UNSPECIFIED" doc:name="MySQL Data Source"/>
<jdbc-ee:connector name="Database" dataSource-ref="MySQL_Data_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database"/>
<flow name="dbFlow1" doc:name="dbFlow1">
<http:inbound-endpoint exchange-pattern="one-way" host="localhost" port="8084" path="csv" doc:name="HTTP"/>
<data-mapper:transform config-ref="CSV_To_XML" doc:name="CSV To XML"/>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<foreach collection="#[xpath('//info')]" doc:name="For Each">
<mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
<db:insert config-ref="MySQL_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[INSERT INTO `information`.`user_table`
(`current_date`,
`serialnumber`,
`gender`,
`fullname`,
`birthdate`,
`email`,
`mobilnumber`,
`address`)
VALUES
(#[xpath://date],
#[xpath://serialnumber],
#[xpath://gender],
#[xpath://fullname],
#[xpath://birthdate],
#[xpath://email],
#[xpath://mobilenumber],
#[xpath://address]
);]]></db:parameterized-query>
</db:insert>
<message-properties-transformer scope="invocation" doc:name="Message Properties">
<add-message-property key="count" value="#[flowVars.counter]"/>
</message-properties-transformer>
</foreach>
<logger message="#[payload] Number of records #[flowVars.count]" level="INFO" doc:name="Logger"/>
<smtp:outbound-endpoint host="localhost" responseTimeout="10000" doc:name="SMTP"/>
</flow>
</mule>
Let's see if the following helps you. Just replace my File connector with your FTP one, should work.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:smtp="http://www.mulesoft.org/schema/mule/smtp" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper"
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.5.0"
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/file http://www.mulesoft.org/schema/mule/file/current/mule-file.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://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/smtp http://www.mulesoft.org/schema/mule/smtp/current/mule-smtp.xsd">
<db:mysql-config name="MySQL_Configuration" host="localhost"
port="3306" user="" password="" database="information"
doc:name="MySQL Configuration" />
<data-mapper:config name="CSV_To_XML" transformationGraphPath="csv_to_xml.grf" doc:name="CSV_To_XML"/>
<flow name="stackoverflow-ftp-dbFlow1" doc:name="stackoverflow-ftp-dbFlow1">
<file:inbound-endpoint path="" responseTimeout="10000" doc:name="File" />
<data-mapper:transform config-ref="CSV_To_XML" doc:name="CSV To XML"/>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<foreach collection="#[xpath('//info')]" doc:name="For Each">
<mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
<db:insert config-ref="MySQL_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[INSERT INTO `information`.`user_table`
(`current_date`,
`serialnumber`,
`gender`,
`fullname`,
`birthdate`,
`email`,
`mobilnumber`,
`address`)
VALUES
(#[xpath://date],
#[xpath://serialnumber],
#[xpath://gender],
#[xpath://fullname],
#[xpath://birthdate],
#[xpath://email],
#[xpath://mobilenumber],
#[xpath://address]
);]]></db:parameterized-query>
</db:insert>
<message-properties-transformer scope="invocation" doc:name="Message Properties">
<add-message-property key="count" value="#[flowVars.counter]"/>
</message-properties-transformer>
</foreach>
<logger message="#[payload] Number of records #[flowVars.count]" level="INFO" doc:name="Logger"/>
<set-payload value="#[flowVars.count]" doc:name="Set Payload"/>
<smtp:outbound-endpoint host="localhost" responseTimeout="10000" doc:name="SMTP"/>
</flow>
</mule>
I used the DataMapper feature in Anypoint Studio 3.5 of MuleSoft to actually make the mapping from your CSV to XML that I use in the flow.
There you can just set the example file of your csv as input example, and the xml as output example.
I used the following files assuming the little information you offered...
Users csv as Input format example for DataMapper:
date|serialnumber|gender|fullname|birthdate|email|mobilenumber|address
03-07-2014|129329|m|your name|12-03-1970|my#mail.com|219239|my address
04-07-2014|129329|w|her name|12-03-1975|her#mail.com|219229|her address
User XML I as Output format example for DataMapper Attention: The flow variables and xpath expressions depend on it!!
<infos>
<info>
<date></date>
<serialnumber></serialnumber>
<gender></gender>
<fullname></fullname>
<birthdate></birthdate>
<email></email>
<mobilenumber></mobilenumber>
<address></address>
</info>
<info>
<date></date>
<serialnumber></serialnumber>
<gender></gender>
<fullname></fullname>
<birthdate></birthdate>
<email></email>
<mobilenumber></mobilenumber>
<address></address>
</info>
</infos>
Good luck!
PS: Don't forget to add the mysql lib to your classpath or maven.
Related
I´ve got a question concerning inserting salesforce data into a mysql database.
I can query the salesforce account and i´m retrieving the right data from salesforce account.
If i wanna insert the salesforce data into mysql database, there is an error.
Just NULL values will be inserted into the database.
I think the input into the mysql component is right, but the output is wrong.
Maybe you can help me.
Attached is my xml code. What´s wrong?
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:sfdc="http://www.mulesoft.org/schema/mule/sfdc" xmlns:http="http://www.mulesoft.org/schema/mule/http" 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"
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/db http://www.mulesoft.org/schema/mule/db/current/mule-db.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/sfdc http://www.mulesoft.org/schema/mule/sfdc/current/mule-sfdc.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<db:mysql-config name="MySQL_Configuration" host="localhost" port="xxx" user="xxx" password="xxx" database="salesforce" doc:name="MySQL Configuration"/>
<sfdc:config name="Salesforce__Basic_Authentication" username="xxxx" password="xxx" securityToken="xxxx" doc:name="Salesforce: Basic Authentication"/>
<flow name="salesforce_query_mysqlFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/demo" doc:name="HTTP"/>
<sfdc:query config-ref="Salesforce__Basic_Authentication" query="dsql:SELECT BillingCity,BillingCountry,BillingPostalCode,BillingStreet,Id,Name,Phone,Website FROM Account" doc:name="Salesforce"/>
<logger message="#[org.apache.commons.collections.IteratorUtils.toList(message.payload)]" level="INFO" metadata:id="d66ba8a4-9f12-4def-b4fe-ea0669d02170" doc:name="Logger"/>
<dw:transform-message metadata:id="72012d35-6807-484b-89bf-cab577f4f646" doc:name="Transform Message">
<dw:input-payload mimeType="application/java" doc:sample="sample_data/list_Account_2.dwl"/>
<dw:input-variable variableName="salesforce_data"/>
<dw:set-payload><![CDATA[%dw 1.0
%output application/java
---
payload map {
BillingCountry: $.BillingCountry,
BillingCity: $.BillingCity,
BillingStreet: $.BillingStreet,
Phone: $.Phone,
Website: $.Website,
BillingPostalCode: $.BillingPostalCode,
Name: $.Name,
SalesforceId: $.Id
}]]></dw:set-payload>
</dw:transform-message>
<db:insert config-ref="MySQL_Configuration" doc:name="Database" >
<db:parameterized-query><![CDATA[INSERT INTO salesforce.salesforce_account(
BillingCity,BillingCountry,BillingPostalCode,BillingStreet,Name,Phone,Website,Id)
VALUES
(#[message.payload.BillingCity],#[message.payload.BillingCountry],#[message.payload.BillingPostalCode], #[message.payload.BillingStreet], #[message.payload.Name], #[message.payload.Phone],#[message.payload.Website],
#[message.payload.SalesforceId]);]]></db:parameterized-query>
</db:insert>
<logger message="#[message.payload]" level="INFO" doc:name="Logger"/>
</flow>
</mule>
You need one more step to be able to insert all records from Salesforce to the Database. In current configuration the output of Transform Message component is a List of record. Whilst the Database query requires a single record. Therefore you should choose one of the following options:
Add a Collection Splitter component between the Transform Message and Database
Check/tick the Bulk Mode option inside the Basic Settings section in Database properties bulkMode="true"
I would like to save the flow coming from this json file: https://gist.githubusercontent.com/Rajeun/3dbbe8ca240d479dbabe/raw/aba5d0ec9345b886426ab767376b7c9cb60c251f/person.json in a database using anypoint studio.
For this i'm using a http connector where i mentioned the link of the json file. and then i used a json-to-object transformer and a database connector.
In my db i have a table with id, token, tel "int" and email is a varchar
-(I tested the connection and its working well).
when i run my code:
ERROR 2015-03-20 13:14:05,522 [main] org.mule.module.launcher.application.DefaultMuleApplication: null
java.lang.NullPointerException
at org.mule.module.db.internal.config.domain.query.QueryTemplateBeanDefinitionParser.parseParameterizedQuery(QueryTemplateBeanDefinitionParser.java:136) ~[mule-module-db-3.6.1.jar:3.6.1]
at org.mule.module.db.internal.config.domain.query.QueryTemplateBeanDefinitionParser.doParse(QueryTemplateBeanDefinitionParser.java:62) ~[mule-module-db-3.6.1.jar:3.6.1]
at org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser.parseInternal(AbstractMuleBeanDefinitionParser.java:295) ~[mule-module-spring-config-3.6.1.jar:3.6.1]
at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59) ~[spring-beans-3.2.10.RELEASE.jar:3.2.10.RELEASE]
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73) ~[spring-beans-3.2.10.RELEASE.jar:3.2.10.RELEASE]
at org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate.parseCustomElement(MuleHierarchicalBeanDefinitionParserDelegate.java:98) ~[mule-module-spring-config-3.6.1.jar:3.6.1]
at org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate.parseCustomElement(MuleHierarchicalBeanDefinitionParserDelegate.java:140) ~[mule-module-spring-config-3.6.1.jar:3.6.1]
******************************************************************************
Config:
<mule xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:http="http://www.mulesoft.org/schema/mule/http" 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/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="www.gist.githubusercontent.com" port="80" doc:name="HTTP Listener Configuration"/>
<db:mysql-config name="MySQL_Configuration" host="localhost" port="3306" user="root" database="mulesoft" doc:name="MySQL Configuration"/>
<db:template-query name="Template_Query" doc:name="Template Query">
<db:parameterized-query/>
</db:template-query>
<flow name="testFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="Rajeun/3dbbe8ca240d479dbabe/raw/aba5d0ec9345b886426ab767376b7c9cb60c251f/person.json" doc:name="HTTP"/>
<json:json-to-object-transformer returnClass="myclass" doc:name="JSON to Object"/>
<response>
<logger message="c bon" level="INFO" doc:name="Logger"/>
</response>
<response>
<db:insert config-ref="MySQL_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[INSERT INTO push(id, token, tel, email) VALUES (2,2,3,#[payload['userImage']])]]></db:parameterized-query>
</db:insert>
</response>
</flow>
</mule>
Remove the empty template query:
<db:template-query name="Template_Query" doc:name="Template Query">
<db:parameterized-query />
</db:template-query>
Also, does 'myclass' exist? if not try just using a map:
<json:json-to-object-transformer returnClass="java.util.HashMap" doc:name="JSON to Object"/>
Also It looks like you want to retrieve that JSON file from the specified URL. For that you want the http:request not http:listener. http:listener is used as a message source waiting for requests to your app.
You should use the http:request to request the file and trigger it using a polling message source:
<http:request-config name="HTTP_Request_Configuration" host="www.gist.githubusercontent.com" port="80" doc:name="HTTP Request Configuration"/>
<flow name="testFlow">
<poll>
<http:request config-ref="HTTP_Request_Configuration" path="Rajeun/3dbbe8ca240d479dbabe/raw/aba5d0ec9345b886426ab767376b7c9cb60c251f/person.json" method="GET" doc:name="HTTP"/>
</poll>
</flow>
See: http://www.mulesoft.org/documentation/display/current/HTTP+Request+Connector
And: http://www.mulesoft.org/documentation/display/current/Poll+Reference
I have a message enricher in my Mule flow that looks like this:
<set-variable doc:name="Variable" value="#[payload['MeterUID']]" variableName="#['theKey']"/>
<enricher target="#[payload]" doc:name="Message Enricher">
<mongo:find-objects-using-query-map config-ref="Mongo_DB1" collection="meterentity" doc:name="Mongo DB">
<mongo:query-attributes>
<mongo:query-attribute key="_id">#[theKey]</mongo:query-attribute>
</mongo:query-attributes>
<mongo:fields>
<mongo:field>IpAddress</mongo:field>
<mongo:field>LastSetTime</mongo:field>
<mongo:field>LastReadGsmData</mongo:field>
</mongo:fields>
</mongo:find-objects-using-query-map>
and this is the payload that the message enricher recieves from my inbound-endpoint:
{TimeStamp=2013-12-16 08:48:33,270, MeterUID=4B414D000000011613CF, SignalStrengthIndication=15, CellID=4938, LocationAreaCode=280, MobileCountryCode=238, MobileNetworkCode=1}
at the Mongo-collection to json my payload looks like this:
[ { "_id" : "4B414D000000011613CC" , "IpAddress" : "10.12.189.12" , "LastSetTime" : { "$date" : "2014-03-11T14:40:36.987Z"} , "LastReadGsmData" : { "$date" : "2014-03-11T14:40:47.253Z"}}]
This seems wrong to me. First, where did my my first payload go ?
And second I get this this error when the flow tryes to inserted into my mongodb:
Exception stack is:
1. BasicBSONList can only work with numeric keys, not: [_id] (java.lang.IllegalArgumentException)
org.bson.types.BasicBSONList:161 (null)
2. Failed to invoke insertObject. Message payload is of type: String
How can I make this work?
I am still vary new to mule so i hope you guys can help me here.
My entire flow:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:mongo="http://www.mulesoft.org/schema/mule/mongo" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper" xmlns:file="http://www.mulesoft.org/schema/mule/file" 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.4.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/file http://www.mulesoft.org/schema/mule/file/current/mule-file.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://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/mongo http://www.mulesoft.org/schema/mule/mongo/2.0/mule-mongo.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd">
<data-mapper:config name="csv_to_xml_7" transformationGraphPath="csv_to_xml_7.grf" doc:name="csv_to_xml_7"/>
<data-mapper:config name="csv_to_xml_8" transformationGraphPath="csv_to_xml_8.grf" doc:name="csv_to_xml_8"/>
<mongo:config name="Mongo_DB" username="$[admin]" doc:name="Mongo DB">
<mongo:connection-pooling-profile initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW"/>
</mongo:config>
<mongo:config name="Mongo_DB1" username="$[admin]" doc:name="Mongo DB">
<mongo:connection-pooling-profile initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW"/>
</mongo:config>
<data-mapper:config name="xml_to_json_2" transformationGraphPath="xml_to_json_2.grf" doc:name="xml_to_json_2"/>
<data-mapper:config name="xml_to_json_3" transformationGraphPath="xml_to_json_3.grf" doc:name="xml_to_json_3"/>
<mongo:config name="Mongo_DB2" username="$[admin]" doc:name="Mongo DB">
<mongo:connection-pooling-profile initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW"/>
</mongo:config>
<flow name="p2pcontrollerloganalyserFlow1" doc:name="p2pcontrollerloganalyserFlow1">
<file:inbound-endpoint path="C:\Users\Simon\Desktop\CSVFile" responseTimeout="10000" doc:name="File" moveToDirectory="C:\Users\Simon\Desktop\CSVPros" />
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<choice doc:name="Choice">
<when expression="#[message.outboundProperties.originalFilename=='gsmdata.log']">
<data-mapper:transform config-ref="csv_to_xml_7" doc:name="GSMV1 to xml"/>
<splitter expression="#[xpath('//Root')]" doc:name="Splitter"/>
<mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
<data-mapper:transform config-ref="xml_to_json_2" doc:name="XML To JSON"/>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<vm:outbound-endpoint exchange-pattern="one-way" path="json1" doc:name="VM"/>
</when>
<when expression="#[message.outboundProperties.originalFilename=='gsmdatav2.log']">
<data-mapper:transform config-ref="csv_to_xml_8" doc:name="GSMV2 to XML"/>
<splitter expression="#[xpath('//Root')]" doc:name="Splitter"/>
<mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
<data-mapper:transform config-ref="xml_to_json_3" doc:name="XML To JSON"/>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<vm:outbound-endpoint exchange-pattern="one-way" path="json2" doc:name="VM"/>
</when>
<otherwise>
<file:outbound-endpoint path="C:\Users\Simon\Desktop\CSVFile" responseTimeout="10000" doc:name="Failed GSM"/>
</otherwise>
</choice>
</flow>
<flow name="json1persistent" doc:name="json1persistent">
<vm:inbound-endpoint exchange-pattern="one-way" path="json1" doc:name="VM"/>
<json:json-to-object-transformer returnClass="java.lang.Object" doc:name="JSON to Object"/>
<set-variable doc:name="Variable" value="#[payload['MeterUID']]" variableName="#['theKey']"/>
<enricher target="#[payload]" doc:name="Message Enricher">
<mongo:find-objects-using-query-map config-ref="Mongo_DB1" collection="meterentity" doc:name="Mongo DB">
<mongo:query-attributes>
<mongo:query-attribute key="_id">#[theKey]</mongo:query-attribute>
</mongo:query-attributes>
<mongo:fields>
<mongo:field>IpAddress</mongo:field>
<mongo:field>LastSetTime</mongo:field>
<mongo:field>LastReadGsmData</mongo:field>
</mongo:fields>
</mongo:find-objects-using-query-map>
</enricher>
<mongo:mongo-collection-to-json doc:name="Mongo DB"/>
<mongo:insert-object config-ref="Mongo_DB2" collection="GSMdata" doc:name="Mongo DB"/>
<!-- <foreach collection="#[payload]" doc:name="For Each">
<mongo:insert-object config-ref="Mongo_DB" collection="GSMdata" doc:name="Mongo DB"/>
</foreach> -->
<!-- <enricher doc:name="Message Enricher">
<mongo:get-file-content config-ref="Mongo_DB" query-ref="#[payload['MeterUID']]" doc:name="Find Meter"/>
</enricher>-->
</flow>
</mule>
I am tying to read a CSV file, splitting it into smaller messages, enrich each of thise messages with the data from a MongoDB and finally insert each message into another MongoDB.
First, where did my my first payload go ?
enricher target="#[payload]" means that you are setting your current payload to whatever is returned by the enricher. You really want the target to be something else, such as a variable: target="#[variable:myVar]".
second I get this this error when the flow tryes to inserted into my
mongodb
You are not sharing any of your relevant configuration here, but I guess you are now sending your list of queried Mongo objects to some component that expects a single Map object. Please refer to your first problem.
If your aim is to add the fields from queried Mongo objects to your current payload, you should use a variable as the enrich target like in my above example. You can then later combine the payload and the enriched variable containing the Mongo object(s).
Further, if you are only getting a single object from Mongo, you can extract it from the Mongo list by using something like source="#[payload.toArray()[0]]" in the enricher component.
As your payload and the myVar variable are now both Java Maps, you can combine them with plain Java:
<expression-component doc:name="Expression">payload.putAll(myVar)</expression-component>
If you want to get rid of the _id field returned by Mongo, you can do it with
<expression-component doc:name="Expression">payload.remove('_id')</expression-component>
EDIT: Now that your payload is a Map, you can insert it into Mongo with
<mongo:insert-object-from-map config-ref="Mongo_DB2" collection="GSMdata">
<mongo:element-attributes ref="#[payload]"/>
</mongo:insert-object-from-map>
I am new for the mule esb but i know other ESB patterns
my issue is i have done a sample which will insert a data into DB.its working fine but its not giving any response to client so client is getting nothing from server
my sample code is
<mule xmlns:json="http://www.mulesoft.org/schema/mule/json"
xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc"
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.4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
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">
<jdbc-ee:postgresql-data-source name="PostgreSQL_Data_Source" user="youtilitydba" password="45782dfff1" url="jdbc:postgresql://localhost:5432/sample" transactionIsolation="UNSPECIFIED" doc:name="PostgreSQL Data Source"/>
<jdbc-ee:connector name="Database" dataSource-ref="PostgreSQL_Data_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database"/>
<flow name="insertintoDBFlow1" doc:name="insertintoDBFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP" path="httpPost"/>
<logger message="log about input message: #[payload]" level="INFO" doc:name="Logger"/>
<json:json-to-object-transformer doc:name="JSON to Object" returnClass="java.util.Map"></json:json-to-object-transformer>
<jdbc-ee:outbound-endpoint exchange-pattern="one-way" queryKey="INSERT_TOKEN" queryTimeout="-1" connector-ref="Database" doc:name="Database">
<jdbc-ee:query key="INSERT_TOKEN" value="insert into users(FirstName,lastname) values(#[message.payload.name],#[message.payload.id]);"/>
</jdbc-ee:outbound-endpoint>
</flow>
</mule>
and i am calling to this using sample JSON client like this
curl -H "Content-Type: application/json" -d '{"name":"kk","id":"anil"}' http://localhost:8081/httpPost
when i am running this json its giving nothing response but i wish to give response like this {"ResponseJSON":{"Body":{"Datalist":{"Data":"Successfully Rows inserted"}},"Status":"200"}}
how would i format this above format i used http response builder but there is nothing to do like this..
you need to add an Echo component, set the payload to the value you are looking for and add a HTTP Response Builder with status="200" and contentType="application/json".
Add the following lines after </jdbc-ee:outbound-endpoint> and before </flow>
<response>
<http:response-builder status="200" contentType="application/json" doc:name="HTTP Response Builder"/>
</response>
<response>
<set-payload value="{"Body":{"Datalist":{"Data":"Successfully Rows inserted"}},"Status":"200"}}" doc:name="Set Payload"/>
</response>
<echo-component doc:name="Echo"/>
Cheers,
-Marco.
I have an All Routing Message Processor where I send a request from a Client to multiple External services , I can send the request and I get the response but the response looks a bit weird:
<java.util.concurrent.CopyOnWriteArrayList serialization="custom">
<java.util.concurrent.CopyOnWriteArrayList>
<default/>
<int>2</int>
<byte-array>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IS0tIFB1Ymxpc2hlZCBieSBK
QVgtV1MgUkkgYXQgaHR0cDovL2pheC13cy5kZXYuamF2YS5uZXQuIFJJJ3MgdmVyc2lvbiBpcyBK
QVgtV1MgUkkgMi4xLjYuIC0tPjwhLS0gR2VuZXJhdGVkIGJ5IEpBWC1XUyBSSSBhdCBodHRwOi8v
amF4LXdzL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VHlw
ZT4KPGJpbmRpbmcgbmFtZT0iSGFsbG9XZWx0SW1wbFBvcnRCaW5kaW5nIiB0eXBlPSJ0bnM6SGFs
bG9XZWx0Ij4KPHNvYXA6YmluZGluZyB0cmFuc3BvcnQ9Imh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAu
b3JnL3NvYXAvaHR0cCIgc3R5bGU9ImRvY3VtZW50Ii8+CjxvcGVyYXRpb24gbmFtZT0iaGFsbG8i
Pgo8c29hcDpvcGVyYXRpb24gc29hcEFjdGlvbj0iIi8+CjxpbnB1dD4KPHNvYXA6Ym9keSB1c2U9
ImxpdGVyYWwiLz4KPC9pbnB1dD4KPG91dHB1dD4KPHNvYXA6Ym9keSB1c2U9ImxpdGVyYWwiLz4K
PC9vdXRwdXQ+Cjwvb3BlcmF0aW9uPgo8L2JpbmRpbmc+CjxzZXJ2aWNlIG5hbWU9IkhhbGxvV2Vs
dEltcGxTZXJ2aWNlIj4KPHBvcnQgbmFtZT0iSGFsbG9XZWx0SW1wbFBvcnQiIGJpbmRpbmc9InRu
czpIYWxsb1dlbHRJbXBsUG9ydEJpbmRpbmciPgo8c29hcDphZGRyZXNzIGxvY2F0aW9uPSJodHRw
Oi8vbG9jYWxob3N0OjQ0MzMvbWluaXdlYnNlcnZpY2UvbWluaXdlYnNlcnZpY2UiLz4KPC9wb3J0
GlvbnM+</byte-array> Pgo8L3NlcnZpY2U+CjwvZGVmaW5pdGlvbnM+</byte-array>
</java.util.concurrent.CopyOnWriteArrayList>
</java.util.concurrent.CopyOnWriteArrayList>
Any suggestion how to solve this?
Update :
Here is my current configuration :
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:tcp="http://www.mulesoft.org/schema/mule/tcp" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="CE-3.2.1" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd
http://www.mulesoft.org/schema/mule/tcp http://www.mulesoft.org/schema/mule/tcp/current/mule-tcp.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd ">
<flow name="flows1Flow1" doc:name="flows1Flow1">
<http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:4433/miniwebservice" mimeType="text/xml" doc:name="HTTP"/>
<logger level="INFO" category="ddo" doc:name="Logger"/>
<all doc:name="All">
<processor-chain>
<message-properties-transformer mimeType="text/xml" doc:name="Message Properties">
<add-message-property key="http.method" value="#[header:INBOUND:http.method]"/>
</message-properties-transformer>
<http:outbound-endpoint exchange-pattern="request-response" address="http://localhost:4435/miniwebservice#[header:INBOUND:http.request]" mimeType="text/xml" doc:name="HTTP"/>
<mulexml:xslt-transformer maxIdleTransformers="2" maxActiveTransformers="5" xsl-file="C:\Users\kiesa\Desktop\XSLReplace.xsl" doc:name="XSLT"/>
</processor-chain>
<processor-chain>
<message-properties-transformer mimeType="text/xml" doc:name="Message Properties">
<add-message-property key="http.method" value="#[header:INBOUND:http.method]"/>
</message-properties-transformer>
<http:outbound-endpoint exchange-pattern="request-response" address="http://localhost:4434/miniwebservice#[header:INBOUND:http.request]" mimeType="text/xml" doc:name="HTTP"/>
<mulexml:xslt-transformer maxIdleTransformers="2" maxActiveTransformers="5" xsl-file="C:\Users\kiesa\Desktop\XSLReplace2.xsl" doc:name="XSLT"/>
</processor-chain>
</all>
<custom-aggregator failOnTimeout="true" class="customJavaClass" doc:name="Custom Aggregator"/>
<mulexml:object-to-xml-transformer doc:name="Object to XML"/>
</flow>
</mule>
There is nothing to solve here: the result of an All Routing Message Processor is a java.util.List of payloads received from each call to each message processor inside the All one.
You must have an object-to-xml transformation configured somewhere: this is why the List payload is turned into XML by using an XStream-powered serialization.
You need to deal with this list, for example with a custom component that can process a java.util.List payload.