2 Replies Latest reply on Jul 24, 2012 10:10 AM by zerayaqob

    NotifySqlTable and access to message header/metadata.

    zerayaqob

      Hi all,

       

      I am working on a problem that involves retreiving a file from an ftp server and pushing it to another ftp server. I wanted to log this process in a database and have managed to get to to work for text files... The problem is I really don't want to save the whole file in the database for the purpose of logging, just the file name will do. Is there a way to access the file name information from the NotifySqlTable notifier? If not, is there another way to do the logging while still making sure that the transfer has taken place?  And finally, is there a way to assign a variable name (hopefully  based on the file name) for the NotifyFtp property  'filename'? 

       

      Thanks.

      Below is my notifier action.

       

       

       

      <action name="notificationAction" class="org.jboss.soa.esb.actions.Notifier">

      <property name="okMethod" value="notifyOK" />

      <property name="notification-details">

      <NotificationList type="ok">

      <target class="NotifyFTP">

      <ftp URL="sftp://user:password@$server" filename="file.xxx" />

      </target>

      <target class="NotifySqlTable" driver-class="com.mysql.jdbc.Driver"

      connection-url="jdbc:mysql://localhost:3306/jboss" user-name="jboss"

      password="jboss" table="service_log" dataColumn="payload">

      <column name="status" value="success" />

      </target>

      </NotificationList> 

      <NotificationList type="err">

      <target class="NotifySqlTable" driver-class="com.mysql.jdbc.Driver"

      connection-url="jdbc:mysql://localhost:3306//jboss" user-name="jboss"

      password="jboss" table="service_log" dataColumn="payload">

      <column name="status" value="error" />

      </target>

      </NotificationList>          

      </property>

      </action>

        • 1. Re: NotifySqlTable and access to message header/metadata.
          tcunning

          Take a look at the message properties, specifically :

           

          org.jboss.soa.esb.gateway.original.file.name

          org.jboss.soa.esb.gateway.file

           

          One of those should be the filename you are looking for.     I don't think you can get the out of the box NotifySqlTable notifier to log the property - you'll probably have to extend it and make a couple trivial changes to get those properties logged - but that shouldn't be that tough.

          • 2. Re: NotifySqlTable and access to message header/metadata.
            zerayaqob

            org.jboss.soa.esb.gateway.original.file.name did the trick. I had resorted to using a custom RemoteFileMessageComposer to get at the filename, this is cleaner.  I solved the other problems by extending/modifying the out of the box notifiers.

             

            Thanks