【发布时间】:2017-04-09 23:56:39
【问题描述】:
我已经使用 Mule 获取了一些我的 SQLServer 数据库表,现在我需要在 mongoDB 中创建一个集合。
我能够创建成功的连接,但无法将集合创建到 MongoDB。
下面是我使用的 XML
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:mongo="http://www.mulesoft.org/schema/mule/mongo" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:json="http://www.mulesoft.org/schema/mule/json" 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"
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/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/mongo http://www.mulesoft.org/schema/mule/mongo/current/mule-mongo.xsd">
<db:generic-config name="MicrosoftSQLServerDB" url="jdbc:sqlserver://localhost:1433;DatabaseName=TESTNAV;user=sa;password=xxxxx" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" doc:name="Generic Database Configuration"/>
<mongo:config name="mymongoconfig" database="mydb1" doc:name="Mongo DB"/>
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<flow name="replicateFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<db:select config-ref="MicrosoftSQLServerDB" doc:name="Database">
<db:parameterized-query><![CDATA[Select * from [Electoral-Mechanicals P Ltd$Customer]]]></db:parameterized-query>
</db:select>
<logger message="No. of Records fetched from Table:#[payload.size()]" level="INFO" doc:name="Logger"/>
<mongo:insert-object collection="customer" config-ref="mymongoconfig" doc:name="Mongo DB"/>
</flow>
</mule>
在运行应用程序后,即使应用程序状态已部署,但 MongoDB 中没有集合
- 应用程序 + - - * - - + 域 + - - * - - + 状态 + - - *
- 应用程序 + - - * - - + 域 + - - * - - + 状态 + - - *
-
复制 * 默认 * 已部署 *
【问题讨论】:
标签: sql-server mongodb collections mule anypoint-studio