Wednesday, February 25, 2009

Toplink MultiProjects with Cache Coordination

I would love to call it a Hub and Spoke architecture. Its pretty common to have enterprise applications grow in a way that numerous applications spring up that work and share only a subset of domain objects of a "Big Daddy" application. For example a central application that does Order management and creates Shipments. Other application only works on Shipment details and other may be doing an analytic on the Products sold. With Toplink it is fairly simple to do so and the trick is to partition the application in multiple independent units and map it with their respective data model accordingly. Toplink session allows to have multiple projects. Click on the Session and General tab, select Multiple Projects checkbox and provide the name of the primary toplink project (In our example that would be Order).

Select Multiple Projects tab and click the Add button. Select other components of the application, in our example it would be Shipment. Repeat the process for each component of the application.

Then create another Toplink session (Either in the same sessions.xml or multiple sessions_xxx.xml files) for each individual components. The following image shows the Shipment project:

And repeat for each individual applications. Deploy the Big application and then other "spoke" applications. One more important thing.. Make sure they all share the same Cache Coordination configuration. If using RMI same multicast address and port and their each individual Registry Naming Services.

And thats pretty much it you need. Toplink, Cache Coordination and judiciously partitioning the application to individual components can achieve a true hub-n-spoke enterprise application. For a sample project download it from: Sample Toplink Project

No comments: