3 Replies Latest reply on Oct 9, 2007 10:18 AM by sebcio

    <fs-provider > get original filename

    kodi_x7

      Hi All,

      can anyone explain how to access original filename inside custom actions provided by <fs-provider> ?


      <fs-provider name="TiffEingang">
       <fs-bus busid="TiffEingangChannel" >
       <fs-message-filter
       directory="C:\ESB_OBSERVER_FOLDER"
       input-suffix="tif"
       work-suffix=".esbInProcess"
       post-delete="false"
       post-directory="C:\ESB_OBSERVER_FOLDER\processed"
       post-suffix=".esbDone"
       error-delete="false"
       error-directory="C:\ESB_OBSERVER_FOLDER\processed"
       error-suffix=".esbERROR"
       />
       </fs-bus>
      ...
       <action name="call_aida2" class="org.jboss.soa.esb.eucon.aida.AIDA2Action" />
      
      ...
      
      public class AIDA2Action extends AbstractActionLifecycle
      {
      ..
      public Message process(Message message) throws Exception
       { .. getOriginalFileName(); ????? }
      ..
      }
      


        • 1. Re: <fs-provider > get original filename
          tfennelly

          The default local file MessageComposer doesn't attach the original file name to the composed ESB Message, but that's easy enough for you to do by simply extending its compose() method and adding the file/name to the composed message ala...

          public class MyLocalFileMessageComposer<T extends File> extends LocalFileMessageComposer<T> {
           public Message compose(T inputFile) throws MessageDeliverException {
           Message message = super.compose(inputFile);
           message.getProperties().setProperty("original-file", inputFile);
           return message;
           }
          }


          And then specifying your own composer impl on the fs-listener ala...

          <fs-listener name="x" busidref="blah" is-gateway="true">
           <property name="composer-class" value="com.acme.composers.MyLocalFileMessageComposer" />
          </fs-listener>


          And then in your action....
          public Message process(Message message) throws Exception {
           File originalFile = (File) message.getProperties().getProperty("original-file");
           .....
          }


          • 2. Re: <fs-provider > get original filename
            edgar.silva

            Hi dude,

            I did using a different way but is also working.

            See:

            public Message processMessage(Message message) throws Exception {
            
            
             String fileName = (String) message.getProperties().getProperty("org.jboss.soa.esb.gateway.original.file.name");
             System.out.println("File:" + fileName);
             return message;
             }
            

            I hope this help you.

            Regards

            Edgar

            • 3. Re: <fs-provider > get original filename
              sebcio

              Hi kodi_x7,

              this property was added in MR3, so please use JBossESB4.2GA. Please also check your filters section of the jbossesb-properties.xml (see Programmers Guide, page 53). In my project, it works fine. I hope, it helps.

              Regards,
              Sebastian