我在我的项目中使用了Spring集成。我有一个存储过程插入一行并且不返回任何结果。如果我使用int-jdbc:stored-proc-outbound-gateway
,流程将简单终止并且不会连接到下一个通道。处理不返回任何结果的存储过程的最佳方法
DEBUG [org.springframework.jdbc.core.JdbcTemplate.doInCallableStatement] CallableStatement.execute() returned 'false'
DEBUG [org.springframework.jdbc.core.JdbcTemplate.doInCallableStatement] CallableStatement.getUpdateCount() returned 0
DEBUG [org.springframework.jdbc.core.JdbcTemplate.extractReturnedResults] CallableStatement.getUpdateCount() returned -1
我的要求是即使存储过程没有返回任何结果,也要继续流程。什么是最好的处理方式?
UPDATE
阿尔乔姆的响应后,我已经配置以下面的方式存储的过程的出站信道适配器:
<int:service-activator ref="msgHandler" method="buildRequestBasedDataSource" input-channel="PQPutUserBAInformation-SPCall2" output-channel="PQPutUserBAInformation-publishSubscribeChannel"/>
<!-- PQPutUserBAInformation Channel -->
<int:publish-subscribe-channel id="PQPutUserBAInformation-publishSubscribeChannel" />
<int-jdbc:stored-proc-outbound-channel-adapter
id="PQPutUserBAInformation-AWD-StoredProcedure2"
channel="PQPutUserBAInformation-publishSubscribeChannel"
data-source="routingDataSource"
stored-procedure-name="ZSPPQINSERTUSERIDBA"
ignore-column-meta-data="true"
use-payload-as-parameter-source = "false" >
<int-jdbc:sql-parameter-definition name="P_USERID" direction="IN" type="VARCHAR" />
<int-jdbc:parameter name="P_USERID" expression="#xpath(payload, '//CurrentUserID')" />
</int-jdbc:stored-proc-outbound-channel-adapter>
<!-- Service Activator to build the Message from the Stored Procedure ResultSet -->
<int:service-activator input-channel="PQPutUserBAInformation-publishSubscribeChannel" ref="msgHandler" method="buildMessageFromExtSysResponse" />
重复的问题。看这里。我问同样的东西:) http://stackoverflow.com/questions/42676147/spring-integration-chain-flow-handling-void-gateway-calls/42676419#42676419 – haju
如果我的存储过程在插入过程中失败记录,那么我需要错误信息。所以,在这种情况下,你的问题可能无法帮助我。 –
您是否在捕获存储过程中的异常并吞下它?您应该能够将oracle异常传播回网关,然后使用错误通道。这就是我为我的错误所做的。 – haju