You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Glenn Murray <gm...@mines.edu> on 2006/07/31 19:16:11 UTC

Newbie ftpPoller questions

Hi,

I am trying to evaluate ServiceMix as a data integration tool in a
scientific laboratory.  We need to poll remote directories for output
files.  For now I'm trying to fetch text files.

I set up an ftp server (Linux, wu-ftpd) which I can access from the
command line and Firefox.  The test-user account has test-file.xml and
test.txt files.  The http://servicemix.org/site/ftp.html page inspired
the xml below, but a lot of it is guesswork from looking at the
file-binding example.  I haven't changed any Java code.

When I run it I get the message below, and then nothing happens.
Please note that I am a complete newbie to ServiceMix, so I'm probably
missing something very obvious (e.g., it's not clear to me if I need
to hook the poller into the writer somehow).

Thanks much for your help!
Glenn


ftp-GM/$ ../../bin/servicemix ftp-servicemix.xml
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-112)
Java HotSpot(TM) Client VM (build 1.5.0_06-64, mixed mode, sharing)

Apache ServiceMix ESB: 3.0-M2-incubating

Loading Apache ServiceMix from file: ftp-servicemix.xml
INFO  - JBIContainer                   - Activating component for:
[container=ServiceMix,name=#SubscriptionManager#] with service: null
component: org.apache.servicemix.jbi.nmr.SubscriptionManager@65a5fa
INFO  - ComponentMBeanImpl             - Initializing component:
#SubscriptionManager#
INFO  - DeploymentService              - Restoring service assemblies
INFO  - JBIContainer                   - ServiceMix JBI Container
(http://servicemix.org/) name: ServiceMix running version: 3.0-M2-incubating
INFO  - JBIContainer                   - Activating component for:
[container=ServiceMix,name=ftpPoller] with service:
{http://servicemix.org/demo/}ftpPoller component:
org.apache.servicemix.components.net.FTPPoller@9b3a92
INFO  - ComponentMBeanImpl             - Initializing component: ftpPoller
INFO  - JBIContainer                   - Activating component for:
[container=ServiceMix,name=fileSender] with service:
{http://servicemix.org/demo/}fileSender component:
org.apache.servicemix.components.file.FileWriter@272454
INFO  - ComponentMBeanImpl             - Initializing component: fileSender


<?xml version="1.0" encoding="UTF-8"?>
<!-- GM ftp e.g.  -->
<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
	   xmlns:foo="http://servicemix.org/demo/">

  <!-- the JBI container -->
  <sm:container id="jbi" 
                useMBeanServer="true"
		        createMBeanServer="true" 
                dumpStats="true" 
                statsInterval="10">

	<sm:activationSpecs>

      <!-- Poll for files -->
      <sm:activationSpec componentName="ftpPoller" 
                         service="foo:ftpPoller" 
                         destinationService="foo:receiver">
        <sm:component>
          <bean class="org.apache.servicemix.components.net.FTPPoller">
            <property name="clientPool">
              <bean id="ftpClientPool" 
                   
class="org.apache.servicemix.components.net.FTPClientPool">
                <!-- property name="host" value="localhost"/-->
                <property name="host" value="192.174.39.126"/>
                <property name="username" value="test_user"/>
                <property name="password" value="testpasswd"/>
              </bean>
            </property>
            <property name="workManager" ref="workManager"/>
            <!-- <property name="path" value="foo"/> -->
            <property name="period" value="1000"/>
          </bean>
        </sm:component>
      </sm:activationSpec>

      <!-- Write files to the outbox directory -->
      <sm:activationSpec componentName="fileSender"
                         service="foo:fileSender">
        <sm:component>
          <bean xmlns="http://xbean.org/schemas/spring/1.0"
                class="org.apache.servicemix.components.file.FileWriter">
            <property name="directory" value="outbox" />
            <property name="marshaler">
              <bean
               
class="org.apache.servicemix.components.util.DefaultFileMarshaler">
              </bean>
            </property>
          </bean>
        </sm:component>
      </sm:activationSpec>

    </sm:activationSpecs>
  </sm:container>

  <!-- the work manager (thread pool) for this container -->
  <bean id="workManager"
        class="org.jencks.factory.WorkManagerFactoryBean">
    <property name="threadPoolSize" value="30" />
  </bean>

</beans>

-- 
View this message in context: http://www.nabble.com/Newbie-ftpPoller-questions-tf2028869.html#a5580074
Sent from the ServiceMix - User forum at Nabble.com.


Re: Newbie ftpPoller questions

Posted by Glenn Murray <gm...@mines.edu>.
Hi Cédric,

Thank you for your reply.  I implemented your suggestion and I seem to be
halfway there: my ftp logs
are showing that ServiceMix is logging in:

Aug  1 22:17:14 gmurray-09290s ftpd[440]: connection from localhost to
localhost
Aug  1 22:17:15 gmurray-09290s ftpd[440]: FTP LOGIN FROM localhost as user
(class: real, type: REAL)

Command line ftp is working fine.

I have a test user (named "user") on localhost with files "tmp.txt" in ~ and
~/dir1/.  However, the
files are not being transferred or deleted.  There are no error messages
from ServiceMix, but I'm
sure there must be a mistake(s) in my xml config (below).  I'm finding it
difficult to locate the right
documentation for this example, and I appreciate your help.

Thanks again,
Glenn


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
xmlns:foo="http://servicemix.org/demo/">

  <!-- the JBI container -->
  <sm:container id="jbi" useMBeanServer="true" createMBeanServer="true" 
                dumpStats="true" statsInterval="10">

	<sm:activationSpecs>

      <!-- Poll for files -->
      <sm:activationSpec componentName="ftpPoller" 
                         service="foo:ftpPoller" 
                         destinationService="foo:fileWriter">
        <sm:component>
          <bean class="org.apache.servicemix.components.net.FTPPoller">
            <property name="clientPool">
              <bean id="ftpClientPool"
class="org.apache.servicemix.components.net.FTPClientPool">
                <property name="host" value="localhost"/>
                <property name="username" value="user"/>
                <property name="password" value="user"/>
              </bean>
            </property>
            <property name="workManager" ref="workManager"/>
            <property name="path" value="/Users/user/dir1"/>
            <property name="period" value="10000"/>
          </bean>
        </sm:component>
      </sm:activationSpec>

      <!-- Write files to the outbox directory -->
      <sm:activationSpec componentName="fileWriter"
                         service="foo:fileWriter">
        <sm:component>
          <bean xmlns="http://xbean.org/schemas/spring/1.0"
                class="org.apache.servicemix.components.file.FileWriter">
            <property name="directory" 
                     
value="/Users/gmurray/Downloads/servicemix/examples/ftp-GM/outbox" />
            <property name="marshaler">
              <bean
               
class="org.apache.servicemix.components.util.DefaultFileMarshaler">
              </bean>
            </property>
          </bean>
        </sm:component>
      </sm:activationSpec>

    </sm:activationSpecs>
  </sm:container>

  <!-- the work manager (thread pool) for this container -->
  <bean id="workManager"
        class="org.jencks.factory.WorkManagerFactoryBean">
    <property name="threadPoolSize" value="30" />
  </bean>

</beans>

-- 
View this message in context: http://www.nabble.com/Newbie-ftpPoller-questions-tf2028869.html#a5607573
Sent from the ServiceMix - User forum at Nabble.com.


Re: Newbie ftpPoller questions

Posted by Mouilleron Cedric <ce...@bull.net>.
Hi.

If you want that your ftp poller component sends file to the fileSender 
component, you must specify, as destination service of the ftp 
component, the fileSender service and not "foo:receiver' which not exist.

<sm:activationSpec componentName="ftpPoller" 
                         service="foo:ftpPoller" 
                         destinationService="*foo:fileSender*">




Glenn Murray wrote:

>Hi,
>
>I am trying to evaluate ServiceMix as a data integration tool in a
>scientific laboratory.  We need to poll remote directories for output
>files.  For now I'm trying to fetch text files.
>
>I set up an ftp server (Linux, wu-ftpd) which I can access from the
>command line and Firefox.  The test-user account has test-file.xml and
>test.txt files.  The http://servicemix.org/site/ftp.html page inspired
>the xml below, but a lot of it is guesswork from looking at the
>file-binding example.  I haven't changed any Java code.
>
>When I run it I get the message below, and then nothing happens.
>Please note that I am a complete newbie to ServiceMix, so I'm probably
>missing something very obvious (e.g., it's not clear to me if I need
>to hook the poller into the writer somehow).
>
>Thanks much for your help!
>Glenn
>
>
>ftp-GM/$ ../../bin/servicemix ftp-servicemix.xml
>java version "1.5.0_06"
>Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-112)
>Java HotSpot(TM) Client VM (build 1.5.0_06-64, mixed mode, sharing)
>
>Apache ServiceMix ESB: 3.0-M2-incubating
>
>Loading Apache ServiceMix from file: ftp-servicemix.xml
>INFO  - JBIContainer                   - Activating component for:
>[container=ServiceMix,name=#SubscriptionManager#] with service: null
>component: org.apache.servicemix.jbi.nmr.SubscriptionManager@65a5fa
>INFO  - ComponentMBeanImpl             - Initializing component:
>#SubscriptionManager#
>INFO  - DeploymentService              - Restoring service assemblies
>INFO  - JBIContainer                   - ServiceMix JBI Container
>(http://servicemix.org/) name: ServiceMix running version: 3.0-M2-incubating
>INFO  - JBIContainer                   - Activating component for:
>[container=ServiceMix,name=ftpPoller] with service:
>{http://servicemix.org/demo/}ftpPoller component:
>org.apache.servicemix.components.net.FTPPoller@9b3a92
>INFO  - ComponentMBeanImpl             - Initializing component: ftpPoller
>INFO  - JBIContainer                   - Activating component for:
>[container=ServiceMix,name=fileSender] with service:
>{http://servicemix.org/demo/}fileSender component:
>org.apache.servicemix.components.file.FileWriter@272454
>INFO  - ComponentMBeanImpl             - Initializing component: fileSender
>
>
><?xml version="1.0" encoding="UTF-8"?>
><!-- GM ftp e.g.  -->
><beans xmlns:sm="http://servicemix.apache.org/config/1.0"
>	   xmlns:foo="http://servicemix.org/demo/">
>
>  <!-- the JBI container -->
>  <sm:container id="jbi" 
>                useMBeanServer="true"
>		        createMBeanServer="true" 
>                dumpStats="true" 
>                statsInterval="10">
>
>	<sm:activationSpecs>
>
>      <!-- Poll for files -->
>      <sm:activationSpec componentName="ftpPoller" 
>                         service="foo:ftpPoller" 
>                         destinationService="foo:receiver">
>        <sm:component>
>          <bean class="org.apache.servicemix.components.net.FTPPoller">
>            <property name="clientPool">
>              <bean id="ftpClientPool" 
>                   
>class="org.apache.servicemix.components.net.FTPClientPool">
>                <!-- property name="host" value="localhost"/-->
>                <property name="host" value="192.174.39.126"/>
>                <property name="username" value="test_user"/>
>                <property name="password" value="testpasswd"/>
>              </bean>
>            </property>
>            <property name="workManager" ref="workManager"/>
>            <!-- <property name="path" value="foo"/> -->
>            <property name="period" value="1000"/>
>          </bean>
>        </sm:component>
>      </sm:activationSpec>
>
>      <!-- Write files to the outbox directory -->
>      <sm:activationSpec componentName="fileSender"
>                         service="foo:fileSender">
>        <sm:component>
>          <bean xmlns="http://xbean.org/schemas/spring/1.0"
>                class="org.apache.servicemix.components.file.FileWriter">
>            <property name="directory" value="outbox" />
>            <property name="marshaler">
>              <bean
>               
>class="org.apache.servicemix.components.util.DefaultFileMarshaler">
>              </bean>
>            </property>
>          </bean>
>        </sm:component>
>      </sm:activationSpec>
>
>    </sm:activationSpecs>
>  </sm:container>
>
>  <!-- the work manager (thread pool) for this container -->
>  <bean id="workManager"
>        class="org.jencks.factory.WorkManagerFactoryBean">
>    <property name="threadPoolSize" value="30" />
>  </bean>
>
></beans>
>
>  
>