Results 1 to 9 of 9

Thread: Default error channel is not handinly the exception which thrown by ServiceActivator

  1. #1
    Join Date
    Nov 2012
    Posts
    14

    Default Default error channel is not handinly the exception which thrown by ServiceActivator

    Hi All,

    Could you please help me handle the exception in integration flow, which thrown by service activator class.

    I have one service activator class in that i am doing DB operations. if any error it throw exception.

    default "errorChannel" is not handling those exceptions , could you please help me to handle those exception in flow.

    Samba

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,148

    Default

    You need to add an error-channel attribute to the originating endpoint (start of the flow); it will catch the exception and send an ErrorMessage to the error-channel; the ErrorMessage has a payload of type MessagingException which has two properties (failedMessage - the message, and cause - the exception thrown by the service).
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    Nov 2012
    Posts
    14

    Default

    Hi Gary,

    Here our flow is like
    <int-jms:outbound-channel-adapter ---> cic (custom) header enricher --> service activator --- here I don't have a option to add error-channel attribute.

    Samba

  4. #4
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,148

    Default

    I assume you mean INBOUND channel adapter - that's where the error-channel goes.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  5. #5
    Join Date
    Nov 2012
    Posts
    14

    Default

    Hi Gary,

    I am able to get the message in errorChannel, actually I am loosing my payload ,I am not able to get the actual payload to update the status.
    I am getting like
    Payload=org.springframework.integration.MessageHan dlingException: org.springframework.dao.DuplicateKeyException: SqlMapClient operation; SQL [];

    I tried :
    <int:transformer ... expression="payload.failedMessage" .../> too, I am getting

    org.springframework.expression.spel.SpelEvaluation Exception: EL1008Epos 8): Field or property 'failedMessage' cannot be found on object of type 'java.lang.String'

    Could you please help on this.

    Samba

  6. #6
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,148

    Default

    Please provide your actual configuration, together with a DEBUG log (for org.springframework.integration), starting with 'preSend on errorChannel'.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  7. #7
    Join Date
    Jul 2012
    Location
    Denver metro
    Posts
    18

    Default

    Another couple of things you can try:

    in your error handling route, set up a logging outbound adapter instead of the transformer have it dump the message for a quick debug.
    Code:
    <int:logging-channel-adapter id="TEMP_ERROR_LOGGING" channel="errorChannel" level="ERROR" log-full-message="true"/>
    or you can try hooking up a wiretap to your error channel to log the data going through your error channel (assuming your channel name is "errorChannel")
    Code:
    <int:wire-tap pattern="errorChannel" channel="wiretapChannel"/>
    <int:logging-channel-adapter id="WIRETAP_LOGGING" channel="wiretapChannel" level="ERROR" log-full-message="true" />
    Then you can see if you're getting the expected message format.

  8. #8
    Join Date
    Nov 2012
    Posts
    14

    Default

    Hi Gary,

    please find the below details.

    <!-- JMS config -->

    <int-jms:message-driven-channel-adapter
    id="messageDrivenChannelAdapter" channel="header.enricher"
    container="LbQueueContainer" error-channel="common.errorChannel" />



    <!-- Integration config -->

    <int:chain input-channel="jdbc.data.in" output-channel="select.data.out">
    <int:header-enricher>
    <!-- <int:error-channel ref="errorChannel"/> -->
    <int:header name="p2p.so.ace2gems.notif.original.payload"
    expression="payload" />
    </int:header-enricher>

    <int:chain input-channel="select.data.out" output-channel="update.status.in" >
    <int:service-activator ref="refService" method="insertAceData" />
    </int:chain>


    <!-- Handling Error Notification updates -->
    <int:chain id="p2p.so.ace2gems.updateAce.notification.error"
    input-channel="errorChannel" output-channel="c.prepare.to.update.notification">
    <int:transformer expression="headers.get('payload')"/>
    <int:header-enricher>
    <int:header name="${status.processflag}"
    value="${status.error.value}" />
    <int:header name="${status.message}" value="${status.message.value}" />
    </int:header-enricher>
    </int:chain>

    preSend on channel 'errorChannel', message: [Payload=org.springframework.integration.MessageHan dlingException: org.springframework.dao.DuplicateKeyException: SqlMapClient operation; SQL [];

    Samba

  9. #9
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,148

    Default

    Please use [ code ] ... [ /code ] tags when posting code and config (no spaces in brackets).

    This is incomplete - your jms adapter sends errors to "common.errorChannel" - the above flow (and partial log) shows "errorChannel" and I don't see the transformer you were asking me about (<int:transformer ... expression="payload.failedMessage" .../>).

    Please provide the full information I asked for, and, as I said, I need the log STARTING with PreSend and INCLUDING the "org.springframework.expression.spel.SpelEvaluatio n Exception: EL1008Epos 8): Field or property 'failedMessage' cannot be found on object of type 'java.lang.String'" message.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Posting Permissions

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