2 Replies Latest reply on Oct 6, 2010 11:48 PM by orien

    FTP listener, filename

    phillip.schulte

      Hey,

       

      my jboss-esb.xml looks like this

       

       

      <service category="de.eskalon.kn.garuda.invoice.HistoricalExchangeRates" name="HistoricalExchangeRateImporter" description="Imports historical exchange rates from ftp directory files" invmScope="GLOBAL">
       <service category="de.eskalon.kn.garuda.invoice.HistoricalExchangeRates" name="HistoricalExchangeRateImporter" description="Imports historical exchange rates from ftp directory files" invmScope="GLOBAL">
                  <listeners>
                      <ftp-listener busidref="currency-ftp-in" is-gateway="true" maxThreads="2" name="ftp-listener-gateway"  scheduleidref="everyminute" />
                  </listeners>
                  <actions mep="OneWay">
                       <action name="transform" class="org.jboss.soa.esb.actions.converters.ByteArrayToString">
                          <property name="encoding" value="UTF-8" />
                      </action>
                      <action class="org.jboss.soa.esb.actions.EJBProcessor" name="callPersist">
                          <property name="ejb3" value="true" />
                          <property name="jndi-name" value="garuda-invoice/HistoricalExchangeRatesManagerBean/remote" />
                          <property name="initial-context-factory" value="org.jnp.interfaces.NamingContextFactory" />
                          <property name="provider-url" value="localhost:1099" />
                          <property name="method" value="persistRate" />
                          <property name="ejb-params">
                              <arg0 type="java.lang.String">org.jboss.soa.esb.message.defaultEntry</arg0>
                              <arg1 type="java.lang.String">???? </arg1>
                          </property>
                          <property name="esb-out-var" value="get-order-response" />
                      </action>
                      
      
                  </actions>
              </service>
      
                  <listeners>
                      <ftp-listener busidref="currency-ftp-in" is-gateway="true" maxThreads="2" name="ftp-listener-gateway"  scheduleidref="everyminute" />
                  </listeners>
                 <actions mep="OneWay">
      
      

       

      My question is how can I access the filename from the file that the ftp-listener had read?

       

      Best regards

       

      Phillip

        • 1. Re: FTP listener, filename
          phillip.schulte

          after researching I got this

           

          <arg0 type="java.lang.String">org.jboss.soa.esb.gateway.original.file.name</arg0>

           

          but it always returns null! Any ideas what I am doing wrong? It's kind of frustrating..

          • 2. Re: FTP listener, filename
            orien

            Hi Phillip,

            The problem is the file name is stored on the message as a property, but the EJBProcessor is searching only the message body. Try adding a custom action before EJBProcessor action that copies the file name into the message body. Something like:

             

            {code} public class MessagePropertyToBodyAction extends AbstractActionLifecycle implements BeanConfiguredAction {     public Message process(Message message) {         Object fileName = message.getProperties().getProperty("org.jboss.soa.esb.gateway.original.file.name");         message.getBody().add("org.jboss.soa.esb.gateway.original.file.name", fileName);         return message;     } } {code}