11 Replies Latest reply on Jul 7, 2007 4:48 PM by marklittle

    Meta-data attached to messages

    sebcio

      Hi Mark,

      after your "request" to open new thread for "message-decoration" ;-) (see: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=107709). The InputOutputFilter is doing his job right, but its a one step to late. Sorry, but I couldn't find an explanation how to do it (programmers manual). The property "source" should provide correct info about input files read by file gateway, but we've got properties of JMS queue here. My question is, how to decorate message with properties such as filename, size, and "entry time" at the file listner gateway. The methods onInput method of InputOutputFilter is the rigtht one, but how can I get the properites of files read by gateway.

        • 1. Re: Meta-data attached to messages
          marklittle

          Thanks. I'll take a look and get back to you.

          • 2. Re: Meta-data attached to messages
            burrsutter

            Mark recently told me about a change to the Systemprintln action that will dump the contents of the Message to the console. You can stick the following in helloworld_file_action quickstart to see it in action (assuming SVN head, not MR2):

            <action name="dump" class="org.jboss.soa.esb.actions.SystemPrintln">
             <property name="printfull" value="true"/>
            </action>
            


            There may be more options available to get even more information. Using this trick I'm now able to see that there is a property called "org.jboss.soa.esb.gateway.original.file.name" as one example.

            However, I do not see the date time the message entered the system.

            But this trick will at least tell you what is available.

            • 3. Re: Meta-data attached to messages
              derek.adams

              I added the property for original file name a while back because of a business requirement in my company. The problem I ran into was the information about the incoming file (file system or ftp) is only available in gateway code and is not available when the filters are processed. For the short term, we may want to add other properties in the same place where the original file name is added.

              • 4. Re: Meta-data attached to messages
                sebcio

                Hi Derek,
                could you tell me, how did you do it? Where is the proper place to "decorate" the message with this informations (did you customized the orginal file gateway)? This is exactly what I need - filename, size, date...
                Thx

                • 5. Re: Meta-data attached to messages
                  derek.adams

                  I added the extra metadata in the org.jboss.soa.esb.listeners.gateway.AbstractFileGateway class (base class for file and ftp gateways). If you look in the doRun() method in the loop that iterates over matching files, the property is added right after the message is created by the composer. I can add the other props if needed -- basically anything available in java.io.File could be added.

                  • 6. Re: Meta-data attached to messages
                    marklittle

                    I'll take a look at this and see if I can make it as extensible as the filter approach.

                    • 7. Re: Meta-data attached to messages
                      marklittle

                      See this. Once I update the documentation, I'll check this stuff in. Should be later today.

                      • 8. Re: Meta-data attached to messages
                        marklittle

                        And this to see when it's in trunk.

                        • 9. Re: Meta-data attached to messages
                          sebcio

                          Hi Mark,

                          great job! I think, it's great value-added to other projects, so they can fullfil such requirements as loging inputs on gateways. Thanks!

                          • 10. Re: Meta-data attached to messages
                            marklittle

                            OK, it's in. Check the section on meta-data and filters in the programmers guide for details. And please note the changes in signatures and property names from the last MR.

                            • 11. Re: Meta-data attached to messages
                              marklittle

                               

                              "derek.adams" wrote:
                              I added the property for original file name a while back because of a business requirement in my company. The problem I ran into was the information about the incoming file (file system or ftp) is only available in gateway code and is not available when the filters are processed. For the short term, we may want to add other properties in the same place where the original file name is added.


                              Derek, please take a look at the changes I made and make sure they still do what you need. If not, let me know and I'll modify appropriately.