문제

I have a flow that takes a pair of dates inbound and then uses a message enricher to get a list of employees that worked on a specific job between those two dates. The result is a simple list of maps returned from a JDBC database. I got that saved into a flow variable without any trouble. The next enrichment is causing me trouble. I setup a for each loop that uses the employees list from the flow variable. This works great and I then need to execute another JDBC query for each of these employees to get all the time tickets they turned in between the two dates passed to the flow. The query works but I am having trouble defining the target expression to hold the result. I would like to see the target be a map with the employee id as the key and the tickets for the period (list of maps) be the value. Is there any way to do this? Is there a better way to save these results? After I get all the tickets, I need to summarize them in various ways and generate a report showing the detail as well as the analysis.

I am currently developing this in mule studio for the community runtime version 3.4.

도움이 되었습니까?

해결책

Is this like something that you are looking for?

<set-variable variableName="maplistmap" value="#[new java.util.HashMap()]"/>
<foreach>
  <jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="selekt" queryTimeout="-1" connector-ref="Database">
    <jdbc-ee:query key="selekt" value="select * from mytable where id = #[payload]"/>
  </jdbc-ee:outbound-endpoint>
  <scripting:component>
    <scripting:script engine="Groovy"><![CDATA[
        flowVars["maplistmap"].put(payload[0].id, payload)
    ]]></scripting:script>
  </scripting:component>         
</foreach>
<logger message="#[flowVars.maplistmap]" level="INFO"/>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top