Results 1 to 3 of 3

Thread: Error handling for JdbcOutboundGateway

  1. #1

    Question Error handling for JdbcOutboundGateway

    Hi,

    I have JdbcOutboundGateway

    Code:
    <jdbc:outbound-gateway
                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:

    Code:
    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. #2
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    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. #3

    Default

    Thank you for reply.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •