在mule esb中开发示例bookstare,并使用mysql作为数据库。我的数据库有一个名为'Stock'的表,其中有2个属性(isbn和数量),用于我在表单上提供的注册书籍。我想要的是检查客户要求的书籍数量,不要增加我的数据库上存在的书籍(数量)来完成订单。在会话变量中保存来自数据库的值Mule esb
我有流量:
<flow name="Facturacion" doc:name="Facturacion">
<composite-source doc:name="Composite Source">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8086" doc:name="HTTP" path="Facturacion" transformer-refs="HttpToPedido"/>
<file:inbound-endpoint responseTimeout="10000" doc:name="File" moveToDirectory="tmp" path="tmp/pedidos"/>
</composite-source>
<component doc:name="Generar Pedido" class="org.mule.components.GenerarPedido"/>
<set-session-variable variableName="dataTemp" value="#[message.payload.cantidadPedida]" doc:name="Session Variable"/>
<db:select config-ref="MySQL_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[SELECT cantidad FROM stock WHERE isbn = #[payload.isbn]]]></db:parameterized-query>
</db:select>
<collection-splitter doc:name="Collection Splitter"/>
<choice doc:name="Choice">
<when expression="#[sessionVars['dataTemp'] >= payload.cantidadPedida]">
<vm:outbound-endpoint exchange-pattern="one-way" path="procesarPedido" doc:name="Procesar Pedido Disponible"/>
</when>
<otherwise>
<vm:outbound-endpoint exchange-pattern="one-way" path="rechazarStock" doc:name="Rechazar por falta en Stock"/>
</otherwise>
</choice>
<collection-aggregator failOnTimeout="true" doc:name="Collection Aggregator"/>
<set-payload value="#[payload];" doc:name="Set Payload"/>
</flow>
任何解决这个问题?我需要的是根据我的数据库中的有效负载与我的“库存表”中的值来比较本书数量的值。
谢谢!
感谢您的响应。但是我需要的是比较muy订购数量(我从有效载荷中得到的价值)和我的数据库的“stock”表中的值来接受订单。 – 2015-02-10 11:50:54