5 Replies Latest reply on Aug 1, 2008 5:38 AM by heinzw

    Error handling when processing actions

    heinzw

      Hello,

      when an action in the process pipeline throws an Exception, the esb should move the file into a error directory. But the file is alway moved into the configured done directory.

      Have anyone an idea how to configure the esb correctly, so that the file is put into the configured error directory when an exception is thrown.

      Thanks.

      jboss-esb.xml:

      <jbossesb>
       <providers>
      
       <fs-provider name="GeneralFileProvider">
       <fs-bus busid="fileBus">
       <fs-message-filter
       directory="C:/temp/esb/work"
       error-delete="false"
       error-directory="C:/temp/esb/error"
       error-suffix=".error"
       input-suffix=".xml"
       post-delete="false"
       post-directory="C:/temp/esb/done"
       post-suffix=".done"
       work-suffix=".work" />
       </fs-bus>
       </fs-provider>
       <jms-provider connection-factory="XAConnectionFactory"
       name="GeneralJmsProvider">
       <jms-bus busid="internalEsbJmsBus">
       <jms-message-filter dest-name="mps/esb/busses/internalBus"
       dest-type="QUEUE" persistent="true" />
       </jms-bus>
       </jms-provider>
       </providers>
       <services>
       <service category="esb"
       description="accept a text"
       name="import">
       <listeners>
       <fs-listener busidref="fileBus" is-gateway="true"
       maxThreads="1" name="import" schedule-frequency="10" />
       <jms-listener busidref="internalEsbJmsBus" is-gateway="false"
       maxThreads="1" name="internalBus" />
       </listeners>
      
       <actions>
       <!-- action throws an Exception -->
       <action name="ProcessAction" class="TestError" process="test"/>
       </actions>
       </service>
       </services>
      </jbossesb>
      


      Action implementation:

      import org.jboss.soa.esb.actions.AbstractActionLifecycle;
      import org.jboss.soa.esb.helpers.ConfigTree;
      import org.jboss.soa.esb.message.Message;
      
      public class TestError extends AbstractActionLifecycle {
      
       protected ConfigTree config;
      
       protected TestError(ConfigTree config) {
       this.config = config;
       }
      
       public Message test(Message message) throws Exception {
       throw new Exception();
       }
      }