Announcement Announcement Module
No announcement yet.
Default error channel is not handinly the exception which thrown by ServiceActivator Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.


  • #2
    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).


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



      • #4
        I assume you mean INBOUND channel adapter - that's where the error-channel goes.


        • #5
          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.



          • #6
            Please provide your actual configuration, together with a DEBUG log (for org.springframework.integration), starting with 'preSend on errorChannel'.


            • #7
              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.
              <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")
              <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
                Hi Gary,

                please find the below details.

                <!-- JMS config -->

                id="messageDrivenChannelAdapter" channel="header.enricher"
                container="LbQueueContainer" error-channel="common.errorChannel" />

                <!-- Integration config -->

                <int:chain input-channel="" output-channel="">
                <!-- <int:error-channel ref="errorChannel"/> -->
                <int:header name=""
                expression="payload" />

                <int:chain input-channel="" output-channel="" >
                <int:service-activator ref="refService" method="insertAceData" />

                <!-- Handling Error Notification updates -->
                <int:chain id=""
                input-channel="errorChannel" output-channel="">
                <int:transformer expression="headers.get('payload')"/>
                <int:header name="${status.processflag}"
                value="${status.error.value}" />
                <int:header name="${status.message}" value="${status.message.value}" />

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



                • #9
                  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.