Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pattern to provide One point of access to multiple services.

 
pawan chopra
Ranch Hand
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have multiple services each service calls database and fetch some data based on some criteria. For example;

StateService fetch state based on id from database
BusinessLineService fetch business object

There are couple more like this.

Now for single page I need data from these services. I am not sure where should I call these methods? I was thinking to do that in my controller. But then I have a scenario where I have to actually fetch data from two services and merge them. Not sure what should be the way. Can any one guide me on this? Thanks.
 
Haripraghash Subramaniam
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say services, are they deployed and hosted separately? If they are deployed and hosted separately from the web application, i believe more importantly, it will lead to chatty interfaces. But to address your concern, you need to have a facade/Service agent in your web application that does the calls and wraps the resulting data into a single class and returns it.
 
Dieter Quickfend
Bartender
Posts: 543
4
Java Netbeans IDE Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed, Session Facade and Transfer Object are two good patterns to be looking at. If your services are remote, you could add Service Locator and Business Delegate to that.
 
pawan chopra
Ranch Hand
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

Thanks for suggestions. Services are local. But I think it doesn't matter I can use Facade design pattern. But I thought there may be something better than that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic