Deal of the Day

Home » Main » Manning Forums » 2008 » Mule in Action

Thread: ftp from chapter 3

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 5 - Pages: 1 - Last Post: Feb 4, 2009 11:33 PM by: kyagen Threads: [ Previous | Next ]
mwolfe

Posts: 4
From: raleigh, NC
Registered: 12/11/08
ftp from chapter 3
Posted: Dec 11, 2008 9:50 AM
  Click to reply to this thread Reply

i am having a little trouble with your ftp example from chapter 3

when the inbound ftp server downloads the files to the 'out' directory it names them like:

2e202df7-c798-11dd-9fb1-9fa3568dc229.dat
2e20a332-c798-11dd-9fb1-9fa3568dc229.dat
2e20ca49-c798-11dd-9fb1-9fa3568dc229.dat
2e20f15c-c798-11dd-9fb1-9fa3568dc229.dat

the actual file names on the ftp server are:

mpw.dat
postgres.txt
references.txt
rsync.txt

question: why are the file name in the 'out' directory so different then the actual
file name? i would expect that the names downloading would be the same?

polling does not work the 2rd time. i would expect that it should poll with
the frequency declared in the config file; instead the 2rd time through i get an
exception?! is there an 'outputPattern for the ftp connector as i would like to put
a time stamp on the downloaded files.

here is my config file

<mule xmlns="http://www.mulesource.org/schema/mule/core/2.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:file="http://www.mulesource.org/schema/mule/file/2.1"
xmlns:ftp="http://www.mulesource.org/schema/mule/ftp/2.1"
xmlns:xm="http://www.mulesource.org/schema/mule/xml/2.1"
xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.1"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.mulesource.org/schema/mule/core/2.1 http://www.mulesource.org/schema/mule/core/2.1/mule.xsd
http://www.mulesource.org/schema/mule/file/2.1 http://www.mulesource.org/schema/mule/file/2.1/mule-file
.xsd
http://www.mulesource.org/schema/mule/ftp/2.1 http://www.mulesource.org/schema/mule/ftp/2.1/mule-ftp.xsd
http://www.mulesource.org/schema/mule/xml/2.1 http://www.mulesource.org/schema/mule/xml/2.1/mule-xml.xsd
http://www.mulesource.org/schema/mule/stdio/2.1 http://www.mulesource.org/schema/mule/stdio/2.1/mule-stdio.xsd"
>
<!--
<global-property name="ftp.host" value="localhost"/>
<global-property name="ftp.port" value="21"/>
<global-property name="ftp.path" value="/files"/>
<global-property name="ftp.freq" value="36000"/>
-->
<global-property name="ftp.host" value="localhost"/>
<global-property name="ftp.port" value="21"/>
<global-property name="ftp.path" value="/"/>
<global-property name="ftp.freq" value="100000"/>


<model name="ftpModel">
<service name="ftpService">
<inbound>
<ftp:inbound-endpoint user="anonymous" password="anonymous"
host="${ftp.host}" port="${ftp.port}" path="${ftp.path}" pollingFrequency="${ftp.freq}"/>
</inbound>
<outbound>
<pass-through-router>
<file:outbound-endpoint path="./out" />
</pass-through-router>
</outbound>
</service>
</model>
</mule>

- Michael

mwolfe

Posts: 4
From: raleigh, NC
Registered: 12/11/08
Re: ftp from chapter 3
Posted: Dec 11, 2008 4:35 PM   in response to: mwolfe in response to: mwolfe
  Click to reply to this thread Reply

ok this takes care of the file name problem:
now i can save the original file name plus add a date stamp to it.
the polling problem still exists. the first time the Poll Frequency works the 2rd time
i get:


INFO 2008-12-11 17:34:50,596 [connector.ftp.0.receiver.6] org.mule.DefaultExceptionStrategy: There is no current event available, routing Null message with the exception



<global-property name="ftp.host" value="localhost"/>
<global-property name="ftp.port" value="21"/>
<global-property name="ftp.path" value="/"/>
<global-property name="ftp.freq" value="100000"/>


<model name="ftpModel">
<service name="ftpService">
<inbound>
<ftp:inbound-endpoint user="anonymous" password="anonymous"
host="${ftp.host}" port="${ftp.port}" path="${ftp.path}" pollingFrequency="${ftp.freq}" />
</inbound>
<outbound>
<pass-through-router>
<file:outbound-endpoint path="./out"
outputPattern="[ORIGINALNAME]-[DATE].dat" />
</pass-through-router>
</outbound>
</service>
</model>
</mule>

johndemic

Posts: 52
From: Brooklyn, NY
Registered: 10/3/06
Re: ftp from chapter 3
Posted: Dec 12, 2008 12:55 PM   in response to: mwolfe in response to: mwolfe
  Click to reply to this thread Reply

Hey Michael,

I think this might be related to the following JIRA issue:

http://mule.mulesource.org/jira/browse/MULE-3192

Can you confirm the stack trace is the same or paste it here?

Thanks,
-jd

mwolfe

Posts: 4
From: raleigh, NC
Registered: 12/11/08
Re: ftp from chapter 3
Posted: Dec 12, 2008 2:26 PM   in response to: johndemic in response to: johndemic
  Click to reply to this thread Reply

*** output from mule console for chapter03/ftp


**********************************************************************
* Mule ESB and Integration Platform *
* Version: 2.1.1 Build: 13103 *
* MuleSource, Inc. *
* For more information go to http://mule.mulesource.org *
* *
* Server started: 12/12/08 3:18 PM *
* Server ID: ff1da3ae-c889-11dd-b1ae-ef93d3d5da2a *
* JDK: 1.6.0_10 (mixed mode) *
* Encoding: OS: ANSI_X3.4-1968, Mule: UTF-8 *
* OS: Linux (2.6.24-gentoo-r8, amd64) *
* Host: gentoo8400 (127.0.0.1) *
* *
* Agents Running: None *
**********************************************************************
INFO 2008-12-12 15:18:12,982 [connector.file.0.dispatcher.1] org.mule.transport.file.FileConnector: Writing file to: /home/mwolfe/esb/trunk/chap
ter03/ftp/out/mpw.dat-12-12-08_15-18-12.981.dat
INFO 2008-12-12 15:18:12,985 [connector.file.0.dispatcher.3] org.mule.transport.file.FileConnector: Writing file to: /home/mwolfe/esb/trunk/chap
ter03/ftp/out/rsync.txt-12-12-08_15-18-12.985.dat
INFO 2008-12-12 15:18:12,986 [connector.file.0.dispatcher.2] org.mule.transport.file.FileConnector: Writing file to: /home/mwolfe/esb/trunk/chap
ter03/ftp/out/postgres.txt-12-12-08_15-18-12.986.dat
INFO 2008-12-12 15:18:12,987 [connector.file.0.dispatcher.4] org.mule.transport.file.FileConnector: Writing file to: /home/mwolfe/esb/trunk/chap
ter03/ftp/out/references.txt-12-12-08_15-18-12.987.dat

NOTE: above the first time the Poll Frequency works
NOTE: Below is the 2rd pass and it fails.

ERROR 2008-12-12 15:19:52,928 [connector.ftp.0.receiver.6] org.mule.DefaultExceptionStrategy: Caught exception in Exception Strategy: Unknown parser type: Directory successfully changed.
org.apache.commons.net.ftp.parser.ParserInitializationException: Unknown parser type: Directory successfully changed.
at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createFileEntryParser(DefaultFTPFileEntryParserFactory.java:118)
at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2358)
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2141)
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2188)
at org.mule.transport.ftp.FtpMessageReceiver.listFiles(FtpMessageReceiver.java:96)
at org.mule.transport.ftp.FtpMessageReceiver.poll(FtpMessageReceiver.java:72)
at org.mule.transport.PollingReceiverWorker.run(PollingReceiverWorker.java:47)
at org.mule.work.WorkerContext.run(WorkerContext.java:310)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
at java.lang.Thread.run(Thread.java:619)
INFO 2008-12-12 15:19:52,929 [connector.ftp.0.receiver.6] org.mule.DefaultExceptionStrategy: There is no current event available, routing Null message with the exception


______________________________________________________
Here is my full ftp-inbound-config.xml
------------------------------------------------------------------------------------------------------------

<mule xmlns="http://www.mulesource.org/schema/mule/core/2.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:file="http://www.mulesource.org/schema/mule/file/2.1"
xmlns:ftp="http://www.mulesource.org/schema/mule/ftp/2.1"
xmlns:xm="http://www.mulesource.org/schema/mule/xml/2.1"
xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.1"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.mulesource.org/schema/mule/core/2.1 http://www.mulesource.org/schema/mule/core/2.1/mule.xsd
http://www.mulesource.org/schema/mule/file/2.1 http://www.mulesource.org/schema/mule/file/2.1/mule-file.xsd
http://www.mulesource.org/schema/mule/ftp/2.1 http://www.mulesource.org/schema/mule/ftp/2.1/mule-ftp.xsd
http://www.mulesource.org/schema/mule/xml/2.1 http://www.mulesource.org/schema/mule/xml/2.1/mule-xml.xsd
http://www.mulesource.org/schema/mule/stdio/2.1 http://www.mulesource.org/schema/mule/stdio/2.1/mule-stdio.xsd"
>
<!--
<global-property name="ftp.host" value="localhost"/>
<global-property name="ftp.port" value="21"/>
<global-property name="ftp.path" value="/files"/>
<global-property name="ftp.freq" value="36000"/>
-->
<global-property name="ftp.host" value="localhost"/>
<global-property name="ftp.port" value="21"/>
<global-property name="ftp.path" value="/"/>
<global-property name="ftp.freq" value="100000"/>


<model name="ftpModel">
<service name="ftpService">
<inbound>
<ftp:inbound-endpoint user="anonymous" password="anonymous"
host="${ftp.host}" port="${ftp.port}" path="${ftp.path}" pollingFrequency="${ftp.freq}" />
</inbound>
<outbound>
<pass-through-router>
<file:outbound-endpoint path="./out"
outputPattern="[ORIGINALNAME]-[DATE].dat" />
</pass-through-router>
</outbound>
</service>
</model>
</mule>
~

-- Michael

johndemic

Posts: 52
From: Brooklyn, NY
Registered: 10/3/06
Re: ftp from chapter 3
Posted: Dec 13, 2008 1:23 PM   in response to: mwolfe in response to: mwolfe
  Click to reply to this thread Reply

Michael,

This seems like the same issue in the JIRA - I'll add a note advising as such to CH3.

Thanks,
-jd

kyagen

Posts: 1
From: San Francisco, CA
Registered: 2/4/09
Re: ftp from chapter 3
Posted: Feb 4, 2009 11:33 PM   in response to: johndemic in response to: johndemic
  Click to reply to this thread Reply

This should be fixed in the upcoming Mule 2.1.3 and Mule 2.2 releases.

ken

Legend
Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff