5 Replies Latest reply on Jul 22, 2010 5:23 AM by Tom Eicher

    NotifyFiles: File names generated at runtime?

    Tim Lam Newbie

      Is it possible to writes files out using NotifyFiles with file names that are determined at runtime?  For example, I would like for an input file to be read from an input directory and use the name of the input file to generate the name of the corresponding output file name.  Or maybe the output file name could be the "<message.id>.txt"  According to the documentation and examples that I've seen it doesn't seem like JBoss ESB is capable of doing this out of the box.  It looks like file names need to be hardcoded in the configuration (which is really inflexible and seems to be a pretty useless feature).  I've used other ESB like Apache Synapse that allow me to do this.  Can someone please help me out?  Thanks in advanced!

        • 1. Re: NotifyFiles: File names generated at runtime?
          Kevin Conner Master

          It may be that the docs are in error in that case, as this should be possible.  What is it that you want to do?

           

          Kev

          • 2. Re: NotifyFiles: File names generated at runtime?
            Tim Lam Newbie

            I'm working with a system that uses xml file based input and output and would like to use JBoss ESB so that It can take an arbitrary input file from a directory, have it run through the action processing chain calling a external Axis2 WSDL based web service, and then transform the SOAP response into a resulting XML and writing that out using NotifyFiles.  I would like to, if possible, make the output filename the same as the input filename, but there doesn't seem to be any good documentation to support this.  I did some searching and have seen people using property substitution in jboss-esb.xml but can't seem to find out how property substitution works and if there are "well-known" properties that I might be able to leverage.  Also if it's possible to create custom properties that I could use in jboss-esb.xml.  If this is documented somehow it would save people like me a bunch of time searching all over the place to do this.  Any help would be appreciated.  Thanks!

            • 3. Re: NotifyFiles: File names generated at runtime?
              Kevin Conner Master

              There are two different aspects to your last comments

               

              - property substitution in jboss-esb.xml

              - dynamic names for file creation

               

              The properties in the first case are purely System properties and take effect at deploy time.  The server defines a number of these, usually logged in the boot.log file, but you can obviously add your own to this.

               

              The second case can use dynamic substitution based on the contents of the message and is interpreted as follows

              - If the file URI contains elements contained in {} then see if they exist in message.getProperties and substitute.

              - If the URI represents the location of on object in the message (see ObjectMapper) and is a String/URI then use this value

              - Use the value as is

               

              The example you need seems to be something like the following, which works with the service in the helloworld_file_action QS

               

              <action name="notificationAction">
                <property name="okMethod" value="notifyOK" />
                <property name="notification-details">
                  <NotificationList type="ok">
                    <target>
                      <file append="false" URI="@OUTPUTDIR@/{org.jboss.soa.esb.gateway.original.file.name}.result.kev"/>
                    </target>
                  </NotificationList>
                </property>
              </action>
              

               

              (org.jboss.soa.esb.gateway.original.file.name is a property on the message, created by the file gateway)

               

              Kev

              • 4. Re: NotifyFiles: File names generated at runtime?
                Tim Lam Newbie

                Thanks for the help!  You wouldn't believe how much searching and experimenting I've wasted trying to search for this.

                • 5. Re: NotifyFiles: File names generated at runtime?
                  Tom Eicher Newbie

                  Tim, if the documentations is wrong or imcomplete, why not open a JIRA task to provide your additions or corrections ? Cheers, Tom.