Announcement Announcement Module
Collapse
No announcement yet.
Default error channel is not handinly the exception which thrown by ServiceActivator Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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.

    Samba

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

    Comment


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

      Samba

      Comment


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

        Comment


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

          Samba

          Comment


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

            Comment


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

              Comment


              • #8
                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

                Comment


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

                  Comment

                  Working...
                  X