1 2 3 4 5 Previous Next 64 Replies Latest reply on Oct 2, 2009 2:43 PM by kconner Go to original post
      • 15. Re: XPath Routing
        mvecera

         

        "tfennelly" wrote:
        Hi the following JIRA is a feature request for XPath based routing: https://jira.jboss.org/jira/browse/JBESB-2583

        In terms of "general" requirements, what did people have in mind?


        One thing that we should not forget about, is the possibility to specify namespaces for XPath queries. It was an issue with CBR based on Drools - JBESB-1426

        • 16. Re: XPath Routing
          mvecera

           

          "tfennelly" wrote:
          Just to be clear Kev... you want the XPath "rules" to be in an external rules file Vs being inline in the ESB config?


          I think that a message body part or a property should be able to carry the query as well.

          • 17. Re: XPath Routing
            kconner

             

            "tfennelly" wrote:
            I don't think anyone was suggesting doing a C&P job.

            I'm certain you would not do that, rather you would abstract it out into another class and base it off of that.

            "tfennelly" wrote:
            So you want an attribute containing an alias of some sort on it Vs specifying the actual class?

            There is already an extension mechanism in that class and, although it may not be how you nor I would choose to do it if starting from scratch, there is no *technical* reason for changing it. It may not be the cleanest interface but it does the job.

            There are pros and cons to both approach and I'm sure there will be advocates for each. Lets stick with the 'status quo' though.

            Assuming there is no technical reason for moving away from the current mechanism then an attribute would appear to be the simplest way of specifying the types. It is certainly better than specifying the full class name as an override. Are there any alternatives to this?

            Kev

            • 18. Re: XPath Routing
              tfennelly

               

              "mvecera@redhat.com" wrote:
              One thing that we should not forget about, is the possibility to specify namespaces for XPath queries. It was an issue with CBR based on Drools - JBESB-1426


              Okidoki... thanks Martin.

              • 19. Re: XPath Routing
                tfennelly

                 

                "Kevin.Conner@jboss.com" wrote:
                "tfennelly" wrote:
                I don't think anyone was suggesting doing a C&P job.

                I'm certain you would not do that, rather you would abstract it out into another class and base it off of that.

                "tfennelly" wrote:
                So you want an attribute containing an alias of some sort on it Vs specifying the actual class?

                There is already an extension mechanism in that class and, although it may not be how you nor I would choose to do it if starting from scratch, there is no *technical* reason for changing it. It may not be the cleanest interface but it does the job.

                There are pros and cons to both approach and I'm sure there will be advocates for each. Lets stick with the 'status quo' though.

                Assuming there is no technical reason for moving away from the current mechanism then an attribute would appear to be the simplest way of specifying the types. It is certainly better than specifying the full class name as an override. Are there any alternatives to this?

                Kev


                OK... thanks.

                • 20. Re: XPath Routing
                  tfennelly

                   

                  "mvecera@redhat.com" wrote:
                  "tfennelly" wrote:
                  Just to be clear Kev... you want the XPath "rules" to be in an external rules file Vs being inline in the ESB config?


                  I think that a message body part or a property should be able to carry the query as well.


                  Sorry Martin... are you requesting to be able to define an "XPath" that queries other Message parts (other than the main message payload)?

                  • 21. Re: XPath Routing
                    tfennelly

                     

                    "Kevin.Conner@jboss.com" wrote:
                    Assuming there is no technical reason for moving away from the current mechanism then an attribute would appear to be the simplest way of specifying the types.


                    Kev, how do you want this to behave if the user specifies a value for the cbrClass, as well as a value for this new attribute?

                    • 22. Re: XPath Routing
                      mvecera

                       

                      "tfennelly" wrote:
                      "mvecera@redhat.com" wrote:
                      "tfennelly" wrote:
                      Just to be clear Kev... you want the XPath "rules" to be in an external rules file Vs being inline in the ESB config?


                      I think that a message body part or a property should be able to carry the query as well.


                      Sorry Martin... are you requesting to be able to define an "XPath" that queries other Message parts (other than the main message payload)?


                      Actually, this is a good idea, but it is not what I meant. You were discussing a place where the XPath query should be placed (external file, jboss-esb.xml). I think that is should be possible to specify a message part as a location. Like this:
                      <property name="XPathQueryLocation" value="message.body.myQuery" />

                      or
                      <property name="XPathQueryLocation" value="message.property.myQuery" />
                      

                      For the dynamic query creation...

                      • 23. Re: XPath Routing
                        tfennelly

                        So how about calling this new attribute "cbrAlias", with supported values of "Drools" (default) and "XPath".

                        Something like:

                        <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="ContentBasedRouter">
                         <property name="cbrAlias" value="XPath"/>
                         <property name="ruleSet" value="..."/>
                         <property name="ruleLanguage" value="..."/>
                         <property name="ruleReload" value="true"/>
                         <property name="destinations">
                         <route-to destination-name="blue" service-category="BlueTeam" service-name="GoBlue" />
                         <route-to destination-name="red" service-category="RedTeam" service-name="GoRed" />
                         <route-to destination-name="green" service-category="GreenTeam" service-name="GoGreen" />
                         </property>
                        </action>


                        • 24. Re: XPath Routing
                          tfennelly

                           

                          "mvecera@redhat.com" wrote:
                          I think that is should be possible to specify a message part as a location. Like this:
                          <property name="XPathQueryLocation" value="message.body.myQuery" />

                          or
                          <property name="XPathQueryLocation" value="message.property.myQuery" />
                          

                          For the dynamic query creation...


                          Not sure I follow! The incoming message is specifying its own filtering parameter?? Can you outline the full use case more clearly please Martin i.e. when/how would this be used?

                          • 25. Re: XPath Routing
                            tfennelly

                            Just thinking about using SXC.... I think we should use it, but not call it XPath. SXC doesn't support the full XPath spec, so for XPath, I think we should use a full XPath implementation. We can also add an impl based on SXC, but call it "SXC" or "SXCPath" or something like that.

                            • 26. Re: XPath Routing
                              mvecera

                               

                              "tfennelly" wrote:
                              "mvecera@redhat.com" wrote:
                              I think that is should be possible to specify a message part as a location. Like this:
                              <property name="XPathQueryLocation" value="message.body.myQuery" />

                              or
                              <property name="XPathQueryLocation" value="message.property.myQuery" />
                              

                              For the dynamic query creation...


                              Not sure I follow! The incoming message is specifying its own filtering parameter?? Can you outline the full use case more clearly please Martin i.e. when/how would this be used?


                              Yes, exactly. Here is a sample scenario:
                              * A message contains an order. Each order item carries a store code and a weight.
                              * For minimizing postage cost, a custom action will compose an XPath query that points to the store code of the heaviest item in the order.
                              * CBR will use this query to route the message to the corresponding store for process.

                              Does it make sense?

                              • 27. Re: XPath Routing
                                tfennelly

                                 

                                "mvecera@redhat.com" wrote:
                                Yes, exactly. Here is a sample scenario:
                                * A message contains an order. Each order item carries a store code and a weight.
                                * For minimizing postage cost, a custom action will compose an XPath query that points to the store code of the heaviest item in the order.
                                * CBR will use this query to route the message to the corresponding store for process.

                                Does it make sense?


                                I understand what you're proposing, but I don't really see the benefit of it yet.

                                1. Why can't these routing expressions be defined with the CBR action Vs on the incoming message? What use case would not be supported?

                                2. If the invoking client is specifying the CBR expression to be used by the CBR, then does it not make the CBR step a bit redundant... why can't the client effectively perform the CBR?

                                3. From a logic standpoint, it seems to me that the appropriate place for the CBR rules is in/with the CBR action.

                                4. Security??

                                Martin, would you be OK with putting this one on the back boiler for now? We can always add it later.

                                • 28. Re: XPath Routing
                                  tfennelly

                                  So what I have now will look like the following....

                                  External rules file:

                                  <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="ContentBasedRouter">
                                   <property name="cbrClass" value="XPath"/>
                                   <property name="ruleSet" value="/rules/xpath/order-rules.properties"/>
                                   <property name="ruleReload" value="true"/>
                                   <property name="destinations">
                                   <route-to destination-name="blue" service-category="BlueTeam" service-name="GoBlue" />
                                   <route-to destination-name="red" service-category="RedTeam" service-name="GoRed" />
                                   <route-to destination-name="green" service-category="GreenTeam" service-name="GoGreen" />
                                   </property>
                                  </action>


                                  Inline rules:
                                  <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="ContentBasedRouter">
                                   <property name="cbrClass" value="XPath"/>
                                   <property name="ruleSet">
                                   <rule destination-name="blue" expression="/order/header[@cat='blue']" />
                                   <rule destination-name="red" expression="/order/header[@cat='red']" />
                                   <rule destination-name="green" expression="/order/header[@cat='green']" />
                                   </property>
                                   <property name="destinations">
                                   <route-to destination-name="blue" service-category="BlueTeam" service-name="GoBlue" />
                                   <route-to destination-name="red" service-category="RedTeam" service-name="GoRed" />
                                   <route-to destination-name="green" service-category="GreenTeam" service-name="GoGreen" />
                                   </property>
                                  </action>


                                  With namespaces:
                                  <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="ContentBasedRouter">
                                   <property name="cbrClass" value="XPath"/>
                                   <property name="ruleSet">
                                   <rule destination-name="blue" expression="/a:order/a:header[@cat='blue']" />
                                   <rule destination-name="red" expression="/b:order/b:header[@cat='red']" />
                                   <rule destination-name="green" expression="/c:order/c:header[@cat='green']" />
                                   </property>
                                   <property name="namespaces">
                                   <namespace prefix="a" uri="http://a" />
                                   <namespace prefix="b" uri="http://b" />
                                   <namespace prefix="c" uri="http://c" />
                                   </property>
                                   <property name="destinations">
                                   <route-to destination-name="blue" service-category="BlueTeam" service-name="GoBlue" />
                                   <route-to destination-name="red" service-category="RedTeam" service-name="GoRed" />
                                   <route-to destination-name="green" service-category="GreenTeam" service-name="GoGreen" />
                                   </property>
                                  </action>




                                  • 29. Re: XPath Routing
                                    burrsutter

                                    What does order-rules.properties look like?

                                    And will this support Wiretap use cases? A router skips other actions in the pipeline/chain. A wiretap allows them to execute, right?