Daily Archives: July 3, 2006

Fetching FTP files with the WebSphere JText adapter

Today I have been configuring the WebSphere JText adapter. It is going to be used to suck down XML files from a remote FTP server, and drop them onto MQ queues serviced by WebSphere Message Broker. The BLOB data handler from SupportPac IA9F is also being used.

I’ve had some interesting times trying to get the adapter configured. The requirement is to fetch the files from the remote FTP server, archive them (copy them to one side) remotely, and not keep a local archive copy. After a bit of trial and error, I found the following settings to work:

Attribute Example value Meaning
JText meta-object
EventDir ftp://
This is the FTP URL the adapter is going to poll for input files. When it sees a file with an extension which matches the EventExt attribute setting (which might be xml in this case), it grabs it.

In the example here, I’ve encoded my username:password before the FTP hostname – you can also specify these in the FTPUserId and FTPPassword attributes.

FTPArchiveDir /rmt/archivefiles This is the directory on the FTP server to which files should be archived. Note that is is not an FTP URL, it is an absolute path from the root of the FTP server.
FTPLocalEventDir /some/local/dir This is the directory local to the adapter to which event files will be downloaded.
FTPRenameExt psd If specified, this will be used as the new file extension on the archived file, i.e. input.xml will become input.xml.psd in the remote archive dir.
ArchiveDir /tmp/archive If specified, and if archiving is enabled at a connector level (see below), files will be archived to this directory with a new file extension matching the one in the SuccessArchiveExt attribute (.success by default).

Important note – this cannot have an FTP URL as a value, even though the documentation currently says that it can…

EndBODelimiter EOF This specifies the delimiter for the Business Object. By setting it to EOF, we are saying that we want the whole file to be a single message.
Connector Configurator
ArchivingEnabled false Setting this to false prevents the adapter from performing local archiving of files. Slightly confusingly, remote archiving will still occur.

If this is set to true, then local archiving will occur, and the value of the ArchiveDir attribute in the JText meta-object will be read and used (an exception is thrown if it is blank). You will potentially end up with 3 copies of the file – one in FTPLocalEventDir, one in ArchiveDir, and one in FTPArchiveDir.

I don’t know if anyone else out there is puzzled by this stuff – if you are, then maybe this guide will be helpful.

JText adapter Infocenter
Adapters compatibility matrix
Using WBI Adapter Framework with WMB v6