3 Replies Latest reply on Jul 19, 2012 4:20 PM by Bala Voleti

    Problem with adding post-suffix to file after coping

    amigo amigo Newbie

      I use fs-listener and fs-message-filter to copy file from first folder to second, when file is added in first.

       

      When i set input-suffix and post-suffix in fs-message-filter are equals, but anyway post-suffix is added to input-suffix of file.

       

      For example, when i add file '1.txt' to input folder, i get file '1.txt.txt' to output folder.

       

      The problem is in implementation of AbstractGatewayListener that has code

       

      void processingComplete(File fileIn, File workingFile) {
        File fileOK = new File(_postProcessDirectory, fileIn.getName()                        + _postProcessSuffix);

      ....

       

      Can i any simple method to change this?

      Or How i can redefine gateway class for fs-listener?

        • 1. Problem with adding post-suffix to file after coping
          Tom Fennelly Master

          I think I follow you   Mind posting your ESB config please.

           

          Also... take a look at this page re implementing a custom listener... http://community.jboss.org/wiki/WritingCustomListenersforJBossESB4x

          • 2. Problem with adding post-suffix to file after coping
            amigo amigo Newbie

            Thanks.

             

            I use now such jboss-esb configuration

             

            <listeners>

                            <fs-listener name="FileGateway" busidref="helloFileChannel" is-gateway="true"

                                         schedule-frequency="10">

                                <fs-message-filter

                                    directory="${input}"

                                    input-suffix=".txt"

                                    work-suffix=".esbWorking"

                                    post-delete="false"

                                    post-directory="${output}"

                                    post-suffix=""

                                    error-delete="false"

                                    error-directory="D:\Projects2\FileCopyESB\dirs\error"

                                    error-suffix=".IN_ERROR"

                                    post-rename="true"

                                    />

                            </fs-listener>

                        </listeners>

                        <actions mep="OneWay">

             

             

                            <action name="action6"

                                    class="ru.csbi.esb.listener.MyAction"

                                    process="process"

                                    />

             

             

                            <action name="BuildFilename" class="org.jboss.soa.esb.actions.naming.FileNameGeneratorAction">

                                <property name="strategies" value="">

                                    <strategies>

                                        <strategy class="org.jboss.soa.esb.actions.naming.strategy.ChangeSuffixNamingStrategy"

                                                  newSuffix="txt"/>

                                    </strategies>

                                </property>

                            </action>

                            <action name="notificationAction" class="org.jboss.soa.esb.actions.Notifier">

                                <property name="okMethod" value="notifyOK"/>

                                <property name="notification-details">

                                    <NotificationList type="ok">

                                        <target class="NotifyFiles">

                                            <file append="false"

                                                  URI="D:\Projects2\FileCopyESB\dirs\out\{org.jboss.soa.esb.naming.result}"/>

                                        </target>

                                    </NotificationList>

                                    <NotificationList type="err">

                                        <target class="NotifyFiles">

                                            <file append="false"

                                                  URI="D:\Projects2\FileCopyESB\dirs\out\{org.jboss.soa.esb.naming.result}_error"/>

                                        </target>

                                    </NotificationList>

                                </property>

                            </action>

             

            But i'll try with new listener.

            • 3. Re: Problem with adding post-suffix to file after coping
              Bala Voleti Newbie

              Hi Tom,

              I had the similar issue, please see my configuration. I'm able to SFTP file from remote to my local machince without problem.

               

              if you see my provider i'm accepting all types of file and want to transfer same file to my local, can you please let me know how do i mention in my notifer to transfer same file with same name and type to my local. Thank you for you help in Adavance ... Bala

               

              <providers>

               

                <ftp-provider hostname="...." name="FTPProviderLAB11">

                 <ftp-bus busid="LAB11ChannelID">

                  <ftp-message-filter directory="/opt/sw/jboss/target/receive"

                   input-suffix=".*" password="password" post-delete="true"

                   post-rename="false" protocol="sftp" username="jboss"/>

                 </ftp-bus>

                </ftp-provider>

              </providers>

              <services>

                <service category="SFTPToLocalCategory"

                 description="Transfer file from SFTP server to your local box or remote box"

                 invmScope="GLOBAL" invmTransacted="true" name="SFTPToLocalService">

                 <listeners>

                  <ftp-listener busidref="LAB11ChannelID" is-gateway="true" name="LAB11Listener"/>

                 </listeners>

                 <actions mep="OneWay">

                  <action class="org.jboss.soa.esb.actions.Notifier" name="notificationAction">

                   <property name="okMethod" value="notifyOK"/>

                   <property name="destinations">

                    <NotificationList type="ok">

                     <target class="NotifyFiles">

                      <file URI="E:\testing\done\Successful.pptx" append="false"/>

                     </target>

                    </NotificationList>

                    <NotificationList type="err">

                     <target class="NotifyFiles">

                      <file URI="E:\testing\exception\Error.pptx" append="false"/>

                     </target>

                    </NotificationList>

                   </property>

                  </action>

                 </actions>

                </service>

              </services>

              </jbossesb>