Services composition…
is one of the wide narrated terminologies around the industry these times; I am here merely attempting to explain it
It’s a process by which you create a service that utilizes existing services to provide new functionality, either by directly aggregating results or adding to results some logic that extends the functionality of the existing services.
Elements: (SERVICE, is a web service, normally I refrain from using it this way but just for clarity)
- Service A : provide a certain functionality, response time is 0.5 X
- Service B: provide a certain functionality, response time is 0.5 X
- Challenge:
o Provide a functionality that basically based on the 2 services (some calc might be needed)
o (to add some excitement) Provide response time under 1.0 X
To do that we need to create a new service which basically calls the 2 services harvest the response do the calc and then return. Interestingly enough there are so many ways to do that
- WCF service that directly calls into each services in sequential way collect the results and return
o Will not be able to provide under 1.0 X
- WCF services that spawn off a couple of threads to do that (or method invoker) and collect result , this will include a bit of code and really takes a lot to maintain and change
- BizTalk orchestrations exposed as a WCF service, that does the same thing
o Will not be able to provide under 1.0 X, as BTS persistence will eat up the time
- Possible Solution:
o Use a WCF service that runs a workflow that executes the 2 calls in a parallel fashion aggregate them, no persistence or anything just pure code. In this model we are not using any host/WF instance communication which adds a lot of performance benfits.
how it looks like
Today I was into a discussion where the approach was proposed to fulfill a fairly straight forward requirements, putting things in place really shows the benefits of service orientation. Code here to download
- Service A Lib, Class library for service A
- Service A Host, console application hosting Service A
- Service B Lib, Class Library for service B
- Service B Host, Console application hosting service B
- Composethis, our composite service (console application)
o 1 * workflow that calls service A & service B
o 1 * service that calls into the workflow
o Hosting and configuration
- Composethisclient, a client that calls composethis service (console)
All included in one solution and using basicHttpBinding for clarity
Enjoy
Kal
ServiceComposeServiceCompose