Two Services or One?

The SOA Patterns of Thomas Erl contains a great pool of patterns that can be usefull for your SOA implementation. I want to use it within a project and especially the Service Layering Pattern.
I expose Services always through an ESB.

The next scenario puzzled me to introduce two or just one Service:
1) I have an Employee Entity (Common Data Model)
2) I have a TelephoneGuide (also a business entity?) that contains information about Employees
3) The telephone data is stored within a database

I encapsulated the database through a webservice (I implemented it with OpenJPA because we use ALSB)
Next I had two options which I will describe:
Option 1
Expose the database webservice as a separate Service, because it is an Application/Data/Utility Service. This Service does not contain CDM data but data that is more close to the database tables data.
Expose another Service that uses the Employee CDM entity and this is the TelephoneGuide Business Service.

Option 2
Only expose a Business Service with the Employee CDM entity.

Option 1
This gives you two Services in separate service layers. The Business Service uses the Data Service.
The Data Service can be reused by other Services. The Data Service can be governed separately and the scaled when necessary.

Option 2
The Data Service is seen as an implementation detail that is hidden and only one Service is exposed.

The project decided to go for option 2, but my feeling says it should have been option 1.

Of couse it is always a matter of context. Will there be a possibility of reuse for the Data Service or is this always related to the TelephoneGuide service?

Feel free to leave your comment or own experience.

No comments:

Post a Comment