Announcement Announcement Module
No announcement yet.
Error handling for JdbcOutboundGateway Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error handling for JdbcOutboundGateway


    I have JdbcOutboundGateway

                update="insert into message_store (tracking_id, body) values (:headers[trackingId], :payload)"
                query="select body from message_store where tracking_id=:headers[$tracking_id]"
                request-channel="simpleChannel" reply-channel="simpleSavedChannel" data-source="dataSource"/>
    But if some JDBC exception occurs, the initial message is getting lost instead of being sent to global error channel. I see next log:

    2011-08-04 17:23:18,978 WARN  - Execution of JMS message listener failed, and no ErrorHandler has been set.
    org.springframework.integration.MessageHandlingException: error occurred in message handler [org.springframework.integration.jdbc.JdbcOutboundGateway#0]
    nested exception is java.sql.SQLException: ORA-00001: unique constraint (XXX.TRACKING_ID_PK) violated
    Could you, please, advise how to define ErrorHandler for JdbcOutboundGateway component?

    Thanks is advance.

  • #2
    Outbound Gateways don't have error-channels. It actually applies to all of them and this question was raised several times on this forum so you can do a search and get more details.
    To answer your question the exception in the Outbound Gateway is propagated up the stack back to the initiator of the message flow. It could be some user code that sends a Message or an Inbound Gateway. If its a user code that try/catch ias a natural way of handling it. If its an Inbound Gateway (e.g., JMS Inbound Gateway) than it does have an error-channel attribute.


    • #3
      Thank you for reply.