我的 Mule 流程中有一个 REST 服务:-
<flow name="restServiceFlow1" doc:name="restFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" doc:name="HTTP"/>
<jersey:resources doc:name="REST">
<component class="com.test.services.schema.maindata.v1.Impl.MainDataImpl"/>
</jersey:resources>
</flow>
我有另一个流,它将 JSON 请求从文件发送到该服务流并使用它:-
<flow name="restFlow2" doc:name="restFlow2">
<file:inbound-endpoint path="E:\backup\test" responseTimeout="10000" doc:name="File" connector-ref="File_Global">
<file:filename-regex-filter pattern="aa.txt" caseSensitive="false"/>
</file:inbound-endpoint>
<json:json-to-object-transformer returnClass="java.util.HashMap" doc:name="JSON to Object"/>
<http:outbound-endpoint exchange-pattern="request-response" contentType="application/json" method="GET" address="http://localhost:8082/getData/insert/?id=#[payload.insertDataRequest[0].id]&name=#[payload.insertDataRequest[0].name]&age=#[payload.insertDataRequest[0].age]&designation=#[payload.insertDataRequest[0].designation]" doc:name="HTTP"/>
</flow>
现在我的 JSON 请求是:-
{
"insertDataRequest": [
{
"id": "6",
"name": "ddddd",
"age": "55",
"designation": "WQQQQQ"
},
{
"id": "64",
"name": "mmmm",
"age": "545",
"designation": "TTTTTTTTTT"
}
]
}
现在,问题是每当我将 JSON 请求作为文件放置时……只插入第一个数据……那只是
{
"id": "6",
"name": "ddddd",
"age": "55",
"designation": "WQQQQQ"
}
正在插入 DB ..
.... .... 现在我希望将所有数据插入数据库中...我该如何实现呢?..每个人都需要任何数据来获取所有数据吗??...请帮助...