8 Replies Latest reply on Apr 25, 2007 3:46 PM by Mark Little

    How do you get particular info from listeners?

    Mihai Anescu Newbie

      For example,

      I have a FTP listener, looking for .txt files in a specific folder.
      And I also set up a FTP/file notifier and I want to specify to this notifier the input filename.

      I looked in the code for the FTPNotifier, I set up the config, I can put the file on the remote server with a hardcoded filename, but I didn't find any info on the following:
      Hot to extract the filename from the incoming file? Is this possible? Does the Message in the action class contain any info about the incoming protocol? (for example if it were an email listener (which I understand is not available yet), could I retrieve info like: title of message, sender, list of receivers, etc?). Do my listener class have to extend a specific class, in order to gain access to the particular properties related to that protocol???

      I found out that I can set Objects on a message, via the properties, so I can set something like this:

      props.setProperty( "fileName", "Output" + System.currentTimeMillis() + ".dat" );

      and use this property in the Notifier to be the file name. But how do I get the original name of the file? Suppose I have to retrieve ABC18042007.dat and process it and send forward ABC18042007-processed.xml.

      BTW: @jboss guys, you should write in the Javadoc that you can set only Serializable objects with that method. I tried to put a POJO on the properties and everything freezes. No exception, warning, nothing. It just stops at the line where I put the object. Could be a "bug". I'm using the sources from SVN, fresh from today.

      Also, is there a way to get feedback from the notifier? For example if I send the file via FTPNotifier and the notifier gets some error (such as the remote folder does not exist, wrong username/password, etc), all I see is a stacktrace in the console. Is there some way to retrieve the error and consider the "transaction" failed?