3 Replies Latest reply on Jun 30, 2008 8:08 AM by Mark Little

    fine-garined vs coarse-grained services

    evan yang Newbie

      I have a generic design question regarding how to define esb services, here is an example:

      I have 3 fine-grained services A, B and C, ideally I should define an esb service to hide the routing/transformation/etc. of these 3 services, so client only talk to this esb service.

      so in the jboss-esb.xml, we may have this:

      <services>
       <service category="mycategory" name="myservice" description="something">
       <listeners>...</listeners>
       <action mep="oneWay">
       <action name="serviceA" class="..." />
       <action name="serviceB" class="..." />
       <action name="serviceC" class="..." />
       </service>
       </services>
      


      But take a deeper look at the logic surround the services:

      1. service A actually need to have CBR for even more find-grained services:
      if rule 1 route to A-1
      if rule 2 route to A-2
      etc.

      2. the service B and C may also can grow with even finer services

      The new service can be like this:

      <services>
       <service category="mycategory" name="myservice" description="something">
       <listeners>...</listeners>
       <action mep="oneWay">
       <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="ContentBasedRouter">
       ....
       <property name="destinations">
       <route-to destination-name="x" service-category="mycategoryA1BC" service-name="myserviceA1BC/>
       <route-to destination-name="y" service-category="mycategoryA2BC" service-name="mysericeA2BC"/>
       </property>
       ....
       </service>
       <service category="mycategoryA1BC" name="myserviceA1BC" description="something">
       <action name="serviceA1" class="..." />
       <action name="serviceB" class="..." />
       <action name="serviceC" class="..." />
       </service>
       <service category="mycategoryaA2BC" name="myserviceA2BC" description="something">
       <action name="serviceA2" class="..." />
       <action name="serviceB" class="..." />
       <action name="serviceC" class="..." />
       </service>
       </services>
      


      and it can grow complicate soon.

      So my question is how to define fine-grained service and can be used by a coarse-grained service all inside the esb? something like this:

      <services>
       <service category="mycategoryA" name="myserviceA" description="something">
       ....
       <action mep="oneWay">
       <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="ContentBasedRouter">
       ....
       <property name="destinations">
       <route-to destination-name="x" service-category="mycategoryA1" service-name="myserviceA1/>
       <route-to destination-name="y" service-category="mycategoryA2" service-name="mysericeA2"/>
       </property>
       ....
       </service>
       <service category="mycategoryA1" name="myserviceA1" description="something">
       <action name="serviceA1" class="..." />
       </service>
       <service category="mycategoryA2" name="myserviceA2" description="something">
       <action name="serviceA2" class="..." />
       </service>
      
       <service category="mycategoryB" name="myserviceB" description="something">
       <action name="serviceB1" class="..." />
       <action name="serviceB2" class="..." />
       </service>
      
       <service category="mycategoryC" name="myserviceC" description="something">
       <action name="serviceC1" class="..." />
       <action name="serviceC2" class="..." />
       </service>
      
       <service category="mycategory" name="myservice" description="something">
       <listeners>...</listeners>
       <action mep="oneWay">
       <action name="serviceA" class="call myserviceA mycategoryA" />
       <action name="serviceB" class="call myserviceB mycategoryC" />
       <action name="serviceC" class="call myserviceD mycategoryD />
       </service>
       </services>
      


      What is the best practice in design of services?
      Thanks

      Evan