13 Replies Latest reply on Jul 6, 2007 8:01 AM by marklittle

    Can you make a routing based on the message format?

      Hi,

      I'm trying to find out if it is possible to make a routing based on the message format, for example I know I can define in the gateway a filename pattern, such as ABC*.csv, but how do I check that the file is really a CSV file when I start to process it?

      Or another example, suppose i get two types of XML files on the same gateway, and based on the DTD each one must go on a different processing route. Is this possible, with drools/content routing?

        • 1. Re: Can you make a routing based on the message format?
          tfennelly

          Hi there.

          This should be possible. This is exactly what Content Based Routing is all about. There are a number of routing based quickstarts that may interest you - simple_cbr, fun_cbr, aggregator.

          The CBR implementation currently available supports a DSL for defining XPath based routing expressions. Should be possible to see all that in those quickstarts.

          Have fun :-)

          • 2. Re: Can you make a routing based on the message format?

            Ok, tnx

            I have 0 experience with Drools, so I had to ask. I'll try and see if it is possible and what are the limitations.

            • 3. Re: Can you make a routing based on the message format?
              burrsutter

              Check out the quickstarts called:
              static_router
              simple_cbr
              fun_cbr
              and eventually work your way up to aggregator

              • 4. Re: Can you make a routing based on the message format?
                sebcio

                Hi,
                I'm just facing same requriment. The examples mentioned by Burr utilizes content of the file. I'm trying to develop a file listner as gateway for more then one file format (in my example xml, csv and flat file). Can I get somehow on properties of files beeing read by gateway (particulary the filename, size, suffix, ...)? The content of files is not in focus at first step. Do I have to build custom file listner? Thx for help!

                • 5. Re: Can you make a routing based on the message format?
                  sebcio

                  I've forgotten to add: message.getProperties().getProperty("source") returns null. How do I can register the meta-data-filter to provide the message with properites as filename, size, ... (as source)

                  • 6. Re: Can you make a routing based on the message format?
                    sebcio

                    sorry but I can't edit my posts in forum, so the last update:

                    message.getProperties().getPropert("org.jboss.soa.esb.message.source"));
                    message.getProperties().getProperty("org.jboss.soa.esb.message.transport.type"));


                    with this filter:
                    org.jboss.internal.soa.esb.message.metadata.MetaDataFilter


                    returns:
                    11:44:05,631 INFO [STDOUT] PortReference < jms://localhost/queue/mds_fileGateway >
                    11:44:05,631 INFO [STDOUT] JMS

                    I've read this in Programmers Guide:
                    org.jboss.soa.esb.message.source: this is the source of the
                    message, e.g., the file from which is was read.


                    but my query not returns needed information. How do I have to get it? Thx again for any help.

                    • 7. Re: Can you make a routing based on the message format?

                      Hi,

                      your gateway is a JMS, maybe for that that's all the info you're gona get. Try using another gateway (FTP/file system) and see what the properties return.

                      Or the guide is wrong, maybe by the source they mean the source gateway...

                      • 8. Re: Can you make a routing based on the message format?
                        sebcio

                        Hello,

                        my gateway is a file gateway, it's slightly modified helloworld_file_action.

                        Files that are found in a particular directory with a particular extension are sent to a JMS queue with actions for processing

                        The information provided by filter is comming from JMS queue, I want get infos form previous step (file->JMS queue). I don't know how to get on it.
                        You wanted to build the similar solution, have you solved this problem?

                        • 9. Re: Can you make a routing based on the message format?
                          marklittle

                           

                          "sebcio" wrote:
                          but my query not returns needed information. How do I have to get it? Thx again for any help.


                          Add your own filter that will be used at deployment time if the default information is not sufficient. The manual describes how you can go about doing that.

                          • 10. Re: Can you make a routing based on the message format?
                            marklittle

                            BTW, any more issues about meta-data attached to (or obtained from) messages, please create a new forum posting and do not clutter this one. It makes it difficult for future readers to figure out where to go for help by browsing the forums only based on title. Thanks.

                            • 11. Re: Can you make a routing based on the message format?

                               

                              "sebcio" wrote:
                              Hello,

                              You wanted to build the similar solution, have you solved this problem?


                              We posponed the system until august. But that is still our issue. We built a servicing web site in the meantime, we are about to finish this one and we'll get back to building the ESB.

                              So the problem is still in our path, if you find any solution keep me informed. If not, I'll have to deal with it when I get there.

                              • 12. Re: Can you make a routing based on the message format?
                                sebcio

                                ok, I have to solve it till monday :-) Mark wrote its described in manual, I only found one sentece:

                                More meta-data can be added to the message by creating and registering suitable
                                filters.
                                , but the problem ist the data for this issue are not collecting on right place. The registered filter do the job right but one step to late (after transforming into message). If I could solve it, I'll give you to know.

                                • 13. Re: Can you make a routing based on the message format?
                                  marklittle

                                  PLEASE TAKE THIS DISCUSSION TO A NEW FORUM ENTRY :-) THANKS.